Avoid copying selection before the first line

This commit is contained in:
Maxime Coste 2015-07-22 23:24:20 +01:00
parent 733e004d44
commit 36ffff96be

View File

@ -994,7 +994,8 @@ void copy_selections_on_next_lines(Context& context, NormalParams params)
const LineCount anchor_line = anchor.line + offset;
const LineCount cursor_line = cursor.line + offset;
if (anchor_line >= buffer.line_count() or cursor_line >= buffer.line_count())
if (anchor_line < 0 or cursor_line < 0 or
anchor_line >= buffer.line_count() or cursor_line >= buffer.line_count())
continue;
ByteCount anchor_byte = get_byte_to_column(buffer, tabstop, {anchor_line, anchor_col});