diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2012-10-11 00:41:48 +0200 |
| commit | 0ce6bd9bf54332d9eed8c7462ab4dfe08f8fac95 (patch) | |
| tree | 662591856f7227e3fb8592d582edaf2766a3f3e6 /src/editor.cc | |
| parent | 571861bc7bbe10bf831b861f7e6e0a2aa0a40839 (diff) | |
use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
Diffstat (limited to 'src/editor.cc')
| -rw-r--r-- | src/editor.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/editor.cc b/src/editor.cc index ff77e357..1a4cfdb7 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -129,9 +129,9 @@ void Editor::move_selections(CharCount offset, SelectMode mode) for (auto& sel : m_selections) { auto last = sel.last(); - last = clamp(utf8::advance(last, offset), - buffer().iterator_at_line_begin(last), - utf8::previous(buffer().iterator_at_line_end(last))); + auto limit = offset < 0 ? buffer().iterator_at_line_begin(last) + : utf8::previous(buffer().iterator_at_line_end(last)); + last = utf8::advance(last, limit, offset); sel.selection = Selection(mode == SelectMode::Extend ? sel.first() : last, last); } merge_overlapping(m_selections); |
