diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-07-16 06:47:37 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-07-16 06:47:37 +0000 |
| commit | 7f6ed98a8366d0c270aff592c6d5782f99385a6a (patch) | |
| tree | a9204426e3f5434834713771ce8c8e82c2f55ebb | |
| parent | sixel: verify list order: fix assertion when two sixels are on the same row (diff) | |
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.
| -rw-r--r-- | terminal.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -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; |
