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

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
No related merge requests found
Showing with 31 additions and 15 deletions
+31 -15
...@@ -68,7 +68,9 @@ CVS code - ...@@ -68,7 +68,9 @@ CVS code -
do_insertfile() do_insertfile()
- Readd the NANO_SMALL #ifdef around the start_again: label to - Readd the NANO_SMALL #ifdef around the start_again: label to
avoid a warning. (DLR) 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: - global.c:
shortcut_init() shortcut_init()
- Remove redundant NANO_SMALL #ifdef. (DLR) - Remove redundant NANO_SMALL #ifdef. (DLR)
...@@ -171,6 +173,7 @@ CVS code - ...@@ -171,6 +173,7 @@ CVS code -
- nanorc.sample: - nanorc.sample:
- Remove specific references to control key shortcuts other than - Remove specific references to control key shortcuts other than
XON and XOFF. (DLR) XON and XOFF. (DLR)
- Add continue and goto to the "c-file" regexes. (DLR)
- doc/man/fr/nano.1, doc/man/fr/nanorc.1: - doc/man/fr/nano.1, doc/man/fr/nanorc.1:
- Updated manpage translations by Jean-Philippe Guérard. - Updated manpage translations by Jean-Philippe Guérard.
...@@ -256,7 +259,7 @@ GNU nano 1.3.4 - 2004.08.17 ...@@ -256,7 +259,7 @@ GNU nano 1.3.4 - 2004.08.17
- Consolidate some if blocks to remove some redundant code. - Consolidate some if blocks to remove some redundant code.
(David Benbennick) (David Benbennick)
- Fix warnings when compiling with ENABLE_NLS undefined and with - 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 - Add various #ifdefs to fix warnings and compilation problems
when compiling with every option manually turned on, including when compiling with every option manually turned on, including
NANO_SMALL. (David Benbennick) NANO_SMALL. (David Benbennick)
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
# syntax "c-file" "\.(c|h)$" # syntax "c-file" "\.(c|h)$"
# color red "\<[A-Z_]{2,}\>" # 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 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)" # color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
## ##
## You will in general want your comments and strings to come last, ## You will in general want your comments and strings to come last,
......
...@@ -474,16 +474,19 @@ void load_buffer(const char *name) ...@@ -474,16 +474,19 @@ void load_buffer(const char *name)
load_file(); load_file();
} }
void do_insertfile(void) void do_insertfile(
#ifndef NANO_SMALL
bool execute
#else
void
#endif
)
{ {
int i; int i;
const char *msg; const char *msg;
char *ans = mallocstrcpy(NULL, ""); char *ans = mallocstrcpy(NULL, "");
/* The last answer the user typed on the statusbar. Saved for if /* The last answer the user typed on the statusbar. Saved for if
* they do M-F or cancel the file browser. */ * they do M-F or cancel the file browser. */
#ifndef NANO_SMALL
bool extcmd = FALSE;
#endif
wrap_reset(); wrap_reset();
...@@ -492,7 +495,7 @@ void do_insertfile(void) ...@@ -492,7 +495,7 @@ void do_insertfile(void)
#endif #endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (extcmd) { if (execute) {
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (ISSET(MULTIBUFFER)) if (ISSET(MULTIBUFFER))
msg = N_("Command to execute in new buffer [from %s] "); msg = N_("Command to execute in new buffer [from %s] ");
...@@ -513,7 +516,7 @@ void do_insertfile(void) ...@@ -513,7 +516,7 @@ void do_insertfile(void)
i = statusq(TRUE, i = statusq(TRUE,
#ifndef NANO_SMALL #ifndef NANO_SMALL
extcmd ? extcmd_list : execute ? extcmd_list :
#endif #endif
insertfile_list, ans, insertfile_list, ans,
#ifndef NANO_SMALL #ifndef NANO_SMALL
...@@ -553,11 +556,11 @@ void do_insertfile(void) ...@@ -553,11 +556,11 @@ void do_insertfile(void)
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (i == NANO_TOOTHERINSERT_KEY) { if (i == NANO_TOOTHERINSERT_KEY) {
extcmd = !extcmd; execute = !execute;
goto start_again; goto start_again;
} }
if (extcmd) if (execute)
execute_command(answer); execute_command(answer);
else { else {
#endif #endif
...@@ -600,7 +603,11 @@ void do_insertfile_void(void) ...@@ -600,7 +603,11 @@ void do_insertfile_void(void)
statusbar(_("Key illegal in non-multibuffer mode")); statusbar(_("Key illegal in non-multibuffer mode"));
else else
#endif #endif
do_insertfile(); do_insertfile(
#ifndef NANO_SMALL
FALSE
#endif
);
display_main_list(); display_main_list();
} }
...@@ -1846,10 +1853,10 @@ int do_writeout(int exiting) ...@@ -1846,10 +1853,10 @@ int do_writeout(int exiting)
} else } else
#endif /* !NANO_SMALL */ #endif /* !NANO_SMALL */
if (i == NANO_PREPEND_KEY) { if (i == NANO_PREPEND_KEY) {
append = append == 2 ? 0 : 2; append = (append == 2) ? 0 : 2;
continue; continue;
} else if (i == NANO_APPEND_KEY) { } else if (i == NANO_APPEND_KEY) {
append = append == 1 ? 0 : 1; append = (append == 1) ? 0 : 1;
continue; continue;
} }
......
...@@ -175,7 +175,13 @@ char *get_next_filename(const char *name); ...@@ -175,7 +175,13 @@ char *get_next_filename(const char *name);
void execute_command(const char *command); void execute_command(const char *command);
#endif #endif
void load_buffer(const char *name); 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); void do_insertfile_void(void);
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
openfilestruct *make_new_opennode(openfilestruct *prevnode); openfilestruct *make_new_opennode(openfilestruct *prevnode);
......
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