Make utf8_iterator a proper stl useable iterator
This commit is contained in:
parent
c2150dd163
commit
727580a238
|
@ -53,8 +53,7 @@ KeyList parse_keys(StringView str)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utf8It end_it = it;
|
Utf8It end_it = std::find(it, str_end, '>');
|
||||||
skip_while(end_it, str_end, [](char c) { return c != '>'; });
|
|
||||||
if (end_it == str_end)
|
if (end_it == str_end)
|
||||||
{
|
{
|
||||||
result.push_back({Key::Modifiers::None, *it});
|
result.push_back({Key::Modifiers::None, *it});
|
||||||
|
|
|
@ -727,8 +727,7 @@ void join_lines_select_spaces(Context& context, NormalParams)
|
||||||
for (LineCount line = min_line; line < end_line; ++line)
|
for (LineCount line = min_line; line < end_line; ++line)
|
||||||
{
|
{
|
||||||
auto begin = buffer.iterator_at({line, buffer[line].length()-1});
|
auto begin = buffer.iterator_at({line, buffer[line].length()-1});
|
||||||
auto end = begin+1;
|
auto end = std::find_if_not(begin+1, buffer.end(), is_horizontal_blank);
|
||||||
skip_while(end, buffer.end(), is_horizontal_blank);
|
|
||||||
selections.push_back({begin.coord(), (end-1).coord()});
|
selections.push_back({begin.coord(), (end-1).coord()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "utf8.hh"
|
#include "utf8.hh"
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -13,7 +15,8 @@ namespace utf8
|
||||||
// on unicode codepoints instead.
|
// on unicode codepoints instead.
|
||||||
template<typename Iterator,
|
template<typename Iterator,
|
||||||
typename InvalidPolicy = utf8::InvalidPolicy::Pass>
|
typename InvalidPolicy = utf8::InvalidPolicy::Pass>
|
||||||
class iterator
|
class iterator : public std::iterator<std::forward_iterator_tag,
|
||||||
|
Codepoint, CharCount>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
iterator() = default;
|
iterator() = default;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user