Removing or hiding the `PROMPT_COMMAND_RIGHT` and `PROMPT_MULTILINE_INDICATOR` should remove the prompt and indicator
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
I thought about filing this a long time ago, but I'm finally getting around to it because its behavior is a contributing factor to the issue I'm going to open right after this one.
I'm aware that this behavior is (a) probably more of a change for Reedline, but the configuration for these items does (and should) take place in Nu itself. Also (b) this may be "as designed", in which case feel free to convert it to a feature request or close it.
Hiding or removing $env.PROMPT_COMMAND_RIGHT and $env.PROMPT_MULTILINE_INDICATOR should be sufficient for removing those elements, but it isn't, since they are both configured via environment variables and hard-coded into (I believe) Reedline.
In general, I believe that configuration variables that are not crucial to smooth operation of the shell should not have hard-coded defaults, so that they can be more easily removed. As an example of an item that is crucial to the smooth operation of the shell, the left-counterepart, $env.PROMPT_COMMAND might fit. But at least the $ENV.PROMPT_INDICATOR needs a hard-coded default, as found in every shell.
How to reproduce
config env
Comment out or delete $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } and $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } and restart the shell.
Result: That pesky right prompt and multi-line indicator are still there ;-)
I say that a bit tongue-in-cheek, but the right-prompt and multiline indicator are common pitfalls for me when copying multi-line input or output from the terminal.
I'm fine with the design choice to have them, but since they are defined by env.nu, it should be easier to get rid of them.
For a new user to remove them can be more than a bit frustrating. Let's walk through the process:
-
Best case, they are going to read the doc and figure out that they need to edit
env.nu, preferably usingconfig nu(and after setting theEDITORandVISUALthat's going to allow them to do that). No complaints there. -
Then they are going to see
def create_right_promptright at the top. Oh - That must be what I need to change! Maybe that would work, if the following line wasn't commented out in the current default configuration:# $env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }That's part of the issue I'll open next. ;-)
-
But then they need to get rid of multiline, so they'll need to head down a bit further and find:
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } # Assuming the related bug is fixed $env.PROMPT_MULTILINE_INDICATOR = {|| "::: " }Natural assumption is to simply remove or comment out these lines, but that won't work because the hardcoded Reedline version will then take over.
-
Eventually they have to figure out that these have to be overridden, not removed:
$env.PROMPT_COMMAND_RIGHT = "" $env.PROMPT_MULTILINE_INDICATOR = ""
Whew ;-)
Expected behavior
Remove the right prompt and multiline indicator when removing or hiding the corresponding environment variables.
Most importantly, this does not change any existing functionality in Nushell as long as the user chooses to populate env.nu with defaults when prompted. It's also:
- easier
- more intuitive
- more aligned with traditional shell behavior
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.83.1 |
| branch | |
| commit_hash | |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.71.0 (8ede3aae2 2023-07-12) |
| rust_channel | stable-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.71.0 (cfd3bbd8f 2023-06-08) |
| build_time | 2023-07-31 18:55:46 -04:00 |
| build_rust_channel | release |
| allocator | standard |
| features | dataframe, default, extra, sqlite, trash, which, 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
Start with the default environment configuration in env.nu and the Reedline prompt handling described in the report; reproduce the behavior with config env after removing the two variables. Trace where the hard-coded right prompt and multiline indicator are selected. Done means removing or hiding those variables removes both elements without changing populated defaults.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100