Skip to content

Render long commands in full before execution - #1043

Open
itolkien wants to merge 1 commit into
HalFrgrd:masterfrom
itolkien:fix/submitted-command-scrollback
Open

itolkien wants to merge 1 commit into
HalFrgrd:masterfrom
itolkien:fix/submitted-command-scrollback

Conversation

@itolkien

Copy link
Copy Markdown

I ran into this when pasting a command longer than the terminal height. Bash received the whole command, but after pressing Enter I couldn't scroll back to its beginning. With 210 lines in an 80x24 terminal, the first 187 lines were missing.

The final redraw was using the same clipped row range as the editor. This writes the hidden prefix of the final content into scrollback, then lets the normal draw render the remaining rows. It uses the final prompt and current command text, including any edits.

The editing viewport and Ctrl+C/EOF behavior stay the same. This uses the existing inline backend APIs; the Ratatui fork and dependencies are unchanged.

Testing:

  • Workspace library tests pass, including five new prefix-writer tests. I also ran the normally ignored 50k history benchmark.
  • Added PTY regression tests for a 210-line command, editing its first line, a narrow terminal, and a short command. These check the final output and the exact command contents passed to Bash.
  • The existing Docker matrix passes on Bash 3.2.57, 4.4-rc1, 4.4.18, 5.0, and 5.3, with the new tests included.
  • I compared this build with Fish 4.9.3 on Arch Linux with Ghostty 1.3.1. All 210 lines appeared once after submission, both at a fixed size and after shrinking or regrowing the window. These checks used Flyline's default only-prompt-pos integration.
  • cargo fmt --all -- --check and clippy with -D warnings pass.

This doesn't expose the entire active edit buffer through native scrollback. Single-row viewport edge cases and old rows retained during resizing with shell integration disabled are outside this fix. Other GUI terminals haven't been checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant