Skip to content

fix: re-use prompt rows after a quiet buffer editor#1107

Open
reubeno wants to merge 1 commit into
nushell:mainfrom
reubeno:editor-prompt-fix
Open

fix: re-use prompt rows after a quiet buffer editor#1107
reubeno wants to merge 1 commit into
nushell:mainfrom
reubeno:editor-prompt-fix

Conversation

@reubeno

@reubeno reubeno commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The buffer-editor success path re-initialized the prompt position from scratch; with the cursor still sitting after the old buffer text, select_prompt_row would start a new prompt one row down, leaving the original input line above.

This change captures the painter's state before spawning the editor and restore with it; if the editor wrote nothing to the tty (or did so on the alternate screen only) this allows reusing the original prompt row. An editor that printed output should get a fresh row.

Closes #1106

The buffer-editor success path re-initialized the prompt position from
scratch; with the cursor still sitting after the old buffer text
(column > 0), select_prompt_row would start a new prompt one row down,
leaving a stale duplicate prompt row above.

Capture the painter's suspended state before spawning the editor and
re-initialize with it: an editor that wrote nothing to the tty leaves
the cursor inside the previous prompt rows and re-uses them (in-place
repaint, as before this branch); an editor that printed output moves
the cursor out of range and gets a fresh prompt below that output.

Found by the PTY e2e suite: editor_replaces_buffer regressed on this
branch while editor_that_prints_to_tty_does_not_corrupt_repaint
regressed on main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@reubeno reubeno marked this pull request as ready for review June 16, 2026 12:09
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.

Prompt-after-editor behavior changed due to cursor::position optimization

1 participant