Skip to content

fix(painter): don't re-use a bottom-flush prompt anchor after a scroll#1133

Draft
kronberger-droid wants to merge 2 commits into
nushell:mainfrom
kronberger-droid:fix/1130-prompt-position-after-external-menu
Draft

fix(painter): don't re-use a bottom-flush prompt anchor after a scroll#1133
kronberger-droid wants to merge 2 commits into
nushell:mainfrom
kronberger-droid:fix/1130-prompt-position-after-external-menu

Conversation

@kronberger-droid

@kronberger-droid kronberger-droid commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

When an external completer scrolls the terminal (fzf --height with little room below the prompt), the prompt landed in the wrong palce after the menu closed, since #1090 trusts a Verified anchor without re-querying and the completer path never marked it stale.

Two commits:

re-anchor the prompt to the cursor after an external scroll

don't re-use a bottom-flush prompt anchor after a scroll

  • A separate latent bug on the suspend/resume path (ExecuteHostCommand):
    select_prompt_row re-used a prompt range flush against the screen bottom and drew over scrolled-up output.
  • Not a regression (identical on 0.48)

@kronberger-droid

Copy link
Copy Markdown
Collaborator Author

@blindFS Can you check out if this fixes #1130

@blindFS

blindFS commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@kronberger-droid Thanks a lot for the quick fix, however it doesn't seem to fix my issue. I cherry-picked the change on an older pair of revs of nushell 8774a88a1 and reedline 0977032 (sadly current main branches cause me bigger troubles), and it acts exactly the same.

@blindFS

blindFS commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Here're the minimal reproducible steps according to my test, but you'll have to test them on older revs as well.

  1. $env.config.completions.external.completer = {|| fzf --no-tmux --height 40%; null}
  2. Make the room below current prompt row less than 40%
  3. Press git <tab><ESC>

@kronberger-droid

Copy link
Copy Markdown
Collaborator Author

thanks! I will check it out. This was just a guess since i could not fully understand what was happening in the video.

@kronberger-droid
kronberger-droid force-pushed the fix/1130-prompt-position-after-external-menu branch from 8e96204 to 6de2bfa Compare July 23, 2026 18:34
@kronberger-droid
kronberger-droid force-pushed the fix/1130-prompt-position-after-external-menu branch from 6de2bfa to eab2e25 Compare July 24, 2026 11:23
@kronberger-droid

Copy link
Copy Markdown
Collaborator Author

@blindFS
Now it should be fixed.
With a small perf regression since now if a menu is open we again have a cursor pos query every repaint.
But I will see if we could still reduce it.
Important now is that it fixes your issue.

@blindFS

blindFS commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@kronberger-droid Thanks again! It works much better now. Nitpick: it clears the terminal on menu exit, better to keep it on the same line. I think it worked that way before, but I'm not very sure.

@kronberger-droid

kronberger-droid commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

@blindFS
Right now it should either attach back to where it was or if the menu is to big and its shifted up, it should stay where it was shifted.
are you experiencing something else?
Or do you want it to land in the place it was before opening the menu in the second case?
First case should meet your expectations right?

@blindFS

blindFS commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@kronberger-droid

Screen.Recording.2026-07-24.at.8.17.58.PM.mov

Probably different to your description.

@kronberger-droid

kronberger-droid commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

@blindFS
Hmm weird, are you sure you have built it with the right rev of reedline?
This was the state for me like one iteration before and i did not like it so i changed it. but i tested using a reedline example not nushell. so i will test this in nu and see if it changes something.

@blindFS

blindFS commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@blindFS Hmm weird, are you sure you have built it with the right rev of reedline? This was the state for me like one iteration before and i did not like it so i changed it. but i tested using a reedline example not nushell. so i will test this in nu and see if it changes something.

Oops, my bad, I missed a crucial part of your change, it works perfectly now. Thanks a lot!

@kronberger-droid
kronberger-droid force-pushed the fix/1130-prompt-position-after-external-menu branch from eab2e25 to 956680b Compare July 25, 2026 10:35
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.

Wrong prompt positioning after fzf menus when there's little room left and content get moved upwards

2 participants