diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2015-09-23 19:39:21 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2015-09-23 19:39:21 +0100 |
| commit | 27571a77165f5cba2f7d0a7e335a4241dda91df7 (patch) | |
| tree | f9c565b35717170bed6d09c22c419b63939ac64a /src/normal.cc | |
| parent | b5972cd6475e354c4432f2adf94fff73807daad3 (diff) | |
Refactor utf8::iterator to be on the safe side
utf8::iterator now knows the iterator valid range, and pass
it to utf8 functions.
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/normal.cc b/src/normal.cc index 539bf76f..e0648abd 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -637,10 +637,13 @@ void use_selection_as_search_pattern(Context& context, NormalParams) Vector<String> patterns; auto& sels = context.selections(); const auto& buffer = context.buffer(); + using Utf8It = utf8::iterator<BufferIterator, utf8::InvalidPolicy::Pass>; for (auto& sel : sels) { - auto begin = utf8::make_iterator(buffer.iterator_at(sel.min())); - auto end = utf8::make_iterator(buffer.iterator_at(sel.max()))+1; + Utf8It begin{buffer.iterator_at(sel.min()), buffer}; + Utf8It end{buffer.iterator_at(sel.max()), buffer}; + ++end; + auto content = "\\Q" + buffer.string(begin.base().coord(), end.base().coord()) + "\\E"; if (smart) { |
