Avoid selecting buffer end when copying selection to next line
This commit is contained in:
parent
eb5f458138
commit
bf088a864c
|
@ -987,7 +987,8 @@ void copy_selections_on_next_lines(Context& context, NormalParams params)
|
||||||
LineCount offset = (direction == Forward ? 1 : -1) * (i + 1);
|
LineCount offset = (direction == Forward ? 1 : -1) * (i + 1);
|
||||||
ByteCoord new_anchor{anchor.line + offset, anchor.column};
|
ByteCoord new_anchor{anchor.line + offset, anchor.column};
|
||||||
ByteCoordAndTarget new_cursor{cursor.line + offset, cursor.column, cursor.target};
|
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);
|
result.emplace_back(new_anchor, new_cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user