Do not select empty lines at end of grid, fixes #92

This commit is contained in:
Jeremy Soller 2024-02-22 12:01:50 -07:00
parent d9512cd0a4
commit 1b0d018e43
No known key found for this signature in database
GPG key ID: D02FD439211AF56F

View file

@ -505,8 +505,15 @@ impl Terminal {
let mut term = self.term.lock();
let grid = term.grid();
let start = Point::new(Line(-(grid.history_size() as i32)), Column(0));
let mut end_line = grid.bottommost_line();
while end_line.0 > 0 {
if ! grid[end_line].is_clear() {
break;
}
end_line.0 -= 1;
}
let end = Point::new(
Line(grid.screen_lines() as i32 - 1),
end_line,
Column(grid.columns() - 1),
);
let mut selection = Selection::new(SelectionType::Lines, start, Side::Left);