From 727580a238c12c2729dab1d8d75554cc12bba243 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 27 Mar 2015 13:18:52 +0000 Subject: [PATCH] Make utf8_iterator a proper stl useable iterator --- src/keys.cc | 3 +-- src/normal.cc | 3 +-- src/utf8_iterator.hh | 5 ++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/keys.cc b/src/keys.cc index 7dd45383..e4fb52f3 100644 --- a/src/keys.cc +++ b/src/keys.cc @@ -53,8 +53,7 @@ KeyList parse_keys(StringView str) continue; } - Utf8It end_it = it; - skip_while(end_it, str_end, [](char c) { return c != '>'; }); + Utf8It end_it = std::find(it, str_end, '>'); if (end_it == str_end) { result.push_back({Key::Modifiers::None, *it}); diff --git a/src/normal.cc b/src/normal.cc index 89195b08..fdec4258 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -727,8 +727,7 @@ void join_lines_select_spaces(Context& context, NormalParams) for (LineCount line = min_line; line < end_line; ++line) { auto begin = buffer.iterator_at({line, buffer[line].length()-1}); - auto end = begin+1; - skip_while(end, buffer.end(), is_horizontal_blank); + auto end = std::find_if_not(begin+1, buffer.end(), is_horizontal_blank); selections.push_back({begin.coord(), (end-1).coord()}); } } diff --git a/src/utf8_iterator.hh b/src/utf8_iterator.hh index 1637fe2d..1e359f17 100644 --- a/src/utf8_iterator.hh +++ b/src/utf8_iterator.hh @@ -3,6 +3,8 @@ #include "utf8.hh" +#include + namespace Kakoune { @@ -13,7 +15,8 @@ namespace utf8 // on unicode codepoints instead. template -class iterator +class iterator : public std::iterator { public: iterator() = default;