forked from extern/nushell
Only run $env.PROMPT_COMMAND once per prompt (#10986)
# Description If `$env.TRANSIENT_PROMPT_COMMAND` is not set, use the prompt created by `$env.PROMPT_COMMAND` instead of running the command a second time. As a side effect, `$env.TRANSIENT_PROMPT_COMMAND` now runs after the hooks `pre_prompt` and `env_change`, instead of before. # User-Facing Changes - `$env.PROMPT_COMMAND` gets run only once per prompt instead of twice - `$env.TRANSIENT_PROMPT_COMMAND` now sees any environment set in a `pre_prompt` or `env_change` hook, like `$env.PROMPT_COMMAND` does
This commit is contained in:
committed by
GitHub
parent
84742275a1
commit
533c1a89af
@ -267,11 +267,7 @@ pub fn evaluate_repl(
|
||||
.with_quick_completions(config.quick_completions)
|
||||
.with_partial_completions(config.partial_completions)
|
||||
.with_ansi_colors(config.use_ansi_coloring)
|
||||
.with_cursor_config(cursor_config)
|
||||
.with_transient_prompt(prompt_update::transient_prompt(
|
||||
engine_reference.clone(),
|
||||
stack,
|
||||
));
|
||||
.with_cursor_config(cursor_config);
|
||||
perf(
|
||||
"reedline builder",
|
||||
start_time,
|
||||
@ -423,8 +419,11 @@ pub fn evaluate_repl(
|
||||
);
|
||||
|
||||
start_time = std::time::Instant::now();
|
||||
// Now we compute the prompt after running the hooks
|
||||
let config = &engine_state.get_config().clone();
|
||||
let prompt = prompt_update::update_prompt(config, engine_state, stack, &mut nu_prompt);
|
||||
prompt_update::update_prompt(config, engine_state, stack, &mut nu_prompt);
|
||||
let transient_prompt =
|
||||
prompt_update::make_transient_prompt(config, engine_state, stack, &nu_prompt);
|
||||
perf(
|
||||
"update_prompt",
|
||||
start_time,
|
||||
@ -437,7 +436,8 @@ pub fn evaluate_repl(
|
||||
entry_num += 1;
|
||||
|
||||
start_time = std::time::Instant::now();
|
||||
let input = line_editor.read_line(prompt);
|
||||
line_editor = line_editor.with_transient_prompt(transient_prompt);
|
||||
let input = line_editor.read_line(&nu_prompt);
|
||||
let shell_integration = config.shell_integration;
|
||||
|
||||
match input {
|
||||
|
Reference in New Issue
Block a user