nushell / nushell/nushell

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

Open
#11,623 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:line-editor category:bug polish status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the PROMPT_INDICATOR and PROMPT_COMMAND values in config.nu, then trace Nushell's startup and input handling around prompt rendering. Confirm the fix by opening Nushell, pressing a key, and verifying that the prompt is rendered only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.