summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-02-24 21:32:11 +1100
committerMaxime Coste <mawww@kakoune.org>2018-02-24 23:16:39 +1100
commit2a60af25dc9d065434875d38377305f6136bd95e (patch)
tree45a1385a46050c208b4386c604d22a1586c03eff /src
parent6a6e71dc0f86214eb63dfbc605f648b261137f56 (diff)
Allow l/h to cross line boundaries
l and h are now respectively "next character" and "previous character"
Diffstat (limited to 'src')
-rw-r--r--src/buffer.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index 2de29b97..d065e02e 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)