GNOME Bugzilla – Bug 759146
Bad cursor position after escape sequence resize
Last modified: 2021-06-10 15:08:29 UTC
./src/vte-2.91 ./src/window 8 23 80 (or, equivalent) echo -ne '\e[8;23;80t' Notice that the cursor doesn't advance to the next line. (Requires that the window is actually resized, you don't "change" the size to the already existing one.) Only happens as long as you haven't reached the bottom of the screen. Doesn't happen with any of these: sleep 0.01; ./src/window 8 23 80 echo -n a; ./src/window 8 23 80 echo -ne 'a\e[8;23;80t' Broke somewhere in the 0.37 series.
If there's a pause then this happens: In vte_terminal_process_incoming(), processing the newline marks that the contents changed (sets "modified = TRUE"), and later the "if (modified)" branch does whatever it needs to do: calls _vte_terminal_update_insert_delta() which in turn calls vte_terminal_insert_rows() -> _vte_terminal_ring_append() -> _vte_terminal_ring_insert() -> _vte_ring_insert() -> this somehow adds another row to the ring. After the pause, vte_terminal_process_incoming() processes the escape sequence which properly resizes the window. Without the pause this happens: The resize escape sequence is processed right after processing the newline ("modified" is already set to TRUE) but _before_ the "if (modified)" branch is reached, hence before another row is added to the ring. vte_terminal_set_size() near its end CLAMPs terminal->pvt->cursor.row to be within the ring's area, which ring hasn't been extended yet. --- It's yet another of those cases where addressing bug 747175 would make our lives so much simpler... this bug couldn't have happened then. Possible quick hacks to fix it: revise the CLAMP, or on cursor down ensure that the row is in the ring. Or just wait until we get to address 747175.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vte/-/issues/2258.