nushell / reedline

A feature-rich line editor - powering Nushell
https://docs.rs/reedline/
MIT License
554 stars 157 forks source link

When prompt starting row is 0, new prompt is rendered on each key type #756

Open kit494way opened 9 months ago

kit494way commented 9 months ago

Platform Windows 11 WSL2 Ubuntu 20.04, Terminal software wsltty 3.5.1

Describe the problem you are observing.

Steps to reproduce

  1. Execute clear to make prompt starting row 0.
  2. Type anything
  3. Scroll terminal.

Screenshots/Screencaptures

screenshot

fdncred commented 9 months ago

My guess is that this was related to redrawing the prompt with every keystroke, which reedline also probably shouldn't be doing.

On Wezterm on Windows I don't think it matters, it always repeats the prompt with every keystroke.

sholderbach commented 9 months ago

This appears to be a separate pathology. Yes we blindly redraw but @kit494way diagnosed that with everything on line 0 instead of overdrawing the previous content it moves the "paper" ahead. This would likely be something in the logic that initializes the prompt position.

sholderbach commented 9 months ago

This appears to also require that the prompt spans multiple lines for the problem to arise:

Here manually scrolling up after Ctrl-L with my single line prompt

grafik

kit494way commented 9 months ago

This problem appears to arise with specific terminal applications. I can not reproduce with Windows Terminal. With wsltty, I can reproduce the problem even when the prompt spans multiple lines.

fdncred commented 9 months ago

That's why I think this is similar to WezTerm on Windows. It's something to do with the pty iirc but I think the main culprit is nushell drawing the prompt on ever character. There may be more information on issues here with WezTerm in the body.

I can't even get wsltty to work right now. With WSL/g these work fine. So, I think it's the windows side like I mentioned above. kgx works alacritty works wezterm works