nushell / nushell

A new type of shell
https://www.nushell.sh/
MIT License
31.65k stars 1.62k forks source link

Prompt rendering 2 times if prompt contains newline, when first starting nushell and pressing a key #11623

Open maxomatic458 opened 7 months ago

maxomatic458 commented 7 months ago

Describe the bug

i noticed this when using the starship prompt with nushell that has a similar config to this:

$env.PROMPT_INDICATOR = ""
$env.PROMPT_COMMAND = {|| ( echo "test\n>" )}

(the rest of my config is pretty much default)

now, when i open nushell and i press any key, the prompt will be rendered again

a very weird thing i noticed with windows terminal is that i can create a new tab, and then this will not happen (see clip).

How to reproduce

  1. use the values above in config.nu
  2. open nushell and type something
  3. the prompt should be rendered 2 times

Expected behavior

the prompt should not be redrawn

Screenshots

https://github.com/nushell/nushell/assets/104733404/1dc2f73d-2986-4db4-b87d-7a166e95764a

Configuration

key value
version 0.89.1
branch main
commit_hash 9ee8d746588d848d841ed4e0dbcce8b8874a01d5
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.73.0 (cc66ad468 2023-10-03)
rust_channel 1.73.0-x86_64-pc-windows-msvc
cargo_version cargo 1.73.0 (9c4383fb5 2023-08-26)
build_time 2024-01-21 14:03:27 +01:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

fdncred commented 7 months ago

it would be great to fix this double render.

sstubbs commented 2 weeks ago

I have the same issue.