Let repaint-mode act like a repaint if no fish_mode_prompt exists

Otherwise I'm pretty sure we'd get complaints from people who use a
mode-indicator elsewhere in their prompts.
This commit is contained in:
Fabian Homborg 2019-04-01 16:04:14 +02:00
parent bc958712e4
commit 99dd6d7394
2 changed files with 10 additions and 6 deletions

View File

@ -138,7 +138,7 @@ The following special input functions are available:
- ``repaint`` reexecutes the prompt functions and redraws the prompt. Multiple successive repaints are coalesced.
- ``repaint-mode`` reexecutes the fish_mode_prompt function and redraws the prompt. This is useful for vi-mode.
- ``repaint-mode`` reexecutes the fish_mode_prompt function and redraws the prompt. This is useful for vi-mode. If no fish_mode_prompt exists, it acts like a normal repaint.
- ``suppress-autosuggestion``, remove the current autosuggestion

View File

@ -2514,11 +2514,15 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
// Repaint the mode-prompt only if it exists.
// This is an optimization basically exclusively for vi-mode, since the prompt
// may sometimes take a while but when switching the mode all we care about is the mode-prompt.
exec_mode_prompt();
s_reset(&screen, screen_reset_current_line_and_prompt);
screen_reset_needed = false;
repaint();
break;
if (function_exists(MODE_PROMPT_FUNCTION_NAME)) {
exec_mode_prompt();
s_reset(&screen, screen_reset_current_line_and_prompt);
screen_reset_needed = false;
repaint();
break;
}
// If it doesn't exist, we repaint as normal.
/* fallthrough */
}
case rl::force_repaint:
case rl::repaint: {