summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-04-15 00:34:00 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-04-15 00:34:00 +0100
commitbf028388163f3c5e8fd235ccd5d81efa16d1eb22 (patch)
tree870dbbbc0bbc669fc12117f516167ad5ea0f6116 /src
parent63bbb6e3dfdbbcd2ce52cec5b4b08795c0b5d008 (diff)
Remove is_blank, which is identical to is_horizontal_blank
Diffstat (limited to 'src')
-rw-r--r--src/completion.cc4
-rw-r--r--src/input_handler.cc6
-rw-r--r--src/selectors.cc8
-rw-r--r--src/selectors.hh12
-rw-r--r--src/unicode.hh11
5 files changed, 18 insertions, 23 deletions
diff --git a/src/completion.cc b/src/completion.cc
index 9fc3ed78..70a6f1c2 100644
--- a/src/completion.cc
+++ b/src/completion.cc
@@ -17,10 +17,10 @@ Completions shell_complete(const Context& context, CompletionFlags flags,
{
command = (pos == 0 or prefix[pos-1] == ';' or prefix[pos-1] == '|' or
(pos > 1 and prefix[pos-1] == '&' and prefix[pos-2] == '&'));
- while (pos != len and is_blank(prefix[pos]))
+ while (pos != len and is_horizontal_blank(prefix[pos]))
++pos;
word_start = pos;
- while (pos != len and not is_blank(prefix[pos]))
+ while (pos != len and not is_horizontal_blank(prefix[pos]))
++pos;
word_end = pos;
}
diff --git a/src/input_handler.cc b/src/input_handler.cc
index b5f9e817..8b672288 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -266,7 +266,7 @@ void to_next_word_begin(CharCount& pos, StringView line)
while (pos != len and is_word<word_type>(line[pos]))
++pos;
}
- while (pos != len and is_blank(line[pos]))
+ while (pos != len and is_horizontal_blank(line[pos]))
++pos;
}
@@ -278,7 +278,7 @@ void to_next_word_end(CharCount& pos, StringView line)
return;
++pos;
- while (pos != len and is_blank(line[pos]))
+ while (pos != len and is_horizontal_blank(line[pos]))
++pos;
if (word_type == Word and is_punctuation(line[pos]))
@@ -301,7 +301,7 @@ void to_prev_word_begin(CharCount& pos, StringView line)
return;
--pos;
- while (pos != 0_char and is_blank(line[pos]))
+ while (pos != 0_char and is_horizontal_blank(line[pos]))
--pos;
if (word_type == Word and is_punctuation(line[pos]))
diff --git a/src/selectors.cc b/src/selectors.cc
index 5d5b7d2e..526baf53 100644
--- a/src/selectors.cc
+++ b/src/selectors.cc
@@ -259,7 +259,7 @@ Selection select_sentence(const Buffer& buffer, const Selection& selection, Obje
{
BufferIterator prev_non_blank = first-1;
skip_while_reverse(prev_non_blank, buffer.begin(),
- [](char c) { return is_blank(c) or is_eol(c); });
+ [](char c) { return is_horizontal_blank(c) or is_eol(c); });
if (is_end_of_sentence(*prev_non_blank))
first = prev_non_blank;
}
@@ -273,7 +273,7 @@ Selection select_sentence(const Buffer& buffer, const Selection& selection, Obje
{
char cur = *first;
char prev = *(first-1);
- if (not is_blank(cur))
+ if (not is_horizontal_blank(cur))
saw_non_blank = true;
if (is_eol(prev) and is_eol(cur))
{
@@ -289,7 +289,7 @@ Selection select_sentence(const Buffer& buffer, const Selection& selection, Obje
}
--first;
}
- skip_while(first, buffer.end(), is_blank);
+ skip_while(first, buffer.end(), is_horizontal_blank);
}
if (flags & ObjectFlags::ToEnd)
{
@@ -304,7 +304,7 @@ Selection select_sentence(const Buffer& buffer, const Selection& selection, Obje
if (not (flags & ObjectFlags::Inner) and last != buffer.end())
{
++last;
- skip_while(last, buffer.end(), is_blank);
+ skip_while(last, buffer.end(), is_horizontal_blank);
--last;
}
}
diff --git a/src/selectors.hh b/src/selectors.hh
index 4ca23030..f5cf8504 100644
--- a/src/selectors.hh
+++ b/src/selectors.hh
@@ -58,7 +58,7 @@ Selection select_to_next_word(const Buffer& buffer, const Selection& selection)
else if (is_word<word_type>(*begin))
skip_while(end, buffer.end(), is_word<word_type>);
- skip_while(end, buffer.end(), is_blank);
+ skip_while(end, buffer.end(), is_horizontal_blank);
return utf8_range(begin, end-1);
}
@@ -76,7 +76,7 @@ Selection select_to_next_word_end(const Buffer& buffer, const Selection& selecti
if (begin == buffer.end())
return selection;
Utf8Iterator end = begin;
- skip_while(end, buffer.end(), is_blank);
+ skip_while(end, buffer.end(), is_horizontal_blank);
if (word_type == Word and is_punctuation(*end))
skip_while(end, buffer.end(), is_punctuation);
@@ -97,7 +97,7 @@ Selection select_to_previous_word(const Buffer& buffer, const Selection& selecti
skip_while_reverse(begin, buffer.begin(), is_eol);
Utf8Iterator end = begin;
- skip_while_reverse(end, buffer.begin(), is_blank);
+ skip_while_reverse(end, buffer.begin(), is_horizontal_blank);
bool with_end = false;
if (word_type == Word and is_punctuation(*end))
@@ -153,7 +153,7 @@ Selection select_word(const Buffer& buffer,
{
skip_while(last, buffer.end(), is_word<word_type>);
if (not (flags & ObjectFlags::Inner))
- skip_while(last, buffer.end(), is_blank);
+ skip_while(last, buffer.end(), is_horizontal_blank);
--last;
}
}
@@ -161,7 +161,7 @@ Selection select_word(const Buffer& buffer,
{
if (flags & ObjectFlags::ToBegin)
{
- skip_while_reverse(first, buffer.begin(), is_blank);
+ skip_while_reverse(first, buffer.begin(), is_horizontal_blank);
if (not is_word<word_type>(*first))
return selection;
skip_while_reverse(first, buffer.begin(), is_word<word_type>);
@@ -170,7 +170,7 @@ Selection select_word(const Buffer& buffer,
}
if (flags & ObjectFlags::ToEnd)
{
- skip_while(last, buffer.end(), is_blank);
+ skip_while(last, buffer.end(), is_horizontal_blank);
--last;
}
}
diff --git a/src/unicode.hh b/src/unicode.hh
index 9485a27d..25408351 100644
--- a/src/unicode.hh
+++ b/src/unicode.hh
@@ -15,11 +15,6 @@ inline bool is_eol(Codepoint c)
return c == '\n';
}
-inline bool is_blank(Codepoint c)
-{
- return c == ' ' or c == '\t';
-}
-
inline bool is_horizontal_blank(Codepoint c)
{
return c == ' ' or c == '\t';
@@ -36,12 +31,12 @@ inline bool is_word(Codepoint c)
template<>
inline bool is_word<WORD>(Codepoint c)
{
- return not is_blank(c) and not is_eol(c);
+ return not is_horizontal_blank(c) and not is_eol(c);
}
inline bool is_punctuation(Codepoint c)
{
- return not (is_word(c) or is_blank(c) or is_eol(c));
+ return not (is_word(c) or is_horizontal_blank(c) or is_eol(c));
}
enum class CharCategories
@@ -59,7 +54,7 @@ inline CharCategories categorize(Codepoint c)
return CharCategories::Word;
if (is_eol(c))
return CharCategories::EndOfLine;
- if (is_blank(c))
+ if (is_horizontal_blank(c))
return CharCategories::Blank;
return word_type == WORD ? CharCategories::Word
: CharCategories::Punctuation;