summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-02-06 22:04:42 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-02-06 22:04:42 +0000
commitbf088a864c07e57f2281966337ecf9dcc5a0b9c0 (patch)
treed7700be04be0220d5095b80e81a0b15ebc2f2c98
parenteb5f45813878288e802e514f15748592ca197336 (diff)
Avoid selecting buffer end when copying selection to next line
-rw-r--r--src/normal.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/normal.cc b/src/normal.cc
index f2315eca..611698e7 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);
}
}