mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-14 05:33:59 -04:00
scrolling: fix crash when offset was exactly at the wrap-around
When making sure we don't scroll past the scrollback history, and the current offset was exactly at the wrap around, the new view port was set to offset+1, which in this particular case meant outside the valid row numbers.
This commit is contained in:
parent
8ad3b9c172
commit
483ea4ae73
2 changed files with 5 additions and 2 deletions
|
|
@ -26,6 +26,7 @@
|
||||||
* Number of lines to scroll is now always clamped to the number of
|
* Number of lines to scroll is now always clamped to the number of
|
||||||
lines in the scrolling region..
|
lines in the scrolling region..
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
@ -36,6 +37,8 @@
|
||||||
when the mouse button is released - not as soon as `shift` is
|
when the mouse button is released - not as soon as `shift` is
|
||||||
released.
|
released.
|
||||||
* Selected cells did not appear selected if modified.
|
* Selected cells did not appear selected if modified.
|
||||||
|
* Rare crash when scrolling and the new viewport ended up **exactly**
|
||||||
|
on the wrap around.
|
||||||
* Selection handling when viewport wrapped around.
|
* Selection handling when viewport wrapped around.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ cmd_scrollback_up(struct terminal *term, int rows)
|
||||||
if (end >= term->grid->offset) {
|
if (end >= term->grid->offset) {
|
||||||
/* Not wrapped */
|
/* Not wrapped */
|
||||||
if (new_view >= term->grid->offset && new_view <= end)
|
if (new_view >= term->grid->offset && new_view <= end)
|
||||||
new_view = end + 1;
|
new_view = (end + 1) % term->grid->num_rows;
|
||||||
} else {
|
} else {
|
||||||
if (new_view >= term->grid->offset || new_view <= end)
|
if (new_view >= term->grid->offset || new_view <= end)
|
||||||
new_view = end + 1;
|
new_view = (end + 1) % term->grid->num_rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (term->grid->rows[new_view] == NULL)
|
while (term->grid->rows[new_view] == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue