From be908f6992a03e7826707888750af8788f05e756 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 1 Oct 2004 18:34:30 +0000 Subject: [PATCH] for consistency, make do_insertfile() take a parameter to indicate whether it's in "Execute Command" mode; also add continue and goto to the "c-file" regexes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1955 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 7 +++++-- doc/nanorc.sample | 2 +- src/files.c | 29 ++++++++++++++++++----------- src/proto.h | 8 +++++++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index fcd7091c..a3ec7557 100644 --- a/ChangeLog +++ b/ChangeLog @@ -68,7 +68,9 @@ CVS code - do_insertfile() - Readd the NANO_SMALL #ifdef around the start_again: label to avoid a warning. (DLR) - - Simplify by reusing variables whereever possible. (DLR) + - Simplify by reusing variables whereever possible, and add a + parameter execute to indicate whether or not to be in "Execute + Command" mode. (DLR) - global.c: shortcut_init() - Remove redundant NANO_SMALL #ifdef. (DLR) @@ -171,6 +173,7 @@ CVS code - - nanorc.sample: - Remove specific references to control key shortcuts other than XON and XOFF. (DLR) + - Add continue and goto to the "c-file" regexes. (DLR) - doc/man/fr/nano.1, doc/man/fr/nanorc.1: - Updated manpage translations by Jean-Philippe Guérard. @@ -256,7 +259,7 @@ GNU nano 1.3.4 - 2004.08.17 - Consolidate some if blocks to remove some redundant code. (David Benbennick) - Fix warnings when compiling with ENABLE_NLS undefined and with - -the fwritable-strings option. (David Benbennick) + the fwritable-strings option. (David Benbennick) - Add various #ifdefs to fix warnings and compilation problems when compiling with every option manually turned on, including NANO_SMALL. (David Benbennick) diff --git a/doc/nanorc.sample b/doc/nanorc.sample index 8ee3f37a..9c244420 100644 --- a/doc/nanorc.sample +++ b/doc/nanorc.sample @@ -139,7 +139,7 @@ # syntax "c-file" "\.(c|h)$" # color red "\<[A-Z_]{2,}\>" # color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>" -# color brightyellow "\<(for|if|while|do|else|case|switch|break)\>" +# color brightyellow "\<(for|if|while|do|else|case|switch|goto|continue|break)\>" # color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)" ## ## You will in general want your comments and strings to come last, diff --git a/src/files.c b/src/files.c index a7684559..e0a2ede6 100644 --- a/src/files.c +++ b/src/files.c @@ -474,16 +474,19 @@ void load_buffer(const char *name) load_file(); } -void do_insertfile(void) +void do_insertfile( +#ifndef NANO_SMALL + bool execute +#else + void +#endif + ) { int i; const char *msg; char *ans = mallocstrcpy(NULL, ""); /* The last answer the user typed on the statusbar. Saved for if * they do M-F or cancel the file browser. */ -#ifndef NANO_SMALL - bool extcmd = FALSE; -#endif wrap_reset(); @@ -492,7 +495,7 @@ void do_insertfile(void) #endif #ifndef NANO_SMALL - if (extcmd) { + if (execute) { #ifdef ENABLE_MULTIBUFFER if (ISSET(MULTIBUFFER)) msg = N_("Command to execute in new buffer [from %s] "); @@ -513,7 +516,7 @@ void do_insertfile(void) i = statusq(TRUE, #ifndef NANO_SMALL - extcmd ? extcmd_list : + execute ? extcmd_list : #endif insertfile_list, ans, #ifndef NANO_SMALL @@ -553,11 +556,11 @@ void do_insertfile(void) #ifndef NANO_SMALL if (i == NANO_TOOTHERINSERT_KEY) { - extcmd = !extcmd; + execute = !execute; goto start_again; } - if (extcmd) + if (execute) execute_command(answer); else { #endif @@ -600,7 +603,11 @@ void do_insertfile_void(void) statusbar(_("Key illegal in non-multibuffer mode")); else #endif - do_insertfile(); + do_insertfile( +#ifndef NANO_SMALL + FALSE +#endif + ); display_main_list(); } @@ -1846,10 +1853,10 @@ int do_writeout(int exiting) } else #endif /* !NANO_SMALL */ if (i == NANO_PREPEND_KEY) { - append = append == 2 ? 0 : 2; + append = (append == 2) ? 0 : 2; continue; } else if (i == NANO_APPEND_KEY) { - append = append == 1 ? 0 : 1; + append = (append == 1) ? 0 : 1; continue; } diff --git a/src/proto.h b/src/proto.h index ee27c60c..30383035 100644 --- a/src/proto.h +++ b/src/proto.h @@ -175,7 +175,13 @@ char *get_next_filename(const char *name); void execute_command(const char *command); #endif void load_buffer(const char *name); -void do_insertfile(void); +void do_insertfile( +#ifndef NANO_SMALL + bool execute +#else + void +#endif + ); void do_insertfile_void(void); #ifdef ENABLE_MULTIBUFFER openfilestruct *make_new_opennode(openfilestruct *prevnode); -- 2.39.5