Strange behavior with multi-line prompts
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
From a conversation in Discord:
Is this a bug, or me not understanding something about the way prompts work?
let-env PROMPT_INDICATOR = {|| "> " }is the default. But if I change it to:
let-env PROMPT_INDICATOR = {|| "\n> " }
I do get the newline, but the > disappears?
But if I prefix with a space like this, then I get both:
let-env PROMPT_INDICATOR = {|| " \n> " }
How to reproduce
let-env PROMPT_INDICATOR = {|| "\n> " }
Notice that you get a prompt w/ a newline, but no >.
Expected behavior
I expected to have a prompt of "> " on a line by itself. (I prefer my prompts always start at the same indentation, regardless of how deep I am into a random file path.)
Or, if there's some additional behavior going on for the various prompts (ex: if some trimming is going on, or multi-line prompts aren't supported), I'd expect to see that in docs. 😊
Screenshots
Configuration
| key | value |
|---|---|
| version | 0.78.0 |
| branch | |
| commit_hash | |
| build_os | macos-aarch64 |
| build_target | aarch64-apple-darwin |
| rust_version | rustc 1.68.2 (9eb3afe9e 2023-03-27) (built from a source tarball) |
| cargo_version | cargo 1.68.1 (6feb7c9cf 2023-03-26) |
| build_time | 2023-04-04 18:47:00 +00:00 |
| build_rust_channel | release |
| features | default, zip |
| installed_plugins |
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with PROMPT_INDICATOR set to a closure returning "\n> ", then compare it with the version prefixed by a space. Trace the Nushell prompt-rendering entry point and existing prompt tests, and consider the behavior complete when a multiline indicator preserves the requested > character or the supported trimming rules are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100