mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Always check for fish_right_prompt's existence
This would only check for fish_right_prompt at startup, so if one wasn't defined then it would never accept one. The "config" here is just the *name* of the function (which we never change, so it wouldn't really be necessary, but whatever). The one exception is the breakpoint, in those we don't run the right prompt. Fixes #7302.
This commit is contained in:
parent
4d22ebf49c
commit
b521ca4875
@ -1205,12 +1205,14 @@ void reader_data_t::exec_prompt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!conf.right_prompt_cmd.empty()) {
|
if (!conf.right_prompt_cmd.empty()) {
|
||||||
// Status is ignored.
|
if (function_exists(conf.right_prompt_cmd, parser())) {
|
||||||
wcstring_list_t prompt_list;
|
// Status is ignored.
|
||||||
exec_subshell(conf.right_prompt_cmd, parser(), prompt_list, false);
|
wcstring_list_t prompt_list;
|
||||||
// Right prompt does not support multiple lines, so just concatenate all of them.
|
exec_subshell(conf.right_prompt_cmd, parser(), prompt_list, false);
|
||||||
for (const auto &i : prompt_list) {
|
// Right prompt does not support multiple lines, so just concatenate all of them.
|
||||||
right_prompt_buff += i;
|
for (const auto &i : prompt_list) {
|
||||||
|
right_prompt_buff += i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2510,15 +2512,12 @@ static int read_i(parser_t &parser) {
|
|||||||
|
|
||||||
if (parser.libdata().is_breakpoint && function_exists(DEBUG_PROMPT_FUNCTION_NAME, parser)) {
|
if (parser.libdata().is_breakpoint && function_exists(DEBUG_PROMPT_FUNCTION_NAME, parser)) {
|
||||||
conf.left_prompt_cmd = DEBUG_PROMPT_FUNCTION_NAME;
|
conf.left_prompt_cmd = DEBUG_PROMPT_FUNCTION_NAME;
|
||||||
|
conf.right_prompt_cmd = wcstring{};
|
||||||
} else {
|
} else {
|
||||||
conf.left_prompt_cmd = LEFT_PROMPT_FUNCTION_NAME;
|
conf.left_prompt_cmd = LEFT_PROMPT_FUNCTION_NAME;
|
||||||
|
conf.right_prompt_cmd = RIGHT_PROMPT_FUNCTION_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists(RIGHT_PROMPT_FUNCTION_NAME, parser)) {
|
|
||||||
conf.right_prompt_cmd = RIGHT_PROMPT_FUNCTION_NAME;
|
|
||||||
} else {
|
|
||||||
conf.right_prompt_cmd = wcstring{};
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<reader_data_t> data =
|
std::shared_ptr<reader_data_t> data =
|
||||||
reader_push_ret(parser, history_session_id(parser.vars()), std::move(conf));
|
reader_push_ret(parser, history_session_id(parser.vars()), std::move(conf));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user