From 2a60af25dc9d065434875d38377305f6136bd95e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 24 Feb 2018 21:32:11 +1100 Subject: [PATCH] Allow l/h to cross line boundaries l and h are now respectively "next character" and "previous character" --- src/buffer.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index 2de29b973..d065e02e4 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -194,9 +194,7 @@ BufferCoord Buffer::clamp(BufferCoord coord) const BufferCoord Buffer::offset_coord(BufferCoord coord, CharCount offset, ColumnCount, bool) { - StringView line = m_lines[coord.line]; - auto target = utf8::advance(&line[coord.column], offset < 0 ? line.begin() : line.end()-1, offset); - return {coord.line, (int)(target - line.begin())}; + return utf8::advance(iterator_at(coord), offset < 0 ? begin() : end()-1, offset).coord(); } BufferCoordAndTarget Buffer::offset_coord(BufferCoordAndTarget coord, LineCount offset, ColumnCount tabstop, bool avoid_eol)