nushell / reedline

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

Prompt jumps to end of screen #665

Open ClementNerma opened 10 months ago

ClementNerma commented 10 months ago

Environment: Windows 11 -> Windows Terminal

When inputting anything in the prompt on Windows Terminal, the prompt jumps to the last line immediatly. It also happens when just using a directional arrow key or backspace (so even when no character is added / removed and no cursor move is performed).

This happens even by just making a simple Rust program made of read_line(&DefaultPrompt::default() without anything else.

Initial state:

image

After pressing a key:

image

EDIT: This does not happen if a line was already printed in the terminal. So launching PowerShell for instance then reading a line won't produce this jump.

101313 commented 9 months ago

Can confirm this as well on a linux environment under wayland compositor and foot terminal emulator. Hacking it with an empty print at the end of my config seemingly does the trick for now

sholderbach commented 9 months ago

Interesting observation that a print in the config can preempt this. Maybe this affects the reported cursor position or causes a flush. A lead worth investigating.

tryoxiss commented 4 months ago

This happens for me toowhen my terminal is taller than 24 characters.

Fedora 38 on Gnome 44.10 using GNOME Terminal (NOT GNOME console)

sholderbach commented 4 months ago

24 is a good hint! Thanks for that. If we don't get a size reported from the terminal on startup we initialize to the prototypical 80x24 size to avoid overflows with 0x0 size.