1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 15:23:29 +03:00

Make utf8_iterator a proper stl useable iterator

This commit is contained in:
Maxime Coste 2015-03-27 13:18:52 +00:00
parent c2150dd163
commit 727580a238
3 changed files with 6 additions and 5 deletions

View File

@ -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});

View File

@ -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()});
}
}

View File

@ -3,6 +3,8 @@
#include "utf8.hh"
#include <iterator>
namespace Kakoune
{
@ -13,7 +15,8 @@ namespace utf8
// on unicode codepoints instead.
template<typename Iterator,
typename InvalidPolicy = utf8::InvalidPolicy::Pass>
class iterator
class iterator : public std::iterator<std::forward_iterator_tag,
Codepoint, CharCount>
{
public:
iterator() = default;