Commit c15802f8 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

partition the filestruct properly when executing a command

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 7105cf4f
Showing with 31 additions and 30 deletions
+31 -30
...@@ -577,52 +577,53 @@ void do_insertfile( ...@@ -577,52 +577,53 @@ void do_insertfile(
execute = !execute; execute = !execute;
continue; continue;
} }
if (execute)
execute_command(answer);
else {
#endif #endif
answer = mallocstrassn(answer, real_dir_from_tilde(answer));
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (!ISSET(MULTIBUFFER)) { if (!ISSET(MULTIBUFFER)) {
#endif #endif
/* If we're not inserting into a new buffer, /* If we're not inserting into a new buffer, partition
* partition the filestruct so that it contains no * the filestruct so that it contains no text and hence
* text and hence looks like a new buffer, and set * looks like a new buffer, and set edittop to the top
* edittop to the top of the partition. */ * of the partition. */
filepart = partition_filestruct(current, current_x, filepart = partition_filestruct(current, current_x,
current, current_x); current, current_x);
edittop = fileage; edittop = fileage;
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
} }
#endif #endif
#ifndef NANO_SMALL
if (execute)
execute_command(answer);
else {
#endif
answer = mallocstrassn(answer, real_dir_from_tilde(answer));
load_buffer(answer); load_buffer(answer);
#ifndef NANO_SMALL
}
#endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (!ISSET(MULTIBUFFER)) if (!ISSET(MULTIBUFFER))
#endif #endif
{ {
filestruct *top_save = fileage; filestruct *top_save = fileage;
/* If we're not inserting into a new buffer, /* If we're not inserting into a new buffer, unpartition
* unpartition the filestruct so that it contains * the filestruct so that it contains all the text
* all the text again. Note that we've replaced the * again. Note that we've replaced the non-text
* non-text originally in the partition with the * originally in the partition with the text in the
* text in the inserted file. */ * inserted file/executed command output. */
unpartition_filestruct(filepart); unpartition_filestruct(filepart);
/* Renumber starting with the beginning line of the /* Renumber starting with the beginning line of the old
* old partition. */ * partition. */
renumber(top_save); renumber(top_save);
/* Set edittop back to what it was before. */ /* Set edittop back to what it was before. */
edittop = edittop_save; edittop = edittop_save;
}
#ifndef NANO_SMALL
} }
#endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) { if (ISSET(MULTIBUFFER)) {
......
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