utf8::is_character_start takes directly the char value
This commit is contained in:
parent
fbf7856e3e
commit
db423e4a88
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user