execute: show "Cancelled" instead of "Error" when the user hits ^C

(The "Cancelled" is shown with a red background, like an error,
but that is needed so that do_undo() will be called afterward.)
This commit is contained in:
Benno Schulenberg 2022-10-09 16:28:06 +02:00
parent 858f411447
commit e413ed8e1d

View File

@ -1151,8 +1151,8 @@ void execute_command(const char *command)
/* If the command failed, show what the shell reported. */
if (WIFEXITED(command_status) == 0 || WEXITSTATUS(command_status))
statusline(ALERT, _("Error: %s"), !WIFSIGNALED(command_status) &&
openfile->current->prev &&
statusline(ALERT, WIFSIGNALED(command_status) ? _("Cancelled") :
_("Error: %s"), openfile->current->prev &&
strstr(openfile->current->prev->data, ": ") ?
strstr(openfile->current->prev->data, ": ") + 2 : "---");
else if (should_pipe && pid_of_sender > 0 &&