From 1c63d28f15012d6ba09580013071afbf21e1f0ec Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 7 Feb 2017 23:13:14 +0000 Subject: [PATCH] Fix Buffer::offset_coord that was dropping the target coordinate --- src/buffer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index 1fa837cc..e02720ca 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -187,8 +187,8 @@ BufferCoordAndTarget Buffer::offset_coord(BufferCoordAndTarget coord, LineCount auto line = Kakoune::clamp(coord.line + offset, 0_line, line_count()-1); StringView content = m_lines[line]; - column = std::max(0_col, std::min(column, content.column_length() - 2)); - return {line, content.byte_count_to(column), column}; + auto final_column = std::max(0_col, std::min(column, content.column_length() - 2)); + return {line, content.byte_count_to(final_column), column}; } String Buffer::string(BufferCoord begin, BufferCoord end) const