Repository navigation
Conversation
Fixes HalFrgrd#1068 The resize handler erased its inline viewport with DeleteLine. foot implements DL as a rotation of its grid ring buffer: the screen looks unchanged, but the terminal's viewport offset moves, and the next reflow then leaves the cursor rows below the reflowed prompt. Cursor::Up is computed from our own drawn buffer, so it lands on the wrong row and the old prompt is never erased - every resize leaves another copy on screen and draws a fresh one below it. Only multiplexers need the DL: they keep their own "line is wrapped" bookkeeping across redraws (zellij combines lines on widen, see HalFrgrd#909) and handle the delete in their grid. On a direct terminal terminal.clear()'s ED already blanks the block, so skip the scroll there. tests/resize_no_delete_line.py drives flyline in a PTY and checks that a direct terminal gets no CSI M on resize while a ZELLIJ session still does.
lenitain
force-pushed
the
fix/resize-prompt-leak
branch
from
November 17, 2026 05:09
7495943 to
9e13d59
Compare
Wire tests/resize_no_delete_line.py into the Bash integration Dockerfile and wait for the post-resize CPR query before checking the escape stream. This prevents the direct-terminal branch from passing when no resize was handled, and filters terminal and multiplexer environment variables so the test observes the intended foot and zellij paths. Also tighten the resize comment in src/app/mod.rs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1068.
Problem
Resizing the terminal while the prompt is on screen leaves the old prompt behind and draws a new one below it, so repeated resizes (toggling a column width with
mod+f/mod+ain niri, or just dragging the window edge) fill the screen with stacked prompts. Reproducible in foot with a 4-character prompt (/tmp), so it is not about prompt wrapping.Root cause
On
TerminaEvent::WindowResizedthe handler erases the inline viewport withCursor::Up(rows_up)+Edit::DeleteLine(rows_up + 1)+terminal.clear(), then redraws.rows_upis computed from the rows Flyline itself drew.foot implements
DLas a scroll of the cursor-to-bottom region (csi.c,case 'M'->term_scroll_partial()), which advances the grid ring buffer's offset (grid->offset += rows,terminal.c) while the visible screen stays unchanged. The next reflow (grid_resize_and_reflow(),grid.c) converts the cursor to an absolute row (cursor.row += grid->offset), reflows, then re-anchors the grid to the reflowed rows. The cursor's screen row becomesold_screen_row + old_offset - new_offset; in the observed casenew_offsetis 0, so it ends upold_offsetrows below the prompt.Cursor::Up(rows_up)then starts from that shifted cursor, so the erase targets the rows below the old prompt: the old block survives, a new one is drawn below it, and the next resize repeats the cycle.Captured stream for one resize with a 2-row prompt.
Fix
DeleteLineis only needed to reset a multiplexer's "line is wrapped" bookkeeping (zellij combines lines on widen, #909), and multiplexers handle the delete in their own grid. On a direct terminalterminal.clear()already sendsED(0)from the same position, which blanks the block. So only sendDLwhenterm_info::multiplexer()isSome(_).Why this isn't foot-specific
The failure requires the combination of three properties:
DLadvances a global grid offset, reflow uses that offset to convert the cursor, and the deleted rows remain in the buffer and can be reflowed back. Foot has all three. Alacritty'sDLalso scrolls the region (rows can go into history), but its reflow tracks an explicit cursor line and keeps the viewport pinned to the bottom, so the cursor stays aligned with the prompt and the old rows are not pulled back into view. Kitty and Ghostty actually move/clear the deleted rows and honor the OSC 133 prompt-redraw markers, so there is no stale block and no offset applied during reflow. They are not handlingDLdifferently on purpose; they simply never enter the state where a hidden offset is applied to the cursor during reflow. The fix does not detect foot: it removesDLfrom the direct-terminal path, so any terminal with that combination is covered, while the multiplexer path keeps the zellij workaround.Testing
tests/resize_no_delete_line.py: drives Flyline in a PTY, resizes, and asserts that a direct terminal gets noCSI Mwhile aZELLIJsession still does. It waits for the post-resize CPR query, so it cannot pass without exercising the resize path. The test is wired intodocker/bash_integration_test.Dockerfileand runs on every Bash version in CI. It fails on 1.10.0 and passes with the patch.cargo test --lib(908 passed),cargo fmt --all -- --check.Notes
needless_range_looplints in untouched files.