From: Chris Allegretta Date: Thu, 13 Mar 2008 08:23:52 +0000 (+0000) Subject: - Fix tiny mode again after breaking it again X-Git-Tag: v2.1.0~14 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=0018d8ed6f8f5d225ea4daeececec19c23d25ba7;p=nano.git - Fix tiny mode again after breaking it again - Resurrect IFSCHELP to get rid of some needless help message stubs - Add support for rebinding the suspend key - Fix wrong refresh help message git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/browser.c b/src/browser.c index 8c9c7a66..78c0d915 100644 --- a/src/browser.c +++ b/src/browser.c @@ -156,7 +156,7 @@ char *do_browser(char *path, DIR *dir) * time, put back the Enter key so that it's * read in. */ if (old_selected == selected) - unget_kbinput(NANO_ENTER_KEY, FALSE, FALSE); + unget_kbinput(sc_seq_or(do_enter, 0), FALSE, FALSE); } } #endif /* !DISABLE_MOUSE */ @@ -237,7 +237,7 @@ char *do_browser(char *path, DIR *dir) * answer in ans, so that the file list is displayed * again, the prompt is displayed again, and what we * typed before at the prompt is displayed again. */ - unget_kbinput(NANO_GOTOLINE_KEY, FALSE, FALSE); + unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE); ans = mallocstrcpy(ans, answer); break; } @@ -560,7 +560,6 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key) *kbinput = sc_seq_or(do_help_void, 0); break; /* Cancel equivalent to Exit here. */ - case NANO_CANCEL_KEY: case 'E': case 'e': *kbinput = sc_seq_or(do_exit, 0); @@ -758,6 +757,8 @@ int filesearch_init(void) { int i = 0; char *buf; + bool meta_key, func_key; + const sc *s; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -825,9 +826,8 @@ int filesearch_init(void) statusbar(_("Cancelled")); return -1; } else { - switch (i) { - case -2: /* It's an empty string. */ - case 0: /* It's a new string. */ + s = get_shortcut(MBROWSER, &i, &meta_key, &func_key); + if (i == -2 || i == 0) { #ifdef HAVE_REGEX_H /* Use last_search if answer is an empty string, or * answer if it isn't. */ @@ -835,26 +835,26 @@ int filesearch_init(void) last_search : answer)) return -1; #endif - break; + } else #ifndef NANO_TINY - case TOGGLE_CASE_KEY: + if (s && s->scfunc == (void *) case_sens_msg) { TOGGLE(CASE_SENSITIVE); backupstring = mallocstrcpy(backupstring, answer); return 1; - case TOGGLE_BACKWARDS_KEY: + } else if (s && s->scfunc == (void *) backwards_msg) { TOGGLE(BACKWARDS_SEARCH); backupstring = mallocstrcpy(backupstring, answer); return 1; + } else #endif #ifdef HAVE_REGEX_H - case NANO_REGEXP_KEY: + if (s && s->scfunc == (void *) regexp_msg) { TOGGLE(USE_REGEXP); backupstring = mallocstrcpy(backupstring, answer); return 1; + } else #endif - default: - return -1; - } + return -1; } return 0; diff --git a/src/global.c b/src/global.c index fc5e2a04..5d1e367e 100644 --- a/src/global.c +++ b/src/global.c @@ -197,7 +197,11 @@ size_t length_of_list(int menu) size_t i = 0; for (f = allfuncs; f != NULL; f = f->next) - if ((f->menus & menu) != 0 && strlen(f->help) > 0) { + if ((f->menus & menu) != 0 +#ifndef DISABLE_HELP + && strlen(f->help) > 0 +#endif + ) { i++; } return i; @@ -416,31 +420,6 @@ const char *regexp_msg = N_("Regexp"); /* Stuff we want to just stun out if we're in TINY mode */ #ifdef NANO_TINY -const char *nano_cancel_msg = ""; -const char *nano_exit_msg = ""; -const char *nano_writeout_msg = ""; -const char *nano_insert_msg = ""; -const char *nano_whereis_msg = ""; -const char *nano_prevpage_msg = ""; -const char *nano_nextpage_msg = ""; -const char *nano_cut_msg = ""; -const char *nano_uncut_msg = ""; -const char *nano_cursorpos_msg = ""; -const char *nano_lastline_msg = ""; -const char *nano_gotoline_msg = ""; -const char *nano_replace_msg = ""; -const char *nano_forward_msg = ""; -const char *nano_back_msg = ""; -const char *nano_prevline_msg = ""; -const char *nano_nextline_msg = ""; -const char *nano_home_msg = ""; -const char *nano_end_msg = ""; -const char *nano_verbatim_msg = ""; -const char *nano_tab_msg = ""; -const char *nano_enter_msg = ""; -const char *nano_delete_msg = ""; -const char *nano_backspace_msg = ""; -const char *nano_regexp_msg = ""; const char *gototext_msg = ""; const char *do_para_begin_msg = ""; const char *do_para_end_msg = ""; @@ -459,7 +438,7 @@ const char *whereis_next_msg = ""; const char *last_file_msg = ""; const char *new_buffer_msg = ""; const char *goto_dir_msg; -const char *ext_cmd_msg = = ""; +const char *ext_cmd_msg = ""; #else /* TRANSLATORS: Try to keep this and previous strings at most 10 @@ -516,6 +495,7 @@ void shortcut_init(bool unjustify) * characters. */ const char *first_line_msg = N_("First Line"); const char *last_line_msg = N_("Last Line"); + const char *suspend_msg = N_("Suspend"); #ifndef DISABLE_JUSTIFY const char *beg_of_par_msg = N_("Beg of Par"); const char *end_of_par_msg = N_("End of Par"); @@ -619,6 +599,8 @@ void shortcut_init(bool unjustify) #endif const char *nano_refresh_msg = N_("Refresh (redraw) the current screen"); + const char *nano_suspend_msg = + N_("Suspend the editor (if suspend is enabled)"); #ifndef NANO_TINY const char *nano_case_msg = N_("Toggle the case sensitivity of the search"); @@ -665,9 +647,9 @@ void shortcut_init(bool unjustify) #endif /* !DISABLE_HELP */ #ifndef DISABLE_HELP -#define IFSCHELP(help, blank, nextvar) help, blank, nextvar +#define IFSCHELP(help) help #else -#define IFSCHELP(help, blank, nextvar) nextvar +#define IFSCHELP(help) "" #endif while (allfuncs != NULL) { @@ -683,20 +665,20 @@ void shortcut_init(bool unjustify) add_to_funcs((void *) cancel_msg, (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR), - cancel_msg, nano_cancel_msg, FALSE, VIEW); + cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW); add_to_funcs(do_exit, MMAIN, #ifdef ENABLE_MULTIBUFFER /* TRANSLATORS: Try to keep this at most 10 characters. */ openfile != NULL && openfile != openfile->next ? N_("Close") : #endif - exit_msg, nano_exit_msg, FALSE, VIEW); + exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); - add_to_funcs(do_exit, MBROWSER|MHELP, exit_msg, nano_exit_msg, FALSE, VIEW); + add_to_funcs(do_exit, MBROWSER|MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); /* TRANSLATORS: Try to keep this at most 10 characters. */ add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"), - nano_writeout_msg, FALSE, NOVIEW); + IFSCHELP(nano_writeout_msg), FALSE, NOVIEW); #ifndef DISABLE_JUSTIFY /* TRANSLATORS: Try to keep this at most 10 characters. */ @@ -711,7 +693,7 @@ void shortcut_init(bool unjustify) * line. */ /* TRANSLATORS: Try to keep this at most 10 characters. */ add_to_funcs(!ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg, - MMAIN, N_("Read File"), nano_insert_msg, FALSE, + MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE, #ifdef ENABLE_MULTIBUFFER VIEW); #else @@ -719,15 +701,15 @@ void shortcut_init(bool unjustify) #endif add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg, - nano_whereis_msg, FALSE, VIEW); + IFSCHELP(nano_whereis_msg), FALSE, VIEW); add_to_funcs(do_page_up, MMAIN|MHELP, - prev_page_msg, nano_prevpage_msg, FALSE, VIEW); + prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); add_to_funcs(do_page_down, MMAIN|MHELP, - next_page_msg, nano_nextpage_msg, TRUE, VIEW); + next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW); /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), nano_cut_msg, + add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg), FALSE, NOVIEW); if (unjustify) @@ -737,11 +719,11 @@ void shortcut_init(bool unjustify) else /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), nano_uncut_msg, + add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg), FALSE, NOVIEW); #ifndef NANO_TINY - add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), nano_cursorpos_msg, + add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), FALSE, VIEW); #endif @@ -761,20 +743,20 @@ void shortcut_init(bool unjustify) add_to_funcs(do_last_line, (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP), - last_line_msg, nano_lastline_msg, TRUE, VIEW); + last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW); add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS), - go_to_line_msg, nano_gotoline_msg, FALSE, VIEW); + go_to_line_msg, IFSCHELP(nano_gotoline_msg), FALSE, VIEW); /* TRANSLATORS: Try to keep this at most 10 characters. */ #ifdef NANO_TINY - add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), nano_cursorpos_msg, + add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), FALSE, VIEW); #endif - add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, nano_replace_msg, + add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, IFSCHELP(nano_replace_msg), #ifndef NANO_TINY FALSE, @@ -803,16 +785,16 @@ void shortcut_init(bool unjustify) #endif add_to_funcs(do_page_up, MBROWSER, - prev_page_msg, nano_prevpage_msg, FALSE, VIEW); + prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); add_to_funcs(do_page_down, MBROWSER, - next_page_msg, nano_nextpage_msg, TRUE, VIEW); + next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW); - add_to_funcs(do_right, (MMAIN|MBROWSER), N_("Forward"), nano_forward_msg, + add_to_funcs(do_right, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg), FALSE, VIEW); add_to_funcs(do_right, MALL, "", "", FALSE, VIEW); - add_to_funcs(do_left, (MMAIN|MBROWSER), N_("Back"), nano_back_msg, + add_to_funcs(do_left, (MMAIN|MBROWSER), N_("Back"), IFSCHELP(nano_back_msg), FALSE, VIEW); add_to_funcs(do_left, MALL, "", "", FALSE, VIEW); @@ -825,15 +807,15 @@ void shortcut_init(bool unjustify) #endif add_to_funcs(do_up_void, (MMAIN|MHELP|MBROWSER), N_("Prev Line"), - nano_prevline_msg, FALSE, VIEW); + IFSCHELP(nano_prevline_msg), FALSE, VIEW); add_to_funcs(do_down_void, (MMAIN|MHELP|MBROWSER), N_("Next Line"), - nano_nextline_msg, TRUE, VIEW); + IFSCHELP(nano_nextline_msg), TRUE, VIEW); - add_to_funcs(do_home, MMAIN, N_("Home"), nano_home_msg, + add_to_funcs(do_home, MMAIN, N_("Home"), IFSCHELP(nano_home_msg), FALSE, VIEW); - add_to_funcs(do_end, MMAIN, N_("End"), nano_end_msg, + add_to_funcs(do_end, MMAIN, N_("End"), IFSCHELP(nano_end_msg), FALSE, VIEW); #ifndef DISABLE_JUSTIFY @@ -863,17 +845,17 @@ void shortcut_init(bool unjustify) #endif add_to_funcs(do_verbatim_input, MMAIN, N_("Verbatim Input"), - nano_verbatim_msg, FALSE, NOVIEW); - add_to_funcs(do_tab, MMAIN, N_("Tab"), nano_tab_msg, + IFSCHELP(nano_verbatim_msg), FALSE, NOVIEW); + add_to_funcs(do_tab, MMAIN, N_("Tab"), IFSCHELP(nano_tab_msg), FALSE, NOVIEW); add_to_funcs(do_tab, MALL, "", "", FALSE, NOVIEW); - add_to_funcs(do_enter, MMAIN, N_("Enter"), nano_enter_msg, + add_to_funcs(do_enter, MMAIN, N_("Enter"), IFSCHELP(nano_enter_msg), FALSE, NOVIEW); add_to_funcs(do_enter, MALL, "", "", FALSE, NOVIEW); - add_to_funcs(do_delete, MMAIN, N_("Delete"), nano_delete_msg, + add_to_funcs(do_delete, MMAIN, N_("Delete"), IFSCHELP(nano_delete_msg), FALSE, NOVIEW); add_to_funcs(do_delete, MALL, "", "", FALSE, NOVIEW); - add_to_funcs(do_backspace, MMAIN, N_("Backspace"), nano_backspace_msg, + add_to_funcs(do_backspace, MMAIN, N_("Backspace"), IFSCHELP(nano_backspace_msg), #ifndef NANO_TINY FALSE, #else @@ -907,13 +889,11 @@ void shortcut_init(bool unjustify) nano_wordcount_msg, FALSE, VIEW); #endif - add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, refresh_msg, -#ifndef NANO_TINY - TRUE, -#else - FALSE, -#endif - VIEW); + add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, + IFSCHELP(nano_refresh_msg), FALSE, VIEW); + + add_to_funcs(do_suspend_void, MMAIN, suspend_msg, + IFSCHELP(nano_suspend_msg), TRUE, VIEW); #ifndef NANO_TINY add_to_funcs((void *) case_sens_msg, @@ -928,7 +908,7 @@ void shortcut_init(bool unjustify) #ifdef HAVE_REGEX_H add_to_funcs((void *) regexp_msg, (MWHEREIS|MREPLACE|MWHEREISFILE), - regexp_msg, nano_regexp_msg, FALSE, VIEW); + regexp_msg, IFSCHELP(nano_regexp_msg), FALSE, VIEW); #endif #ifndef NANO_TINY @@ -942,10 +922,10 @@ void shortcut_init(bool unjustify) #endif add_to_funcs((void *) no_replace_msg, MREPLACE, - no_replace_msg, nano_whereis_msg, FALSE, VIEW); + no_replace_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); add_to_funcs((void *) gototext_msg, MGOTOLINE, - gototext_msg, nano_whereis_msg, FALSE, VIEW); + gototext_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); #ifndef DISABLE_BROWSER if (!ISSET(RESTRICTED)) @@ -998,7 +978,7 @@ void shortcut_init(bool unjustify) #endif add_to_funcs((void *) insert_file_msg, MEXTCMD, - insert_file_msg, nano_insert_msg, FALSE, VIEW); + insert_file_msg, IFSCHELP(nano_insert_msg), FALSE, VIEW); #ifdef ENABLE_MULTIBUFFER add_to_funcs((void *) new_buffer_msg, MEXTCMD, @@ -1108,11 +1088,6 @@ void shortcut_init(bool unjustify) add_to_sclist(MALL, "M-)", do_para_end_void, 0, TRUE); add_to_sclist(MALL, "M-0", do_para_end_void, 0, TRUE); #endif - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "^Y", do_first_line, 0, TRUE); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "^V", do_last_line, 0, TRUE); - add_to_sclist(MWHEREIS, "M-C", (void *) case_sens_msg, 0, FALSE); add_to_sclist(MREPLACE, @@ -1128,6 +1103,11 @@ void shortcut_init(bool unjustify) add_to_sclist(MMAIN, "M-|", do_first_line, 0, TRUE); add_to_sclist(MMAIN, "M-/", do_last_line, 0, TRUE); add_to_sclist(MMAIN, "M-?", do_last_line, 0, TRUE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP, + "^Y", do_first_line, 0, TRUE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP, + "^V", do_last_line, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", (void *) first_file_msg, 0, TRUE); add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", (void *) first_file_msg, 0, TRUE); add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", (void *) last_file_msg, 0, TRUE); @@ -1187,6 +1167,7 @@ void shortcut_init(bool unjustify) add_to_sclist(MWRITEFILE, "^T", (void *) to_files_msg, 0, FALSE); add_to_sclist(MINSERTFILE, "^T", (void *) to_files_msg, 0, FALSE); add_to_sclist(MINSERTFILE, "^X", (void *) ext_cmd_msg, 0, FALSE); + add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE); add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE); #ifdef DEBUG @@ -1332,6 +1313,8 @@ sc *strtosc(int menu, char *input) s->scfunc = do_scroll_down; else if (!strcasecmp(input, "nextword")) s->scfunc = do_next_word_void; + else if (!strcasecmp(input, "suspend")) + s->scfunc = do_suspend_void; else if (!strcasecmp(input, "prevword")) s->scfunc = do_prev_word_void; else if (!strcasecmp(input, "findbracket")) @@ -1405,7 +1388,7 @@ sc *strtosc(int menu, char *input) s->scfunc = (void *) do_toggle; s->execute = FALSE; s->toggle = NO_CONVERT; - } else if (!strcasecmp(input, "suspend")) { + } else if (!strcasecmp(input, "suspendenable")) { s->scfunc = (void *) do_toggle; s->execute = FALSE; s->toggle = SUSPEND; diff --git a/src/nano.c b/src/nano.c index 38af9b2b..010c721b 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1089,6 +1089,13 @@ RETSIGTYPE do_suspend(int signal) kill(0, SIGSTOP); } +/* the subnfunc version */ +void do_suspend_void(void) +{ + if (ISSET(SUSPEND)) + do_suspend(0); +} + /* Handler for SIGCONT (continue after suspend). */ RETSIGTYPE do_continue(int signal) { @@ -1401,7 +1408,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool /* If we got a shortcut from the main list, or a "universal" * edit window shortcut, set have_shortcut to TRUE. */ - have_shortcut = (s != NULL || input == NANO_SUSPEND_KEY); + have_shortcut = (s != NULL); /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ @@ -1469,11 +1476,6 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool if (have_shortcut) { switch (input) { - /* Handle the "universal" edit window shortcuts. */ - case NANO_SUSPEND_KEY: - if (ISSET(SUSPEND)) - do_suspend(0); - break; /* Handle the normal edit window shortcuts, setting * ran_func to TRUE if we try to run their associated * functions and setting finished to TRUE to indicate diff --git a/src/prompt.c b/src/prompt.c index 554a6677..f214f795 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -1069,6 +1069,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer } } else #endif /* !NANO_TINY */ +#ifndef DISABLE_HELP if (s && s->scfunc == do_help_void) { update_statusbar_line(answer, statusbar_x); @@ -1080,6 +1081,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer * prompt. */ finished = FALSE; } +#endif /* If we have a shortcut with an associated function, break out * if we're finished after running or trying to run the @@ -1336,8 +1338,9 @@ int do_yesno_prompt(bool all, const char *msg) if (ok == 2 && !all) ok = -2; } + } #endif /* !DISABLE_MOUSE */ - } else if (s && s->scfunc == total_refresh) { + else if (s && s->scfunc == total_refresh) { total_redraw(); continue; } else { diff --git a/src/proto.h b/src/proto.h index eafff725..27ea8abd 100644 --- a/src/proto.h +++ b/src/proto.h @@ -780,7 +780,7 @@ void assign_keyinfo(sc *s); void xon_complaint(void); void xoff_complaint(void); int sc_seq_or (void *func, int defaultval); - +void do_suspend_void(void); const char *cancel_msg; #ifndef NANO_TINY diff --git a/src/search.c b/src/search.c index 29f3c68c..e7e52cdd 100644 --- a/src/search.c +++ b/src/search.c @@ -984,6 +984,9 @@ void do_replace(void) void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, bool interactive, bool save_pos, bool allow_update) { + bool meta_key, func_key; + const sc *s; + if (interactive) { char *ans = mallocstrcpy(NULL, answer); @@ -1007,7 +1010,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, return; } - if (i == NANO_TOOTHERWHEREIS_KEY) { + + s = get_shortcut(currmenu, &i, &meta_key, &func_key); + if (s && s->scfunc == do_search) { /* Keep answer up on the statusbar. */ search_init(TRUE, TRUE); diff --git a/src/text.c b/src/text.c index d152a97f..b544ad02 100644 --- a/src/text.c +++ b/src/text.c @@ -1366,6 +1366,7 @@ void do_justify(bool full_justify) int kbinput; bool meta_key, func_key, s_or_t, ran_func, finished; + const sc *s; /* Move to the beginning of the current line, so that justifying at * the end of the last line of the file, if that line isn't blank, @@ -1681,8 +1682,9 @@ void do_justify(bool full_justify) * the keystroke and return. */ kbinput = do_input(&meta_key, &func_key, &s_or_t, &ran_func, &finished, FALSE); + s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); - if (s_or_t && kbinput == NANO_UNJUSTIFY_KEY) { + if (s && s->scfunc == do_uncut_text) { /* Splice the justify buffer back into the file, but only if we * actually justified something. */ if (first_par_line != NULL) { diff --git a/src/winio.c b/src/winio.c index 98882774..5b4f1341 100644 --- a/src/winio.c +++ b/src/winio.c @@ -597,13 +597,13 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) #ifdef KEY_SSUSPEND /* Slang doesn't support KEY_SSUSPEND. */ case KEY_SSUSPEND: - retval = NANO_SUSPEND_KEY; + retval = sc_seq_or(do_suspend_void, 0); break; #endif #ifdef KEY_SUSPEND /* Slang doesn't support KEY_SUSPEND. */ case KEY_SUSPEND: - retval = NANO_SUSPEND_KEY; + retval = sc_seq_or(do_suspend_void, 0); break; #endif #ifdef PDCURSES @@ -1786,30 +1786,6 @@ const sc *get_shortcut(int menu, int *kbinput, bool return NULL; } -#ifndef NANO_TINY -/* Return the global toggle corresponding to the values of kbinput (the - * key itself) and meta_key (whether the key is a meta sequence), if - * any. */ -const toggle *get_toggle(int kbinput, bool meta_key) -{ - const toggle *t = toggles; - -#ifdef DEBUG - fprintf(stderr, "get_toggle(): kbinput = %d, meta_key = %s\n", kbinput, meta_key ? "TRUE" : "FALSE"); -#endif - - /* Check for toggles. */ - for (; t != NULL; t = t->next) { - /* We've found a toggle if the key exists, meta_key is TRUE, and - * the key is in the meta key toggle list. */ - if (t->val != TOGGLE_NO_KEY && meta_key && kbinput == t->val) - break; - } - - return t; -} -#endif /* !NANO_TINY */ - /* Move to (x, y) in win, and display a line of n spaces with the * current attributes. */ void blank_line(WINDOW *win, int y, int x, int n) @@ -2356,7 +2332,7 @@ void bottombars(int menu) if ((f->menus & menu) == 0) continue; - if (strlen(f->desc) == 0) + if (!f->desc || strlen(f->desc) == 0) continue; #ifdef DEBUG