mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
Ease condition for the execution of the right prompt
Now, the right prompt will not be executed only if it is undefined `fish_right_prompt`. This allows the use of `read -p 'echo left' -R 'echo right'`. Also changes condition for use of `DEFAULT_PROMPT` for consistency.
This commit is contained in:
committed by
Johannes Altmanninger
parent
cb31f3e092
commit
7ed4dfbd2d
@@ -4556,19 +4556,21 @@ fn exec_prompt(&mut self, full_prompt: bool) {
|
||||
// Historic compatibility hack.
|
||||
// If the left prompt function is deleted, then use a default prompt instead of
|
||||
// producing an error.
|
||||
let prompt_cmd = if self.conf.left_prompt_cmd == LEFT_PROMPT_FUNCTION_NAME
|
||||
&& !function::exists(&self.conf.left_prompt_cmd, self.parser)
|
||||
let prompt_cmd = if self.conf.left_prompt_cmd != LEFT_PROMPT_FUNCTION_NAME
|
||||
|| function::exists(&self.conf.left_prompt_cmd, self.parser)
|
||||
{
|
||||
DEFAULT_PROMPT
|
||||
} else {
|
||||
&self.conf.left_prompt_cmd
|
||||
} else {
|
||||
DEFAULT_PROMPT
|
||||
};
|
||||
|
||||
self.left_prompt_buff = join_strings(&self.exec_prompt_cmd(prompt_cmd), '\n');
|
||||
}
|
||||
|
||||
// Don't execute the right prompt if it is undefined fish_right_prompt
|
||||
if !self.conf.right_prompt_cmd.is_empty()
|
||||
&& function::exists(&self.conf.right_prompt_cmd, self.parser)
|
||||
&& (self.conf.right_prompt_cmd != RIGHT_PROMPT_FUNCTION_NAME
|
||||
|| function::exists(&self.conf.right_prompt_cmd, self.parser))
|
||||
{
|
||||
// Right prompt does not support multiple lines, so just concatenate all of them.
|
||||
self.right_prompt_buff =
|
||||
|
||||
Reference in New Issue
Block a user