nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 509b091c470ac259454276bce295a98d755214a8
parent 9ea5eef200ea7fcbfd8c452b8852c318b508206a
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon,  8 May 2017 14:23:47 +0200

tweaks: rename three empty functions, and reshuffle some others

Also remove a superfluous check for 'do_replace' -- it never gets
bound in the Search/Replace menus.

Diffstat:
Msrc/files.c | 4++--
Msrc/global.c | 36++++++++++++++++++------------------
Msrc/proto.h | 14++++++++------
Msrc/search.c | 2+-
4 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -1112,7 +1112,7 @@ void do_insertfile(void) given = mallocstrcpy(given, answer); #ifdef ENABLE_MULTIBUFFER - if (func == new_buffer_void) { + if (func == flip_newbuffer) { /* Don't allow toggling when in view mode. */ if (!ISSET(VIEW_MODE)) TOGGLE(MULTIBUFFER); @@ -1122,7 +1122,7 @@ void do_insertfile(void) } #endif #ifndef NANO_TINY - if (func == flip_execute_void) { + if (func == flip_execute) { execute = !execute; continue; } diff --git a/src/global.c b/src/global.c @@ -266,6 +266,9 @@ void regexp_void(void) void backwards_void(void) { } +void flip_replace(void) +{ +} void gototext_void(void) { } @@ -293,19 +296,16 @@ void prepend_void(void) void backup_file_void(void) { } -#endif -void discard_buffer(void) +void flip_execute(void) { } +#endif #ifdef ENABLE_MULTIBUFFER -void new_buffer_void(void) +void flip_newbuffer(void) { } #endif -void flip_replace_void(void) -{ -} -void flip_execute_void(void) +void discard_buffer(void) { } @@ -793,10 +793,10 @@ void shortcut_init(void) add_to_funcs(backwards_void, MWHEREIS|MREPLACE, N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW); - add_to_funcs(flip_replace_void, MWHEREIS, + add_to_funcs(flip_replace, MWHEREIS, replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW); - add_to_funcs(flip_replace_void, MREPLACE, + add_to_funcs(flip_replace, MREPLACE, N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW); #ifndef DISABLE_JUSTIFY @@ -996,16 +996,16 @@ void shortcut_init(void) /* If we're using restricted mode, file insertion is disabled, and * thus command execution and the multibuffer toggle have no place. */ if (!ISSET(RESTRICTED)) { - add_to_funcs(flip_execute_void, MINSERTFILE, + add_to_funcs(flip_execute, MINSERTFILE, N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW); - add_to_funcs(flip_execute_void, MEXTCMD, + add_to_funcs(flip_execute, MEXTCMD, read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW); } #endif /* !NANO_TINY */ #ifdef ENABLE_MULTIBUFFER if (!ISSET(RESTRICTED)) - add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD, + add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD, N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW); #endif @@ -1238,7 +1238,7 @@ void shortcut_init(void) add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0); add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0); - add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0); + add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0); add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0); #ifndef DISABLE_JUSTIFY @@ -1288,12 +1288,12 @@ void shortcut_init(void) add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0); add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0); add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0); - add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0); + add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute, 0); } #endif #ifdef ENABLE_MULTIBUFFER if (!ISSET(RESTRICTED)) - add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0); + add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0); #endif #ifndef DISABLE_BROWSER /* In restricted mode, don't allow entering the file browser. */ @@ -1580,7 +1580,7 @@ sc *strtosc(const char *input) s->scfunc = backwards_void; else if (!strcasecmp(input, "flipreplace") || !strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */ - s->scfunc = flip_replace_void; + s->scfunc = flip_replace; else if (!strcasecmp(input, "gototext")) s->scfunc = gototext_void; #ifndef DISABLE_HISTORIES @@ -1601,12 +1601,12 @@ sc *strtosc(const char *input) else if (!strcasecmp(input, "backup")) s->scfunc = backup_file_void; else if (!strcasecmp(input, "flipexecute")) - s->scfunc = flip_execute_void; + s->scfunc = flip_execute; #endif #ifdef ENABLE_MULTIBUFFER else if (!strcasecmp(input, "flipnewbuffer") || !strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */ - s->scfunc = new_buffer_void; + s->scfunc = flip_newbuffer; #endif #ifndef DISABLE_BROWSER else if (!strcasecmp(input, "tofiles") || diff --git a/src/proto.h b/src/proto.h @@ -687,22 +687,24 @@ void do_credits(void); void do_cancel(void); void case_sens_void(void); void regexp_void(void); +void backwards_void(void); +void flip_replace(void); void gototext_void(void); +#ifndef DISABLE_BROWSER void to_files_void(void); +void goto_dir_void(void); +#endif #ifndef NANO_TINY void dos_format_void(void); void mac_format_void(void); void append_void(void); void prepend_void(void); void backup_file_void(void); +void flip_execute(void); #endif -void discard_buffer(void); #ifdef ENABLE_MULTIBUFFER -void new_buffer_void(void); +void flip_newbuffer(void); #endif -void backwards_void(void); -void goto_dir_void(void); -void flip_replace_void(void); -void flip_execute_void(void); +void discard_buffer(void); #endif /* !PROTO_H */ diff --git a/src/search.c b/src/search.c @@ -202,7 +202,7 @@ int search_init(bool replacing, bool use_answer) TOGGLE(USE_REGEXP); backupstring = mallocstrcpy(backupstring, answer); return 1; - } else if (func == do_replace || func == flip_replace_void) { + } else if (func == flip_replace) { backupstring = mallocstrcpy(backupstring, answer); return -2; /* Call the opposite search function. */ } else if (func == do_gotolinecolumn_void) {