From: Benno Schulenberg Date: Mon, 7 Apr 2014 09:24:10 +0000 (+0000) Subject: Dropping the obsolete argument of shortcut_init(), X-Git-Tag: v2.3.3~190 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=a2dcd6edce36053d3ab76e349be2455015652491;p=nano.git Dropping the obsolete argument of shortcut_init(), and removing two unneeded calls of this function. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4740 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 1f975d33..2611d969 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ the functions and shortcuts lists before and after every Justify. Also, look for ^U only in the main menu, to which ^W M-J factually returns and which shortcut_init() "sneakily" sets. + * src/{proto.h,files.c,global.c,nano.c,rcfile.c}: Drop the obsolete + argument of shortcut_init(), and remove two unneeded calls of it. 2014-04-06 Benno Schulenberg * src/global.c (shortcut_init): Limit M-T (cut-till-end-of-file) to diff --git a/src/files.c b/src/files.c index 537e75a2..fd4a9669 100644 --- a/src/files.c +++ b/src/files.c @@ -1277,8 +1277,6 @@ void do_insertfile( break; } } - shortcut_init(FALSE); - free(ans); } diff --git a/src/global.c b/src/global.c index 4c7d689b..e074bef0 100644 --- a/src/global.c +++ b/src/global.c @@ -544,9 +544,8 @@ const char *new_buffer_msg = N_("New Buffer"); #endif -/* Initialize all shortcut lists. If unjustify is TRUE, replace - * the Uncut shortcut in the main shortcut list with UnJustify. */ -void shortcut_init(bool unjustify) +/* Initialize the list of functions and the list of shortcuts. */ +void shortcut_init(void) { /* TRANSLATORS: Try to keep the following strings at most 10 characters. */ const char *get_help_msg = N_("Get Help"); diff --git a/src/nano.c b/src/nano.c index b2a6cbe0..de3b5c81 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1127,7 +1127,6 @@ void do_exit(void) } else if (i != 1) statusbar(_("Cancelled")); - shortcut_init(FALSE); display_main_list(); } @@ -1710,9 +1709,6 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool { s->scfunc(); #ifndef DISABLE_COLOR - /* The command might have re-initialized shortcuts, - * in which case f is now invalid. Let's reload it. */ - f = sctofunc((sc *) s); if (f && !f->viewok && openfile->syntax != NULL && openfile->syntax->nmultis > 0) { reset_multis(openfile->current, FALSE); @@ -2407,9 +2403,9 @@ int main(int argc, char **argv) #endif } - /* Set up the shortcut lists. - * Need to do this before the rcfile. */ - shortcut_init(FALSE); + /* Set up the function and shortcut lists. This needs to be done + * before reading the rcfile, to be able to rebind/unbind keys. */ + shortcut_init(); /* We've read through the command line options. Now back up the flags * and values that are set, and read the rcfile(s). If the values diff --git a/src/proto.h b/src/proto.h index 801e14bf..9a816604 100644 --- a/src/proto.h +++ b/src/proto.h @@ -357,7 +357,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc #endif , int metaval, int funcval, int miscval, bool view, void (*func)(void)); -void shortcut_init(bool unjustify); +void shortcut_init(void); #ifdef DEBUG void thanks_for_all_the_fish(void); #endif diff --git a/src/rcfile.c b/src/rcfile.c index c3798b68..f8297a9b 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1281,9 +1281,9 @@ void parse_rcfile(FILE *rcstream else rcfile_error(N_("Cannot unset flag \"%s\""), rcopts[i].name); - /* Looks like we still need this specific hack for undo */ + /* If undo/redo was enabled, reinitialize the lists. */ if (strcasecmp(rcopts[i].name, "undo") == 0) - shortcut_init(0); + shortcut_init(); break; } }