mirror of
https://github.com/nushell/nushell
synced 2024-12-25 12:33:17 +00:00
Fix default prompt indicators (#9914)
related to - https://github.com/nushell/nushell/pull/9907 # Description https://github.com/nushell/nushell/pull/9907 removed the front space from all `PROMPT_INDICATOR`s but this is not what the default behaviour of Nushell is, i.e. in `nu --no-config-file`. this PR - removes the space that is prepended by Nushell before the prompt indicator to match the `default_env.nu` - swaps INSERT and NORMAL in the Rust code to match the `:` and `>` respectively in `default_env.nu` ## 🔍 try the changes > **Warning** > i had to comment out in my config all the `$env.PROMPT_INDICATOR... = ...` to avoid these variables to propagate to `cargo run -- -n` in either `cargo run -- -n` or `cargo run -- --config crates/nu-utils/src/sample_config/default_config.nu --env-config crates/nu-utils/src/sample_config/default_env.nu`, - see `/path/to/nushell>` as the prompt with the default `emacs` edit mode - run `$env.config.edit_mode = vi` - see `/path/to/nushell:` as the INSERT prompt in Vi mode - press Escape to go into NORMAL mode - see `/path/to/nushell>` as the NORMAL prompt in Vi mode - press I to go back into INSERT mode - see `/path/to/nushell:` as the INSERT prompt in Vi mode # User-Facing Changes the prompts in `nu --no-config-file` and `nu --config default_config.nu --env-config default_env.nu` should be the same 😌 # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` # After Submitting
This commit is contained in:
parent
a98b3124c5
commit
9d7a1097f2
1 changed files with 3 additions and 4 deletions
|
@ -109,8 +109,7 @@ impl Prompt for NushellPrompt {
|
|||
let prompt = default
|
||||
.render_prompt_left()
|
||||
.to_string()
|
||||
.replace('\n', "\r\n")
|
||||
+ " ";
|
||||
.replace('\n', "\r\n");
|
||||
|
||||
prompt.into()
|
||||
}
|
||||
|
@ -144,11 +143,11 @@ impl Prompt for NushellPrompt {
|
|||
PromptEditMode::Vi(vi_mode) => match vi_mode {
|
||||
PromptViMode::Normal => match &self.default_vi_normal_prompt_indicator {
|
||||
Some(indicator) => indicator,
|
||||
None => ": ",
|
||||
None => "> ",
|
||||
},
|
||||
PromptViMode::Insert => match &self.default_vi_insert_prompt_indicator {
|
||||
Some(indicator) => indicator,
|
||||
None => "> ",
|
||||
None => ": ",
|
||||
},
|
||||
}
|
||||
.into(),
|
||||
|
|
Loading…
Reference in a new issue