Commit 9a145d90 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in do_insertfile(), if we're in view mode, as we can be if multibuffer

mode is on, don't mark the file as modified (and remove the code that
does this in execute_command()); also, if we execute a command in a new
buffer, move back to the beginning of the first line of the buffer
afterwards, for consistency


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3785 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 25 additions and 8 deletions
+25 -8
...@@ -77,6 +77,12 @@ CVS code - ...@@ -77,6 +77,12 @@ CVS code -
string. Also, return the stripped path instead of modifying string. Also, return the stripped path instead of modifying
path. (DLR) path. (DLR)
- files.c: - files.c:
do_insertfile()
- If we're in view mode, as we can be if multibuffer mode is on,
don't mark the file as modified. (DLR)
- If we execute a command in a new buffer, move back to the
beginning of the first line of the buffer afterwards, for
consistency. (DLR)
get_full_path() get_full_path()
- Don't return NULL when the current directory doesn't exist, as - Don't return NULL when the current directory doesn't exist, as
we can still recover from that. (DLR, found by Mike Frysinger) we can still recover from that. (DLR, found by Mike Frysinger)
...@@ -93,6 +99,10 @@ CVS code - ...@@ -93,6 +99,10 @@ CVS code -
- nano.h: - nano.h:
- Remove the manual disabling of color support if regex.h isn't - Remove the manual disabling of color support if regex.h isn't
found, as configure.ac now handles that. (DLR) found, as configure.ac now handles that. (DLR)
- text.c:
execute_command()
- Remove the marking of the file as modified, as do_insertfile()
handles that. (DLR)
- winio.c: - winio.c:
display_string() display_string()
- Properly handle buf[start_index]'s being a null terminator. - Properly handle buf[start_index]'s being a null terminator.
......
...@@ -811,8 +811,18 @@ void do_insertfile( ...@@ -811,8 +811,18 @@ void do_insertfile(
/* Save the command's output in the current buffer. */ /* Save the command's output in the current buffer. */
execute_command(answer); execute_command(answer);
} else {
#ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) {
/* Move back to the beginning of the first line of
* the buffer. */
openfile->current = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
}
#endif #endif
} else {
#endif /* !NANO_TINY */
/* Make sure the path to the file specified in answer is /* Make sure the path to the file specified in answer is
* tilde-expanded. */ * tilde-expanded. */
answer = mallocstrassn(answer, answer = mallocstrassn(answer,
...@@ -861,8 +871,10 @@ void do_insertfile( ...@@ -861,8 +871,10 @@ void do_insertfile(
/* Restore the old place we want. */ /* Restore the old place we want. */
openfile->placewewant = pww_save; openfile->placewewant = pww_save;
/* Mark the file as modified. */ /* Mark the file as modified, unless we're here in view
set_modified(); * mode, which we can be if multibuffer mode is on. */
if (!ISSET(VIEW_MODE))
set_modified();
/* Update the screen. */ /* Update the screen. */
edit_refresh(); edit_refresh();
......
...@@ -497,11 +497,6 @@ bool execute_command(const char *command) ...@@ -497,11 +497,6 @@ bool execute_command(const char *command)
read_file(f, "stdin"); read_file(f, "stdin");
/* If multibuffer mode is on, we could be here in view mode. If so,
* don't set the modification flag. */
if (!ISSET(VIEW_MODE))
set_modified();
if (wait(NULL) == -1) if (wait(NULL) == -1)
nperror("wait"); nperror("wait");
......
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