diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-07-28 09:41:47 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-07-28 09:41:47 +0100 |
| commit | a7005ec74be9eef4595031bfe9191cc8bd5a08e3 (patch) | |
| tree | 497e00c33a89230efce4cc14b02868be7fc2eab6 /src/window.cc | |
| parent | 74c3f101cd60e213962026f0bb0235102f7bc833 (diff) | |
Add a char_length(Buffer&, const ByteCoord&, const ByteCoord&) util
Diffstat (limited to 'src/window.cc')
| -rw-r--r-- | src/window.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/window.cc b/src/window.cc index efffe1e1..487cf927 100644 --- a/src/window.cc +++ b/src/window.cc @@ -200,9 +200,8 @@ static CharCount adapt_view_pos(const DisplayBuffer& display_buffer, CharCount o if (atom.type() == DisplayAtom::BufferRange) { auto& buf = atom.buffer(); - pos_beg = buffer_column - + utf8::distance(buf.iterator_at(atom.begin()), - buf.iterator_at(pos)); + pos_beg = buffer_column + + char_length(buf, atom.begin(), pos); pos_end = pos_beg+1; } else @@ -273,8 +272,7 @@ CharCount find_display_column(const DisplayLine& line, const Buffer& buffer, coord >= atom.begin() and coord < atom.end()) { if (atom.type() == DisplayAtom::BufferRange) - column += utf8::distance(buffer.iterator_at(atom.begin()), - buffer.iterator_at(coord)); + column += char_length(buffer, atom.begin(), coord); return column; } column += atom.length(); |
