2
0
Fork 0
mirror of https://github.com/fish-shell/fish-shell synced 2025-02-15 13:38:38 +00:00

Correct highlighting of executed invalid commands

If you expand an abbreviation by executing the command, fish uses a
synchronous mode of syntax highlighting that performs no I/O, because we
want to highlight the abbreviation but don't know if it's valid or not
without doing I/O. However we were doing this too aggressively, after
every command regardless of whether it contained an abbreviation. Only
do this for commands with abbreviations.
This commit is contained in:
ridiculousfish 2020-08-23 12:53:05 -07:00
parent 6d339df612
commit d563084dfb

View file

@ -3021,11 +3021,11 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
bool abbreviation_expanded = expand_abbreviation_as_necessary(1);
if (abbreviation_expanded && conf.syntax_check_ok) {
command_test_result = reader_shell_test(parser(), el->text());
// If the command is OK, then we're going to execute it. We still want to do
// syntax highlighting on this newly changed command, but a synchronous variant
// that performs no I/O, so as not to block the user.
if (command_test_result == 0) super_highlight_me_plenty(true);
}
// If the command is OK, then we're going to execute it. We still want to do
// syntax highlighting, but a synchronous variant that performs no I/O, so
// as not to block the user.
if (command_test_result == 0) super_highlight_me_plenty(true);
}
if (command_test_result == 0) {