]> git.wh0rd.org Git - nano.git/commitdiff
partition the filestruct properly when executing a command
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 7 Nov 2004 18:09:41 +0000 (18:09 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Sun, 7 Nov 2004 18:09:41 +0000 (18:09 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2082 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

src/files.c

index e244252d44fa3361393b7d4ddcc4354f0fa9390d..1d0b11e8229807c782e3e2d0e34cd638fee96cec 100644 (file)
@@ -577,52 +577,53 @@ void do_insertfile(
                execute = !execute;
                continue;
            }
-
-           if (execute)
-               execute_command(answer);
-           else {
 #endif
-               answer = mallocstrassn(answer, real_dir_from_tilde(answer));
 
 #ifdef ENABLE_MULTIBUFFER
-               if (!ISSET(MULTIBUFFER)) {
+           if (!ISSET(MULTIBUFFER)) {
 #endif
-                   /* If we're not inserting into a new buffer,
-                    * partition the filestruct so that it contains no
-                    * text and hence looks like a new buffer, and set
-                    * edittop to the top of the partition. */
-                   filepart = partition_filestruct(current, current_x,
+               /* If we're not inserting into a new buffer, partition
+                * the filestruct so that it contains no text and hence
+                * looks like a new buffer, and set edittop to the top
+                * of the partition. */
+               filepart = partition_filestruct(current, current_x,
                        current, current_x);
-                   edittop = fileage;
+               edittop = fileage;
 #ifdef ENABLE_MULTIBUFFER
-               }
+           }
 #endif
 
+#ifndef NANO_SMALL
+           if (execute)
+               execute_command(answer);
+           else {
+#endif
+               answer = mallocstrassn(answer, real_dir_from_tilde(answer));
                load_buffer(answer);
+#ifndef NANO_SMALL
+           }
+#endif
 
 #ifdef ENABLE_MULTIBUFFER
-               if (!ISSET(MULTIBUFFER))
+           if (!ISSET(MULTIBUFFER))
 #endif
-               {
-                   filestruct *top_save = fileage;
+           {
+               filestruct *top_save = fileage;
 
-                   /* If we're not inserting into a new buffer,
-                    * unpartition the filestruct so that it contains
-                    * all the text again.  Note that we've replaced the
-                    * non-text originally in the partition with the
-                    * text in the inserted file. */
-                   unpartition_filestruct(filepart);
+               /* If we're not inserting into a new buffer, unpartition
+                * the filestruct so that it contains all the text
+                * again.  Note that we've replaced the non-text
+                * originally in the partition with the text in the
+                * inserted file/executed command output. */
+               unpartition_filestruct(filepart);
 
-                   /* Renumber starting with the beginning line of the
-                    * old partition. */
-                   renumber(top_save);
+               /* Renumber starting with the beginning line of the old
+                * partition. */
+               renumber(top_save);
 
-                   /* Set edittop back to what it was before. */
-                   edittop = edittop_save;
-               }
-#ifndef NANO_SMALL
+               /* Set edittop back to what it was before. */
+               edittop = edittop_save;
            }
-#endif
 
 #ifdef ENABLE_MULTIBUFFER
            if (ISSET(MULTIBUFFER)) {