summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index c9293a98..c41d7e8a 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -452,7 +452,7 @@ ByteCoord Buffer::char_next(ByteCoord coord) const
if (coord.column < m_lines[coord.line].length() - 1)
{
auto& line = m_lines[coord.line];
- coord.column += utf8::codepoint_size(line.begin() + (int)coord.column);
+ coord.column += utf8::codepoint_size(line[(int)coord.column]);
// Handle invalid utf-8
if (coord.column >= line.length())
{
@@ -483,7 +483,7 @@ ByteCoord Buffer::char_prev(ByteCoord coord) const
else
{
auto& line = m_lines[coord.line];
- coord.column = (int)(utf8::character_start(line.begin() + (int)coord.column - 1) - line.begin());
+ coord.column = (int)(utf8::character_start(line.begin() + (int)coord.column - 1, line.begin()) - line.begin());
}
return coord;
}