From bf088a864c07e57f2281966337ecf9dcc5a0b9c0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 6 Feb 2015 22:04:42 +0000 Subject: [PATCH] Avoid selecting buffer end when copying selection to next line --- src/normal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/normal.cc b/src/normal.cc index f2315eca9..611698e78 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -987,7 +987,8 @@ void copy_selections_on_next_lines(Context& context, NormalParams params) LineCount offset = (direction == Forward ? 1 : -1) * (i + 1); ByteCoord new_anchor{anchor.line + offset, anchor.column}; ByteCoordAndTarget new_cursor{cursor.line + offset, cursor.column, cursor.target}; - if (buffer.is_valid(new_anchor) and buffer.is_valid(new_cursor)) + if (buffer.is_valid(new_anchor) and not buffer.is_end(new_anchor) and + buffer.is_valid(new_cursor) and not buffer.is_end(new_cursor)) result.emplace_back(new_anchor, new_cursor); } }