summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-14 19:21:19 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-14 19:49:03 +0100
commitdb423e4a88be8799ce0cfae33ddbf4c6bae97e5f (patch)
tree2cb1a4eb27117889ed1d991b3949d5792ee19dcc /src
parentfbf7856e3ec40d58444d88fc9852db8e38cb68e7 (diff)
utf8::is_character_start takes directly the char value
Diffstat (limited to 'src')
-rw-r--r--src/selection.cc4
-rw-r--r--src/utf8.hh7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/selection.cc b/src/selection.cc
index 3dee22ec..0d90cc35 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -162,8 +162,8 @@ void SelectionList::check_invariant() const
kak_assert(buffer.is_valid(sel.cursor()));
kak_assert(not buffer.is_end(sel.anchor()));
kak_assert(not buffer.is_end(sel.cursor()));
- kak_assert(utf8::is_character_start(buffer.iterator_at(sel.anchor())));
- kak_assert(utf8::is_character_start(buffer.iterator_at(sel.cursor())));
+ kak_assert(utf8::is_character_start(buffer.byte_at(sel.anchor())));
+ kak_assert(utf8::is_character_start(buffer.byte_at(sel.cursor())));
}
#endif
}
diff --git a/src/utf8.hh b/src/utf8.hh
index 865d8705..5aac8c2a 100644
--- a/src/utf8.hh
+++ b/src/utf8.hh
@@ -76,17 +76,16 @@ CharCount distance(Iterator begin, Iterator end)
// return true if it points to the first byte of a (either single or
// multibyte) character
-template<typename Iterator>
-bool is_character_start(Iterator it)
+inline bool is_character_start(char c)
{
- return (*it & 0xC0) != 0x80;
+ return (c & 0xC0) != 0x80;
}
// returns an iterator to the first byte of the character it is into
template<typename Iterator>
Iterator character_start(Iterator it)
{
- while (not is_character_start(it))
+ while (not is_character_start(*it))
--it;
return it;
}