From db423e4a88be8799ce0cfae33ddbf4c6bae97e5f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 14 May 2014 19:21:19 +0100 Subject: [PATCH] utf8::is_character_start takes directly the char value --- src/selection.cc | 4 ++-- src/utf8.hh | 7 +++---- 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 -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 Iterator character_start(Iterator it) { - while (not is_character_start(it)) + while (not is_character_start(*it)) --it; return it; }