mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-11-21 15:44:44 +00:00
Fix out of bounds accesses with partially scrolled off multiline chars
Scrolling down (CSI T) could cut off the lower rows of a scale > 1 text sizing character at the bottom of the screen. Adding a combining char to it then wrote past the end of the line buffer in add_combining_char and rewrapping on resize read past the end of the line buffer in copy_multiline_extra_lines. Multiline chars that are cut off at the edge of the screen or of the history buffer, by scrolling or by inserting lines, are partially scrolled off and are rendered as such, so they are kept. Code walking the rows of a multiline char now only visits the adjacent rows that actually continue the char, rather than trusting the y and scale of a cell, so it stays in bounds and does not modify unrelated cells for partial or torn chars. Chars that would be torn, i.e. left with rows from unrelated lines adjacent to their remaining part, are removed. This happens when scrolling with margins, when a partial char is moved away from the edge of the screen by scrolling or deleting lines, when inserting lines pushes the lower rows of a char straddling the bottom margin out of the scroll region, and when a partial char cut off at the bottom is no longer at the bottom after a resize. Rewrap drops partial chars, as it already did for chars with missing top rows, placing cursors that were on them where the char would have been. The checks for torn chars are skipped unless a multiline char has been drawn in the screen, and chars cut off at the bottom of the screen, which can only be created by scrolling down or inserting lines, are tracked so that linefeeds do not need to scan for them. A hard reset now clears the alternate screen as well, so that the flag tracking whether multiline chars have been used can be reset. Also fix the lower rows of multiline chars being lost on rewrap when the lines after the char were continuations that fit on its first row.
This commit is contained in:
parent
fdea442b70
commit
cfd2b23dca
9 changed files with 463 additions and 70 deletions
|
|
@ -143,6 +143,16 @@ Detailed list of changes
|
|||
no longer opens saved sessions in the wrong OS Window or tab and no longer
|
||||
overwrites the session file with an empty one (:pull:`10851`, :pull:`10852`)
|
||||
|
||||
- Fix out of bounds memory accesses when a multi-line :doc:`text sizing
|
||||
<text-sizing-protocol>` character is partially scrolled off the screen and a
|
||||
combining char is then added to it or the window is resized
|
||||
|
||||
- A hard reset (:code:`RIS`) now clears the alternate screen as well
|
||||
|
||||
- Fix the lower rows of a multi-line :doc:`text sizing <text-sizing-protocol>`
|
||||
character being lost when resizing if the text after it is wrapped onto its
|
||||
first row
|
||||
|
||||
- Fix the scrolled back view jumping, and images, the cursor and the scrollbar
|
||||
getting out of sync with the text, when new output arrives
|
||||
(:pull:`10841`, :pull:`10847`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue