Commit 84c650b8 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

files: avoid an abortion when excuting a command in a new buffer


The key sequence ^R ^X M-F <Enter> would cause nano to abort, because
it would try to add an empty string to a history list.  (Furthermore,
simply don't execute an empty command, because it is pointless.)
Reported-by: default avatarMarco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
No related merge requests found
Showing with 6 additions and 3 deletions
+6 -3
......@@ -1127,11 +1127,14 @@ void do_insertfile(void)
if (ISSET(MULTIBUFFER))
open_buffer("", FALSE);
#endif
/* Save the command's output in the current buffer. */
execute_command(answer);
/* If the command is not empty, execute it and read its output
* into the buffer, and add the command to the history list. */
if (*answer != '\0') {
execute_command(answer);
#ifndef DISABLE_HISTORIES
update_history(&execute_history, answer);
update_history(&execute_history, answer);
#endif
}
#ifdef ENABLE_MULTIBUFFER
/* If this is a new buffer, put the cursor at the top. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment