mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
term: line-wrap: don't move cursor outside the grid
Remove assertion that row be less than the scrolling region end. The cursor may in fact be *inside* the margin. Inside the margin, content never scrolls, but we must make sure we don't move the cursor outside the grid.
This commit is contained in:
parent
674f0dd0fc
commit
7f6ed98a83
1 changed files with 7 additions and 4 deletions
11
terminal.c
11
terminal.c
|
|
@ -2355,12 +2355,15 @@ print_linewrap(struct terminal *term)
|
|||
}
|
||||
|
||||
term->grid->cursor.lcf = false;
|
||||
if (term->grid->cursor.point.row == term->scroll_region.end - 1)
|
||||
|
||||
const int row = term->grid->cursor.point.row;
|
||||
|
||||
if (row == term->scroll_region.end - 1)
|
||||
term_scroll(term, 1);
|
||||
else {
|
||||
assert(term->grid->cursor.point.row < term->scroll_region.end - 1);
|
||||
term->grid->cursor.point.row++;
|
||||
term->grid->cur_row = grid_row(term->grid, term->grid->cursor.point.row);
|
||||
const int new_row = min(row + 1, term->rows - 1);
|
||||
term->grid->cursor.point.row = new_row;
|
||||
term->grid->cur_row = grid_row(term->grid, new_row);
|
||||
}
|
||||
|
||||
term->grid->cursor.point.col = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue