From 637daa85c5694c95f4816e87acfc524360ee2c3d Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Mon, 7 Feb 2011 14:45:56 +0000 Subject: [PATCH] * src/*: Retire iso_me_harder_funcmap based on suggestion by This does add 20KB to nano's executable size but it gets rid of a lot of indirection that makes people stomach turn. There are several new stub functions and need of more tidying as a result of this. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4527 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 6 +- src/browser.c | 54 ++-- src/files.c | 20 +- src/global.c | 810 +++++++++++++++++++++++--------------------------- src/help.c | 26 +- src/nano.c | 24 +- src/nano.h | 164 +--------- src/prompt.c | 56 ++-- src/proto.h | 27 +- src/rcfile.c | 2 +- src/search.c | 27 +- src/text.c | 21 +- src/winio.c | 108 +++---- 13 files changed, 584 insertions(+), 761 deletions(-) diff --git a/ChangeLog b/ChangeLog index daf4aa2e..a02e388a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-02-06 Chris Allegretta - * files.c (write_file) - Fix problems with writing the backup file (albeit interactively) + * src/*: Retire iso_me_harder_funcmap based on suggestion by + This does add 20KB to nano's executable size but it gets rid of a lot of indirection + that makes people stomach turn. There are several new stub functions and need of more + tidying as a result of this. + * files.c (write_file): Fix problems with writing the backup file (albeit interactively) with new function prompt_failed_backupwrite(), allows more secure handling of problems with failing to write the backup file compared to 'allow_insecure_backup'. * winio.c (edit_redraw): Removed unused variable diff --git a/src/browser.c b/src/browser.c index 029aad70..123e3137 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(sc_seq_or(DO_ENTER, 0), FALSE, FALSE); + unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE); } } #endif /* !DISABLE_MOUSE */ @@ -169,9 +169,9 @@ char *do_browser(char *path, DIR *dir) if (!f) break; - if (f->scfunc == TOTAL_REFRESH) { + if (f->scfunc == total_refresh) { total_redraw(); - } else if (f->scfunc == DO_HELP_VOID) { + } else if (f->scfunc == do_help_void) { #ifndef DISABLE_HELP do_browser_help(); curs_set(0); @@ -179,33 +179,33 @@ char *do_browser(char *path, DIR *dir) nano_disabled_msg(); #endif /* Search for a filename. */ - } else if (f->scfunc == DO_SEARCH) { + } else if (f->scfunc == do_search) { curs_set(1); do_filesearch(); curs_set(0); /* Search for another filename. */ - } else if (f->scfunc == DO_RESEARCH) { + } else if (f->scfunc == do_research) { do_fileresearch(); - } else if (f->scfunc == DO_PAGE_UP) { + } else if (f->scfunc == do_page_up) { if (selected >= (editwinrows + fileline % editwinrows) * width) selected -= (editwinrows + fileline % editwinrows) * width; else selected = 0; - } else if (f->scfunc == DO_PAGE_DOWN) { + } else if (f->scfunc == do_page_down) { selected += (editwinrows - fileline % editwinrows) * width; if (selected > filelist_len - 1) selected = filelist_len - 1; - } else if (f->scfunc == FIRST_FILE_MSG) { + } else if (f->scfunc == do_first_file) { if (meta_key) selected = 0; - } else if (f->scfunc == LAST_FILE_MSG) { + } else if (f->scfunc == do_last_file) { if (meta_key) selected = filelist_len - 1; /* Go to a specific directory. */ - } else if (f->scfunc == GOTO_DIR_MSG) { + } else if (f->scfunc == goto_dir_void) { curs_set(1); i = do_prompt(TRUE, @@ -238,7 +238,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(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE); + unget_kbinput(sc_seq_or(do_gotolinecolumn_void, 0), FALSE, FALSE); ans = mallocstrcpy(ans, answer); continue; } @@ -285,19 +285,19 @@ char *do_browser(char *path, DIR *dir) free(path); path = new_path; goto change_browser_directory; - } else if (f->scfunc == DO_UP_VOID) { + } else if (f->scfunc == do_up_void) { if (selected >= width) selected -= width; - } else if (f->scfunc == DO_LEFT) { + } else if (f->scfunc == do_left) { if (selected > 0) selected--; - } else if (f->scfunc == DO_DOWN_VOID) { + } else if (f->scfunc == do_down_void) { if (selected + width <= filelist_len - 1) selected += width; - } else if (f->scfunc == DO_RIGHT) { + } else if (f->scfunc == do_right) { if (selected < filelist_len - 1) selected++; - } else if (f->scfunc == DO_ENTER) { + } else if (f->scfunc == do_enter_void) { /* We can't move up from "/". */ if (strcmp(filelist[selected], "/..") == 0) { statusbar(_("Can't move up a directory")); @@ -355,7 +355,7 @@ char *do_browser(char *path, DIR *dir) /* Start over again with the new path value. */ goto change_browser_directory; /* Abort the file browser. */ - } else if (f->scfunc == DO_EXIT) { + } else if (f->scfunc == do_exit) { abort = TRUE; } } @@ -552,32 +552,32 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key) if (!*meta_key) { switch (*kbinput) { case ' ': - *kbinput = sc_seq_or(DO_PAGE_DOWN, 0); + *kbinput = sc_seq_or(do_page_down, 0); break; case '-': - *kbinput = sc_seq_or(DO_PAGE_UP, 0); + *kbinput = sc_seq_or(do_page_up, 0); break; case '?': #ifndef DISABLE_HELP - *kbinput = sc_seq_or(DO_HELP_VOID, 0); + *kbinput = sc_seq_or(do_help_void, 0); #endif break; /* Cancel equivalent to Exit here. */ case 'E': case 'e': - *kbinput = sc_seq_or(DO_EXIT, 0); + *kbinput = sc_seq_or(do_exit, 0); break; case 'G': case 'g': - *kbinput = sc_seq_or(GOTO_DIR_MSG, 0); + *kbinput = sc_seq_or(goto_dir_void, 0); break; case 'S': case 's': - *kbinput = sc_seq_or(DO_ENTER, 0); + *kbinput = sc_seq_or(do_enter_void, 0); break; case 'W': case 'w': - *kbinput = sc_seq_or(DO_SEARCH, 0); + *kbinput = sc_seq_or(do_search, 0); break; } } @@ -841,18 +841,18 @@ int filesearch_init(void) #endif } else #ifndef NANO_TINY - if (s && s->scfunc == CASE_SENS_MSG) { + if (s && s->scfunc == case_sens_void) { TOGGLE(CASE_SENSITIVE); backupstring = mallocstrcpy(backupstring, answer); return 1; - } else if (s && s->scfunc == BACKWARDS_MSG) { + } else if (s && s->scfunc == backwards_void) { TOGGLE(BACKWARDS_SEARCH); backupstring = mallocstrcpy(backupstring, answer); return 1; } else #endif #ifdef HAVE_REGEX_H - if (s && s->scfunc == REGEXP_MSG) { + if (s && s->scfunc == regexp_void) { TOGGLE(USE_REGEXP); backupstring = mallocstrcpy(backupstring, answer); return 1; diff --git a/src/files.c b/src/files.c index c89520ab..5c93e35b 100644 --- a/src/files.c +++ b/src/files.c @@ -869,14 +869,14 @@ void do_insertfile( #ifndef NANO_TINY #ifdef ENABLE_MULTIBUFFER - if (s && s->scfunc == NEW_BUFFER_MSG) { + if (s && s->scfunc == new_buffer_void) { /* Don't allow toggling if we're in view mode. */ if (!ISSET(VIEW_MODE)) TOGGLE(MULTIBUFFER); continue; } else #endif - if (s && s->scfunc == EXT_CMD_MSG) { + if (s && s->scfunc == ext_cmd_void) { execute = !execute; continue; } @@ -886,7 +886,7 @@ void do_insertfile( #endif /* !NANO_TINY */ #ifndef DISABLE_BROWSER - if (s && s->scfunc == TO_FILES_MSG) { + if (s && s->scfunc == to_files_void) { char *tmp = do_browse_from(answer); if (tmp == NULL) @@ -2079,7 +2079,7 @@ bool do_writeout(bool exiting) s = get_shortcut(currmenu, &i, &meta_key, &func_key); #ifndef DISABLE_BROWSER - if (s && s->scfunc == TO_FILES_MSG) { + if (s && s->scfunc == to_files_void) { char *tmp = do_browse_from(answer); if (tmp == NULL) @@ -2091,26 +2091,26 @@ bool do_writeout(bool exiting) } else #endif /* !DISABLE_BROWSER */ #ifndef NANO_TINY - if (s && s->scfunc == DOS_FORMAT_MSG) { + if (s && s->scfunc == dos_format_void) { openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE : DOS_FILE; continue; - } else if (s && s->scfunc == MAC_FORMAT_MSG) { + } else if (s && s->scfunc == mac_format_void) { openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE; continue; - } else if (s && s->scfunc == BACKUP_FILE_MSG) { + } else if (s && s->scfunc == backup_file_void) { TOGGLE(BACKUP_FILE); continue; } else #endif /* !NANO_TINY */ - if (s && s->scfunc == PREPEND_MSG) { + if (s && s->scfunc == prepend_void) { append = (append == PREPEND) ? OVERWRITE : PREPEND; continue; - } else if (s && s->scfunc == APPEND_MSG) { + } else if (s && s->scfunc == append_void) { append = (append == APPEND) ? OVERWRITE : APPEND; continue; - } else if (s && s->scfunc == DO_HELP_VOID) { + } else if (s && s->scfunc == do_help_void) { continue; } diff --git a/src/global.c b/src/global.c index 7958864c..6ce998b4 100644 --- a/src/global.c +++ b/src/global.c @@ -152,7 +152,7 @@ char *syntaxstr = NULL; #endif -bool edit_refresh_needed = NULL; +bool edit_refresh_needed = 0; /* Did a command mangle enough of the buffer refresh that we should repaint the screen */ @@ -213,6 +213,50 @@ size_t length_of_list(int menu) return i; } +/* Just throw this here */ +void case_sens_void(void) +{ +} +void regexp_void(void) +{ +} +void gototext_void(void) +{ +} +void to_files_void(void) +{ +} +void dos_format_void(void) +{ +} +void mac_format_void(void) +{ +} +void append_void(void) +{ +} +void prepend_void(void) +{ +} +void backup_file_void(void) +{ +} +void new_buffer_void(void) +{ +} +void backwards_void(void) +{ +} +void goto_dir_void(void) +{ +} +void no_replace_void(void) +{ +} +void ext_cmd_void(void) +{ +} + /* Set type of function based on the string */ function_type strtokeytype(const char *str) { @@ -228,7 +272,7 @@ function_type strtokeytype(const char *str) /* Add a string to the new function list strict. Does not allow updates, yet anyway */ -void add_to_funcs(short func, int menus, const char *desc, const char *help, +void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help, bool blank_after, bool viewok) { subnfunc *f; @@ -257,7 +301,7 @@ void add_to_funcs(short func, int menus, const char *desc, const char *help, #endif } -const sc *first_sc_for(int menu, short func) { +const sc *first_sc_for(int menu, void (*func)(void)) { const sc *s; const sc *metasc = NULL; @@ -289,7 +333,7 @@ const sc *first_sc_for(int menu, short func) { /* Add a string to the new shortcut list implementation Allows updates to existing entries in the list */ -void add_to_sclist(int menu, const char *scstring, short func, int toggle, int execute) +void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle, int execute) { sc *s; @@ -328,7 +372,7 @@ void add_to_sclist(int menu, const char *scstring, short func, int toggle, int e /* Return the given menu's first shortcut sequence, or the default value (2nd arg). Assumes currmenu for the menu to check*/ -int sc_seq_or (short func, int defaultval) +int sc_seq_or (void (*func)(void), int defaultval) { const sc *s = first_sc_for(currmenu, func); @@ -656,15 +700,15 @@ void shortcut_init(bool unjustify) free(f); } - add_to_funcs(DO_HELP_VOID, + add_to_funcs(do_help_void, (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR), get_help_msg, IFSCHELP(nano_help_msg), FALSE, VIEW); - add_to_funcs( CANCEL_MSG, + add_to_funcs( do_cancel, (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW); - add_to_funcs(DO_EXIT, MMAIN, + 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") : @@ -672,16 +716,16 @@ void shortcut_init(bool unjustify) exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); #ifndef DISABLE_BROWSER - add_to_funcs(DO_EXIT, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW); + add_to_funcs(do_exit, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW); #endif /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_WRITEOUT_VOID, MMAIN, N_("WriteOut"), + add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"), IFSCHELP(nano_writeout_msg), FALSE, NOVIEW); #ifndef DISABLE_JUSTIFY /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_JUSTIFY_VOID, MMAIN, N_("Justify"), + add_to_funcs(do_justify_void, MMAIN, N_("Justify"), nano_justify_msg, TRUE, NOVIEW); #endif @@ -691,7 +735,7 @@ void shortcut_init(bool unjustify) * reading from or writing to files not specified on the command * line. */ - add_to_funcs(DO_INSERTFILE_VOID, + add_to_funcs(do_insertfile_void, /* TRANSLATORS: Try to keep this at most 10 characters. */ MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE, #ifdef ENABLE_MULTIBUFFER @@ -700,32 +744,32 @@ void shortcut_init(bool unjustify) NOVIEW); #endif - add_to_funcs(DO_SEARCH, MMAIN|MBROWSER, whereis_msg, + add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); - add_to_funcs(DO_PAGE_UP, MMAIN|MHELP|MBROWSER, + add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER, prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); - add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP|MBROWSER, + add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER, 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"), IFSCHELP(nano_cut_msg), + add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg), FALSE, NOVIEW); if (unjustify) /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_UNCUT_TEXT, MMAIN, N_("UnJustify"), "", + add_to_funcs(do_uncut_text, MMAIN, N_("UnJustify"), "", FALSE, NOVIEW); else /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_UNCUT_TEXT, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg), + add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg), FALSE, NOVIEW); #ifndef NANO_TINY /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_CURSORPOS_VOID, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), + add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), FALSE, VIEW); #endif @@ -734,30 +778,30 @@ void shortcut_init(bool unjustify) * on the command line. */ #ifndef DISABLE_SPELLER /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_SPELL, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg), + add_to_funcs(do_spell, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg), TRUE, NOVIEW); #endif - add_to_funcs(DO_FIRST_LINE, + add_to_funcs(do_first_line, (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE), first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW); - add_to_funcs(DO_LAST_LINE, + add_to_funcs(do_last_line, (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE), last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW); - add_to_funcs(DO_GOTOLINECOLUMN_VOID, (MMAIN|MWHEREIS), + add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS), go_to_line_msg, IFSCHELP(nano_gotoline_msg), FALSE, VIEW); #ifdef NANO_TINY /* TRANSLATORS: Try to keep this at most 10 characters. */ - add_to_funcs(DO_CURSORPOS_VOID, MMAIN, N_("Cur Pos"), IFSCHELP(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, IFSCHELP(nano_replace_msg), + add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, IFSCHELP(nano_replace_msg), #ifndef NANO_TINY FALSE, @@ -768,112 +812,112 @@ void shortcut_init(bool unjustify) #ifndef NANO_TINY - add_to_funcs(DO_MARK, MMAIN, N_("Mark Text"), + add_to_funcs(do_mark, MMAIN, N_("Mark Text"), IFSCHELP(nano_mark_msg), FALSE, VIEW); - add_to_funcs(DO_RESEARCH, (MMAIN|MBROWSER), whereis_next_msg, + add_to_funcs(do_research, (MMAIN|MBROWSER), whereis_next_msg, IFSCHELP(nano_whereis_next_msg), TRUE, VIEW); - add_to_funcs(DO_COPY_TEXT, MMAIN, N_("Copy Text"), + add_to_funcs(do_copy_text, MMAIN, N_("Copy Text"), IFSCHELP(nano_copy_msg), FALSE, NOVIEW); - add_to_funcs(DO_INDENT_VOID, MMAIN, N_("Indent Text"), + add_to_funcs(do_indent_void, MMAIN, N_("Indent Text"), IFSCHELP(nano_indent_msg), FALSE, NOVIEW); - add_to_funcs(DO_UNINDENT, MMAIN, N_("Unindent Text"), + add_to_funcs(do_unindent, MMAIN, N_("Unindent Text"), IFSCHELP(nano_unindent_msg), FALSE, NOVIEW); if (ISSET(UNDOABLE)) { - add_to_funcs(DO_UNDO, MMAIN, N_("Undo"), + add_to_funcs(do_undo, MMAIN, N_("Undo"), IFSCHELP(nano_undo_msg), FALSE, NOVIEW); - add_to_funcs(DO_REDO, MMAIN, N_("Redo"), + add_to_funcs(do_redo, MMAIN, N_("Redo"), IFSCHELP(nano_redo_msg), TRUE, NOVIEW); } #endif - add_to_funcs(DO_RIGHT, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg), + add_to_funcs(do_right, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg), FALSE, VIEW); #ifndef DISABLE_BROWSER - add_to_funcs(DO_RIGHT, MBROWSER, N_("Forward"), IFSCHELP(nano_forwardfile_msg), + add_to_funcs(do_right, MBROWSER, N_("Forward"), IFSCHELP(nano_forwardfile_msg), FALSE, VIEW); #endif - add_to_funcs(DO_RIGHT, MALL, "", "", FALSE, VIEW); + add_to_funcs(do_right, MALL, "", "", FALSE, VIEW); - add_to_funcs(DO_LEFT, MMAIN, N_("Back"), IFSCHELP(nano_back_msg), + add_to_funcs(do_left, MMAIN, N_("Back"), IFSCHELP(nano_back_msg), FALSE, VIEW); #ifndef DISABLE_BROWSER - add_to_funcs(DO_LEFT, MBROWSER, N_("Back"), IFSCHELP(nano_backfile_msg), + add_to_funcs(do_left, MBROWSER, N_("Back"), IFSCHELP(nano_backfile_msg), FALSE, VIEW); #endif - add_to_funcs(DO_LEFT, MALL, "", "", FALSE, VIEW); + add_to_funcs(do_left, MALL, "", "", FALSE, VIEW); #ifndef NANO_TINY - add_to_funcs(DO_NEXT_WORD_VOID, MMAIN, N_("Next Word"), + add_to_funcs(do_next_word_void, MMAIN, N_("Next Word"), IFSCHELP(nano_nextword_msg), FALSE, VIEW); - add_to_funcs(DO_PREV_WORD_VOID, MMAIN, N_("Prev Word"), + add_to_funcs(do_prev_word_void, MMAIN, N_("Prev Word"), IFSCHELP(nano_prevword_msg), FALSE, VIEW); #endif - add_to_funcs(DO_UP_VOID, (MMAIN|MHELP|MBROWSER), N_("Prev Line"), + add_to_funcs(do_up_void, (MMAIN|MHELP|MBROWSER), N_("Prev Line"), IFSCHELP(nano_prevline_msg), FALSE, VIEW); - add_to_funcs(DO_DOWN_VOID, (MMAIN|MHELP|MBROWSER), N_("Next Line"), + add_to_funcs(do_down_void, (MMAIN|MHELP|MBROWSER), N_("Next Line"), IFSCHELP(nano_nextline_msg), TRUE, VIEW); - add_to_funcs(DO_HOME, MMAIN, N_("Home"), IFSCHELP(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"), IFSCHELP(nano_end_msg), + add_to_funcs(do_end, MMAIN, N_("End"), IFSCHELP(nano_end_msg), FALSE, VIEW); #ifndef DISABLE_JUSTIFY - add_to_funcs(DO_PARA_BEGIN_VOID, (MMAIN|MWHEREIS), beg_of_par_msg, + add_to_funcs(do_para_begin_void, (MMAIN|MWHEREIS), beg_of_par_msg, IFSCHELP(nano_parabegin_msg), FALSE, VIEW); - add_to_funcs(DO_PARA_END_VOID, (MMAIN|MWHEREIS), end_of_par_msg, + add_to_funcs(do_para_end_void, (MMAIN|MWHEREIS), end_of_par_msg, IFSCHELP(nano_paraend_msg), FALSE, VIEW); #endif #ifndef NANO_TINY - add_to_funcs(DO_FIND_BRACKET, MMAIN, _("Find Other Bracket"), + add_to_funcs(do_find_bracket, MMAIN, _("Find Other Bracket"), IFSCHELP(nano_bracket_msg), FALSE, VIEW); - add_to_funcs(DO_SCROLL_UP, MMAIN, N_("Scroll Up"), + add_to_funcs(do_scroll_up, MMAIN, N_("Scroll Up"), IFSCHELP(nano_scrollup_msg), FALSE, VIEW); - add_to_funcs(DO_SCROLL_DOWN, MMAIN, N_("Scroll Down"), + add_to_funcs(do_scroll_down, MMAIN, N_("Scroll Down"), IFSCHELP(nano_scrolldown_msg), FALSE, VIEW); #endif #ifdef ENABLE_MULTIBUFFER - add_to_funcs(SWITCH_TO_PREV_BUFFER_VOID, MMAIN, _("Previous File"), + add_to_funcs(switch_to_prev_buffer_void, MMAIN, _("Previous File"), IFSCHELP(nano_prevfile_msg), FALSE, VIEW); - add_to_funcs(SWITCH_TO_NEXT_BUFFER_VOID, MMAIN, N_("Next File"), + add_to_funcs(switch_to_next_buffer_void, MMAIN, N_("Next File"), IFSCHELP(nano_nextfile_msg), TRUE, VIEW); #endif - add_to_funcs(DO_VERBATIM_INPUT, MMAIN, N_("Verbatim Input"), + add_to_funcs(do_verbatim_input, MMAIN, N_("Verbatim Input"), IFSCHELP(nano_verbatim_msg), FALSE, NOVIEW); - add_to_funcs(DO_VERBATIM_INPUT, MWHEREIS|MREPLACE|MREPLACE2|MEXTCMD|MSPELL, + add_to_funcs(do_verbatim_input, MWHEREIS|MREPLACE|MREPLACE2|MEXTCMD|MSPELL, "", "", FALSE, NOVIEW); - add_to_funcs(DO_TAB, MMAIN, N_("Tab"), IFSCHELP(nano_tab_msg), + 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"), IFSCHELP(nano_enter_msg), + add_to_funcs(do_tab, MALL, "", "", FALSE, NOVIEW); + add_to_funcs(do_enter_void, 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"), IFSCHELP(nano_delete_msg), + add_to_funcs(do_enter_void, MALL, "", "", FALSE, NOVIEW); + 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"), IFSCHELP(nano_backspace_msg), + add_to_funcs(do_delete, MALL, "", "", FALSE, NOVIEW); + add_to_funcs(do_backspace, MMAIN, N_("Backspace"), IFSCHELP(nano_backspace_msg), #ifndef NANO_TINY FALSE, #else @@ -881,7 +925,7 @@ void shortcut_init(bool unjustify) #endif NOVIEW); - add_to_funcs(DO_BACKSPACE, MALL, "", "", + add_to_funcs(do_backspace, MALL, "", "", #ifndef NANO_TINY FALSE, #else @@ -890,64 +934,64 @@ void shortcut_init(bool unjustify) NOVIEW); #ifndef NANO_TINY - add_to_funcs(DO_CUT_TILL_END, MMAIN, N_("CutTillEnd"), + add_to_funcs(do_cut_till_end, MMAIN, N_("CutTillEnd"), IFSCHELP(nano_cut_till_end_msg), TRUE, NOVIEW); #endif - add_to_funcs(XON_COMPLAINT, MMAIN, "", "", FALSE, VIEW); - add_to_funcs(XOFF_COMPLAINT, MMAIN, "", "", FALSE, VIEW); + add_to_funcs(xon_complaint, MMAIN, "", "", FALSE, VIEW); + add_to_funcs(xoff_complaint, MMAIN, "", "", FALSE, VIEW); #ifndef DISABLE_JUSTIFY - add_to_funcs(DO_FULL_JUSTIFY, (MMAIN|MWHEREIS), fulljstify_msg, + add_to_funcs(do_full_justify, (MMAIN|MWHEREIS), fulljstify_msg, IFSCHELP(nano_fulljustify_msg), FALSE, NOVIEW); #endif #ifndef NANO_TINY - add_to_funcs(DO_WORDLINECHAR_COUNT, MMAIN, N_("Word Count"), + add_to_funcs(do_wordlinechar_count, MMAIN, N_("Word Count"), IFSCHELP(nano_wordcount_msg), FALSE, VIEW); #endif - add_to_funcs(TOTAL_REFRESH, (MMAIN|MHELP), refresh_msg, + add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, IFSCHELP(nano_refresh_msg), FALSE, VIEW); - add_to_funcs(DO_SUSPEND_VOID, MMAIN, suspend_msg, + add_to_funcs(do_suspend_void, MMAIN, suspend_msg, IFSCHELP(nano_suspend_msg), TRUE, VIEW); #ifndef NANO_TINY - add_to_funcs( CASE_SENS_MSG, + add_to_funcs(case_sens_void, (MWHEREIS|MREPLACE|MWHEREISFILE), case_sens_msg, IFSCHELP(nano_case_msg), FALSE, VIEW); - add_to_funcs( BACKWARDS_MSG, + add_to_funcs(backwards_void, (MWHEREIS|MREPLACE|MWHEREISFILE), backwards_msg, IFSCHELP(nano_reverse_msg), FALSE, VIEW); #endif #ifdef HAVE_REGEX_H - add_to_funcs( REGEXP_MSG, + add_to_funcs(regexp_void, (MWHEREIS|MREPLACE|MWHEREISFILE), regexp_msg, IFSCHELP(nano_regexp_msg), FALSE, VIEW); #endif #ifndef NANO_TINY - add_to_funcs( PREV_HISTORY_MSG, + add_to_funcs(get_history_older_void, (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), prev_history_msg, IFSCHELP(nano_prev_history_msg), FALSE, VIEW); - add_to_funcs( NEXT_HISTORY_MSG, + add_to_funcs(get_history_newer_void, (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), next_history_msg, IFSCHELP(nano_next_history_msg), FALSE, VIEW); #endif - add_to_funcs( NO_REPLACE_MSG, MREPLACE, + add_to_funcs(no_replace_void, MREPLACE, no_replace_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); - add_to_funcs( GOTOTEXT_MSG, MGOTOLINE, + add_to_funcs(gototext_void, MGOTOLINE, gototext_msg, IFSCHELP(nano_whereis_msg), TRUE, VIEW); #ifndef DISABLE_BROWSER if (!ISSET(RESTRICTED)) - add_to_funcs( TO_FILES_MSG, + add_to_funcs(to_files_void, (MGOTOLINE|MINSERTFILE), to_files_msg, IFSCHELP(nano_tofiles_msg), FALSE, VIEW); #endif @@ -960,23 +1004,23 @@ void shortcut_init(bool unjustify) * specified on the command line, and the fifth is useless since * backups are disabled. */ if (!ISSET(RESTRICTED)) - add_to_funcs( DOS_FORMAT_MSG, MWRITEFILE, + add_to_funcs(dos_format_void, MWRITEFILE, dos_format_msg, IFSCHELP(nano_dos_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) - add_to_funcs( MAC_FORMAT_MSG, MWRITEFILE, + add_to_funcs(mac_format_void, MWRITEFILE, mac_format_msg, IFSCHELP(nano_mac_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) - add_to_funcs( APPEND_MSG, MWRITEFILE, + add_to_funcs( append_void, MWRITEFILE, append_msg, IFSCHELP(nano_append_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) - add_to_funcs( PREPEND_MSG, MWRITEFILE, + add_to_funcs( prepend_void, MWRITEFILE, prepend_msg, IFSCHELP(nano_prepend_msg), FALSE, NOVIEW); if (!ISSET(RESTRICTED)) - add_to_funcs( BACKUP_FILE_MSG, MWRITEFILE, + add_to_funcs( backup_file_void, MWRITEFILE, backup_file_msg, IFSCHELP(nano_backup_msg), FALSE, NOVIEW); #endif @@ -984,229 +1028,231 @@ void shortcut_init(bool unjustify) /* If we're using restricted mode, command execution is disabled. * It's useless since inserting files is disabled. */ if (!ISSET(RESTRICTED)) - add_to_funcs( EXT_CMD_MSG, MINSERTFILE, + add_to_funcs( ext_cmd_void, MINSERTFILE, ext_cmd_msg, IFSCHELP(nano_execute_msg), FALSE, NOVIEW); #ifdef ENABLE_MULTIBUFFER /* If we're using restricted mode, the multibuffer toggle is * disabled. It's useless since inserting files is disabled. */ if (!ISSET(RESTRICTED)) - add_to_funcs( NEW_BUFFER_MSG, MINSERTFILE, + add_to_funcs( new_buffer_void, MINSERTFILE, new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif - add_to_funcs( INSERT_FILE_MSG, MEXTCMD, + add_to_funcs( do_insertfile_void, MEXTCMD, insert_file_msg, IFSCHELP(nano_insert_msg), FALSE, VIEW); #ifdef ENABLE_MULTIBUFFER - add_to_funcs( NEW_BUFFER_MSG, MEXTCMD, + add_to_funcs( new_buffer_void, MEXTCMD, new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); #endif #endif #ifndef DISABLE_HELP - add_to_funcs( REFRESH_MSG, MHELP, + add_to_funcs(edit_refresh, MHELP, refresh_msg, nano_refresh_msg, FALSE, VIEW); - add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); + add_to_funcs(do_exit, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); #endif #ifndef DISABLE_BROWSER - add_to_funcs( FIRST_FILE_MSG, + add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE), first_file_msg, IFSCHELP(nano_firstfile_msg), FALSE, VIEW); - add_to_funcs( LAST_FILE_MSG, + add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE), last_file_msg, IFSCHELP(nano_lastfile_msg), FALSE, VIEW); - add_to_funcs( GOTO_DIR_MSG, MBROWSER, + add_to_funcs(goto_dir_void, MBROWSER, goto_dir_msg, IFSCHELP(nano_gotodir_msg), FALSE, VIEW); #endif currmenu = MMAIN; add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR, - "^G", DO_HELP_VOID, 0, TRUE); + "^G", do_help_void, 0, TRUE); add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR, - "F1", DO_HELP_VOID, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", DO_EXIT, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", DO_EXIT, 0, TRUE); - add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE); - add_to_sclist(MMAIN, "^O", DO_WRITEOUT_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F3", DO_WRITEOUT_VOID, 0, TRUE); + "F1", do_help_void, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", do_exit, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", do_exit, 0, TRUE); + add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0, TRUE); + add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0, TRUE); + add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0, TRUE); + add_to_sclist(MMAIN, "^O", do_writeout_void, 0, TRUE); + add_to_sclist(MMAIN, "F3", do_writeout_void, 0, TRUE); #ifndef DISABLE_JUSTIFY - add_to_sclist(MMAIN, "^J", DO_JUSTIFY_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F4", DO_JUSTIFY_VOID, 0, TRUE); -#endif - add_to_sclist(MMAIN, "^R", DO_INSERTFILE_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F5", DO_INSERTFILE_VOID, 0, TRUE); - add_to_sclist(MMAIN, "kinsert", DO_INSERTFILE_VOID, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER, "^W", DO_SEARCH, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER, "F6", DO_SEARCH, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^Y", DO_PAGE_UP, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F7", DO_PAGE_UP, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpup", DO_PAGE_UP, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^V", DO_PAGE_DOWN, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F8", DO_PAGE_DOWN, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpdown", DO_PAGE_DOWN, 0, TRUE); - add_to_sclist(MMAIN, "^K", DO_CUT_TEXT_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F9", DO_CUT_TEXT_VOID, 0, TRUE); - add_to_sclist(MMAIN, "^U", DO_UNCUT_TEXT, 0, TRUE); - add_to_sclist(MMAIN, "F10", DO_UNCUT_TEXT, 0, TRUE); - add_to_sclist(MMAIN, "^C", DO_CURSORPOS_VOID, 0, TRUE); - add_to_sclist(MMAIN, "F11", DO_CURSORPOS_VOID, 0, TRUE); + add_to_sclist(MMAIN, "^J", do_justify_void, 0, TRUE); + add_to_sclist(MMAIN, "F4", do_justify_void, 0, TRUE); +#endif + add_to_sclist(MMAIN, "^R", do_insertfile_void, 0, TRUE); + add_to_sclist(MMAIN, "F5", do_insertfile_void, 0, TRUE); + add_to_sclist(MMAIN, "kinsert", do_insertfile_void, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER, "^W", do_search, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER, "F6", do_search, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^Y", do_page_up, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F7", do_page_up, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpup", do_page_up, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^V", do_page_down, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F8", do_page_down, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpdown", do_page_down, 0, TRUE); + add_to_sclist(MMAIN, "^K", do_cut_text_void, 0, TRUE); + add_to_sclist(MMAIN, "F9", do_cut_text_void, 0, TRUE); + add_to_sclist(MMAIN, "^U", do_uncut_text, 0, TRUE); + add_to_sclist(MMAIN, "F10", do_uncut_text, 0, TRUE); + add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0, TRUE); + add_to_sclist(MMAIN, "F11", do_cursorpos_void, 0, TRUE); #ifndef DISABLE_SPELLER - add_to_sclist(MMAIN, "^T", DO_SPELL, 0, TRUE); - add_to_sclist(MMAIN, "F12", DO_SPELL, 0, TRUE); -#endif - add_to_sclist(MMAIN, "^\\", DO_REPLACE, 0, TRUE); - add_to_sclist(MMAIN, "F14", DO_REPLACE, 0, TRUE); - add_to_sclist(MMAIN, "M-R", DO_REPLACE, 0, TRUE); - add_to_sclist(MWHEREIS, "^R", DO_REPLACE, 0, FALSE); - add_to_sclist(MREPLACE, "^R", NO_REPLACE_MSG, 0, FALSE); - add_to_sclist(MWHEREIS, "^T", DO_GOTOLINECOLUMN_VOID, 0, FALSE); + add_to_sclist(MMAIN, "^T", do_spell, 0, TRUE); + add_to_sclist(MMAIN, "F12", do_spell, 0, TRUE); +#endif + add_to_sclist(MMAIN, "^\\", do_replace, 0, TRUE); + add_to_sclist(MMAIN, "F14", do_replace, 0, TRUE); + add_to_sclist(MMAIN, "M-R", do_replace, 0, TRUE); + add_to_sclist(MWHEREIS, "^R", do_replace, 0, FALSE); + add_to_sclist(MREPLACE, "^R", no_replace_void, 0, FALSE); + add_to_sclist(MWHEREIS, "^T", do_gotolinecolumn_void, 0, FALSE); #ifndef NANO_TINY - add_to_sclist(MMAIN, "^^", DO_MARK, 0, TRUE); - add_to_sclist(MMAIN, "F15", DO_MARK, 0, TRUE); - add_to_sclist(MMAIN, "M-A", DO_MARK, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER, "M-W", DO_RESEARCH, 0, TRUE); - add_to_sclist(MMAIN|MBROWSER, "F16", DO_RESEARCH, 0, TRUE); - add_to_sclist(MMAIN, "M-^", DO_COPY_TEXT, 0, TRUE); - add_to_sclist(MMAIN, "M-6", DO_COPY_TEXT, 0, TRUE); - add_to_sclist(MMAIN, "M-}", DO_INDENT_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M-{", DO_UNINDENT, 0, TRUE); + add_to_sclist(MMAIN, "^^", do_mark, 0, TRUE); + add_to_sclist(MMAIN, "F15", do_mark, 0, TRUE); + add_to_sclist(MMAIN, "M-A", do_mark, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER, "M-W", do_research, 0, TRUE); + add_to_sclist(MMAIN|MBROWSER, "F16", do_research, 0, TRUE); + add_to_sclist(MMAIN, "M-^", do_copy_text, 0, TRUE); + add_to_sclist(MMAIN, "M-6", do_copy_text, 0, TRUE); + add_to_sclist(MMAIN, "M-}", do_indent_void, 0, TRUE); + add_to_sclist(MMAIN, "M-{", do_unindent, 0, TRUE); if (ISSET(UNDOABLE)) { - add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE); - add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE); + add_to_sclist(MMAIN, "M-U", do_undo, 0, TRUE); + add_to_sclist(MMAIN, "M-E", do_redo, 0, TRUE); } - add_to_sclist(MALL, "^F", DO_RIGHT, 0, TRUE); - add_to_sclist(MALL, "^B", DO_LEFT, 0, TRUE); - add_to_sclist(MMAIN, "^Space", DO_NEXT_WORD_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M-Space", DO_PREV_WORD_VOID, 0, TRUE); -#endif - add_to_sclist(MALL, "kright", DO_RIGHT, 0, TRUE); - add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE); - add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE); - add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", DO_UP_VOID, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", DO_UP_VOID, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE); - add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE); - add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE); - add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE); - add_to_sclist(MALL, "^E", DO_END, 0, TRUE); - add_to_sclist(MALL, "kend", DO_END, 0, TRUE); + add_to_sclist(MALL, "^F", do_right, 0, TRUE); + add_to_sclist(MALL, "^B", do_left, 0, TRUE); + add_to_sclist(MMAIN, "^Space", do_next_word_void, 0, TRUE); + add_to_sclist(MMAIN, "M-Space", do_prev_word_void, 0, TRUE); +#endif + add_to_sclist(MALL, "kright", do_right, 0, TRUE); + add_to_sclist(MALL, "kleft", do_left, 0, TRUE); + add_to_sclist(MMAIN, "^Q", xon_complaint, 0, TRUE); + add_to_sclist(MMAIN, "^S", xoff_complaint, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", do_up_void, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0, TRUE); + add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", do_down_void, 0, TRUE); + add_to_sclist(MALL, "^A", do_home, 0, TRUE); + add_to_sclist(MALL, "khome", do_home, 0, TRUE); + add_to_sclist(MALL, "^E", do_end, 0, TRUE); + add_to_sclist(MALL, "kend", do_end, 0, TRUE); #ifndef NANO_TINY - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", PREV_HISTORY_MSG, 0, FALSE); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", PREV_HISTORY_MSG, 0, FALSE); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", NEXT_HISTORY_MSG, 0, FALSE); - add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", NEXT_HISTORY_MSG, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", get_history_older_void, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", get_history_older_void, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", get_history_newer_void, 0, FALSE); + add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", get_history_newer_void, 0, FALSE); #endif #ifndef DISABLE_JUSTIFY add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "^W", DO_PARA_BEGIN_VOID, 0, TRUE); + "^W", do_para_begin_void, 0, TRUE); add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "^O", DO_PARA_END_VOID, 0, TRUE); - add_to_sclist(MALL, "M-(", DO_PARA_BEGIN_VOID, 0, TRUE); - add_to_sclist(MALL, "M-9", DO_PARA_BEGIN_VOID, 0, TRUE); - add_to_sclist(MALL, "M-)", DO_PARA_END_VOID, 0, TRUE); - add_to_sclist(MALL, "M-0", DO_PARA_END_VOID, 0, TRUE); + "^O", do_para_end_void, 0, TRUE); + add_to_sclist(MALL, "M-(", do_para_begin_void, 0, TRUE); + add_to_sclist(MALL, "M-9", do_para_begin_void, 0, TRUE); + 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, - "M-C", CASE_SENS_MSG, 0, FALSE); + "M-C", case_sens_void, 0, FALSE); add_to_sclist(MREPLACE, - "M-C", CASE_SENS_MSG, 0, FALSE); + "M-C", case_sens_void, 0, FALSE); add_to_sclist(MREPLACE2, - "M-C", CASE_SENS_MSG, 0, FALSE); + "M-C", case_sens_void, 0, FALSE); add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "M-B", BACKWARDS_MSG, 0, FALSE); + "M-B", backwards_void, 0, FALSE); add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, - "M-R", REGEXP_MSG, 0, FALSE); + "M-R", regexp_void, 0, FALSE); - add_to_sclist(MMAIN, "M-\\", DO_FIRST_LINE, 0, TRUE); - 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(MMAIN, "M-\\", do_first_line, 0, TRUE); + 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); + "^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-\\", FIRST_FILE_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", FIRST_FILE_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", LAST_FILE_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", LAST_FILE_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "^_", GOTO_DIR_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "F13", GOTO_DIR_MSG, 0, TRUE); - add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", GOTO_DIR_MSG, 0, TRUE); + "^V", do_last_line, 0, TRUE); + +#ifndef DISABLE_BROWSER + add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0, TRUE); +#endif + add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0, TRUE); + add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0, TRUE); #ifndef NANO_TINY - add_to_sclist(MMAIN, "M-]", DO_FIND_BRACKET, 0, TRUE); - add_to_sclist(MMAIN, "M--", DO_SCROLL_UP, 0, TRUE); - add_to_sclist(MMAIN, "M-_", DO_SCROLL_UP, 0, TRUE); - add_to_sclist(MMAIN, "M-+", DO_SCROLL_DOWN, 0, TRUE); - add_to_sclist(MMAIN, "M-=", DO_SCROLL_DOWN, 0, TRUE); + add_to_sclist(MMAIN, "M-]", do_find_bracket, 0, TRUE); + add_to_sclist(MMAIN, "M--", do_scroll_up, 0, TRUE); + add_to_sclist(MMAIN, "M-_", do_scroll_up, 0, TRUE); + add_to_sclist(MMAIN, "M-+", do_scroll_down, 0, TRUE); + add_to_sclist(MMAIN, "M-=", do_scroll_down, 0, TRUE); #endif #ifdef ENABLE_MULTIBUFFER - add_to_sclist(MMAIN, "M-<", SWITCH_TO_PREV_BUFFER_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M-,", SWITCH_TO_PREV_BUFFER_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M->", SWITCH_TO_NEXT_BUFFER_VOID, 0, TRUE); - add_to_sclist(MMAIN, "M-.", SWITCH_TO_NEXT_BUFFER_VOID, 0, TRUE); + add_to_sclist(MMAIN, "M-<", switch_to_prev_buffer_void, 0, TRUE); + add_to_sclist(MMAIN, "M-,", switch_to_prev_buffer_void, 0, TRUE); + add_to_sclist(MMAIN, "M->", switch_to_next_buffer_void, 0, TRUE); + add_to_sclist(MMAIN, "M-.", switch_to_next_buffer_void, 0, TRUE); #endif - add_to_sclist(MALL, "M-V", DO_VERBATIM_INPUT, 0, TRUE); + add_to_sclist(MALL, "M-V", do_verbatim_input, 0, TRUE); #ifndef NANO_TINY - add_to_sclist(MALL, "M-T", DO_CUT_TILL_END, 0, TRUE); + add_to_sclist(MALL, "M-T", do_cut_till_end, 0, TRUE); #ifndef DISABLE_JUSTIFY - add_to_sclist(MALL, "M-J", DO_FULL_JUSTIFY, 0, TRUE); -#endif - add_to_sclist(MMAIN, "M-D", DO_WORDLINECHAR_COUNT, 0, TRUE); - add_to_sclist(MMAIN, "M-X", DO_TOGGLE, NO_HELP, TRUE); - add_to_sclist(MMAIN, "M-C", DO_TOGGLE, CONST_UPDATE, TRUE); - add_to_sclist(MMAIN, "M-O", DO_TOGGLE, MORE_SPACE, TRUE); - add_to_sclist(MMAIN, "M-S", DO_TOGGLE, SMOOTH_SCROLL, TRUE); - add_to_sclist(MMAIN, "M-P", DO_TOGGLE, WHITESPACE_DISPLAY, TRUE); - add_to_sclist(MMAIN, "M-Y", DO_TOGGLE, NO_COLOR_SYNTAX, TRUE); - add_to_sclist(MMAIN, "M-H", DO_TOGGLE, SMART_HOME, TRUE); - add_to_sclist(MMAIN, "M-I", DO_TOGGLE, AUTOINDENT, TRUE); - add_to_sclist(MMAIN, "M-K", DO_TOGGLE, CUT_TO_END, TRUE); - add_to_sclist(MMAIN, "M-L", DO_TOGGLE, NO_WRAP, TRUE); - add_to_sclist(MMAIN, "M-Q", DO_TOGGLE, TABS_TO_SPACES, TRUE); - add_to_sclist(MMAIN, "M-B", DO_TOGGLE, BACKUP_FILE, TRUE); - add_to_sclist(MMAIN, "M-F", DO_TOGGLE, MULTIBUFFER, TRUE); - add_to_sclist(MMAIN, "M-M", DO_TOGGLE, USE_MOUSE, TRUE); - add_to_sclist(MMAIN, "M-N", DO_TOGGLE, NO_CONVERT, TRUE); - add_to_sclist(MMAIN, "M-Z", DO_TOGGLE, SUSPEND, TRUE); - add_to_sclist(MMAIN, "M-$", DO_TOGGLE, SOFTWRAP, TRUE); -#endif - add_to_sclist(MGOTOLINE, "^T", GOTOTEXT_MSG, 0, FALSE); - add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", NEW_BUFFER_MSG, 0, FALSE); + add_to_sclist(MALL, "M-J", do_full_justify, 0, TRUE); +#endif + add_to_sclist(MMAIN, "M-D", do_wordlinechar_count, 0, TRUE); + add_to_sclist(MMAIN, "M-X", do_toggle_void, NO_HELP, TRUE); + add_to_sclist(MMAIN, "M-C", do_toggle_void, CONST_UPDATE, TRUE); + add_to_sclist(MMAIN, "M-O", do_toggle_void, MORE_SPACE, TRUE); + add_to_sclist(MMAIN, "M-S", do_toggle_void, SMOOTH_SCROLL, TRUE); + add_to_sclist(MMAIN, "M-P", do_toggle_void, WHITESPACE_DISPLAY, TRUE); + add_to_sclist(MMAIN, "M-Y", do_toggle_void, NO_COLOR_SYNTAX, TRUE); + add_to_sclist(MMAIN, "M-H", do_toggle_void, SMART_HOME, TRUE); + add_to_sclist(MMAIN, "M-I", do_toggle_void, AUTOINDENT, TRUE); + add_to_sclist(MMAIN, "M-K", do_toggle_void, CUT_TO_END, TRUE); + add_to_sclist(MMAIN, "M-L", do_toggle_void, NO_WRAP, TRUE); + add_to_sclist(MMAIN, "M-Q", do_toggle_void, TABS_TO_SPACES, TRUE); + add_to_sclist(MMAIN, "M-B", do_toggle_void, BACKUP_FILE, TRUE); + add_to_sclist(MMAIN, "M-F", do_toggle_void, MULTIBUFFER, TRUE); + add_to_sclist(MMAIN, "M-M", do_toggle_void, USE_MOUSE, TRUE); + add_to_sclist(MMAIN, "M-N", do_toggle_void, NO_CONVERT, TRUE); + add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND, TRUE); + add_to_sclist(MMAIN, "M-$", do_toggle_void, SOFTWRAP, TRUE); +#endif + add_to_sclist(MGOTOLINE, "^T", gototext_void, 0, FALSE); + add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0, FALSE); add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), - "^C", CANCEL_MSG, 0, FALSE); - add_to_sclist(MHELP, "^X", DO_EXIT, 0, TRUE); - add_to_sclist(MHELP, "F2", DO_EXIT, 0, TRUE); - add_to_sclist(MWRITEFILE, "M-D", DOS_FORMAT_MSG, 0, FALSE); - add_to_sclist(MWRITEFILE, "M-M", MAC_FORMAT_MSG, 0, FALSE); - add_to_sclist(MWRITEFILE, "M-A", APPEND_MSG, 0, FALSE); - add_to_sclist(MWRITEFILE, "M-P", PREPEND_MSG, 0, FALSE); - add_to_sclist(MWRITEFILE, "M-B", BACKUP_FILE_MSG, 0, FALSE); - add_to_sclist(MWRITEFILE, "^T", TO_FILES_MSG, 0, FALSE); - add_to_sclist(MINSERTFILE, "^T", TO_FILES_MSG, 0, FALSE); - add_to_sclist(MINSERTFILE, "^X", EXT_CMD_MSG, 0, FALSE); - add_to_sclist(MMAIN, "^Z", DO_SUSPEND_VOID, 0, FALSE); - add_to_sclist(MMAIN, "^L", TOTAL_REFRESH, 0, TRUE); - add_to_sclist(MALL, "^I", DO_TAB, 0, TRUE); - add_to_sclist(MALL, "^M", DO_ENTER, 0, TRUE); - add_to_sclist(MALL, "kenter", DO_ENTER, 0, TRUE); - add_to_sclist(MALL, "^D", DO_DELETE, 0, TRUE); - add_to_sclist(MALL, "kdel", DO_DELETE, 0, TRUE); - add_to_sclist(MALL, "^H", DO_BACKSPACE, 0, TRUE); - add_to_sclist(MALL, "kbsp", DO_BACKSPACE, 0, TRUE); + "^C", do_cancel, 0, FALSE); + add_to_sclist(MHELP, "^X", do_exit, 0, TRUE); + add_to_sclist(MHELP, "F2", do_exit, 0, TRUE); + add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0, FALSE); + add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0, FALSE); + add_to_sclist(MWRITEFILE, "M-A", append_void, 0, FALSE); + add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0, FALSE); + add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0, FALSE); + add_to_sclist(MWRITEFILE, "^T", to_files_void, 0, FALSE); + add_to_sclist(MINSERTFILE, "^T", to_files_void, 0, FALSE); + add_to_sclist(MINSERTFILE, "^X", ext_cmd_void, 0, FALSE); + add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE); + add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE); + add_to_sclist(MALL, "^I", do_tab, 0, TRUE); + add_to_sclist(MALL, "^M", do_enter_void, 0, TRUE); + add_to_sclist(MALL, "kenter", do_enter_void, 0, TRUE); + add_to_sclist(MALL, "^D", do_delete, 0, TRUE); + add_to_sclist(MALL, "kdel", do_delete, 0, TRUE); + add_to_sclist(MALL, "^H", do_backspace, 0, TRUE); + add_to_sclist(MALL, "kbsp", do_backspace, 0, TRUE); #ifdef DEBUG print_sclist(); @@ -1214,127 +1260,6 @@ void shortcut_init(bool unjustify) } -/* Given a function alias, execute the proper - function, and then me */ -void iso_me_harder_funcmap(short func) -{ - if (func == TOTAL_REFRESH) - total_refresh(); - else if (func == DO_HELP_VOID) - do_help_void(); - else if (func == DO_SEARCH) - do_search(); - else if (func == DO_PAGE_UP) - do_page_up(); - else if (func == DO_PAGE_DOWN) - do_page_down(); - else if (func == DO_UP_VOID) - do_up_void(); - else if (func == DO_LEFT) - do_left(); - else if (func == DO_DOWN_VOID) - do_down_void(); - else if (func == DO_RIGHT) - do_right(); - else if (func == DO_ENTER) - do_enter(FALSE); - else if (func == DO_EXIT) - do_exit(); - else if (func == DO_FIRST_LINE) - do_first_line(); - else if (func == DO_LAST_LINE) - do_last_line(); - else if (func == DO_BACKSPACE) - do_backspace(); - else if (func == DO_DELETE) - do_delete(); - else if (func == DO_TAB) - do_tab(); - else if (func == DO_VERBATIM_INPUT) - do_verbatim_input(); -#ifdef ENABLE_MULTIBUFFER - else if (func == SWITCH_TO_NEXT_BUFFER_VOID) - switch_to_next_buffer_void(); - else if (func == SWITCH_TO_PREV_BUFFER_VOID) - switch_to_prev_buffer_void(); -#endif - else if (func == DO_END) - do_end(); - else if (func == DO_HOME) - do_home(); - else if (func == DO_SUSPEND_VOID) - do_suspend_void(); - else if (func == DO_WRITEOUT_VOID) - do_writeout_void(); - else if (func == DO_INSERTFILE_VOID) - do_insertfile_void(); - else if (func == DO_CUT_TEXT_VOID) - do_cut_text_void(); - else if (func == DO_UNCUT_TEXT) - do_uncut_text(); - else if (func == DO_CURSORPOS_VOID) - do_cursorpos_void(); - else if (func == DO_GOTOLINECOLUMN_VOID) - do_gotolinecolumn_void(); - else if (func == DO_REPLACE) - do_replace(); - else if (func == XOFF_COMPLAINT) - xoff_complaint(); - else if (func == XON_COMPLAINT) - xon_complaint(); - else if (func == DO_CUT_TEXT) - do_cut_text_void(); -#ifndef NANO_TINY - else if (func == DO_CUT_TILL_END) - do_cut_till_end(); - else if (func == DO_REDO) - do_redo(); - else if (func == DO_UNDO) - do_undo(); - else if (func == DO_WORDLINECHAR_COUNT) - do_wordlinechar_count(); - else if (func == DO_FIND_BRACKET) - do_find_bracket(); - else if (func == DO_PREV_WORD_VOID) - do_prev_word_void(); -#ifndef DISABLE_JUSTIFY - else if (func == DO_JUSTIFY_VOID) - do_justify_void(); - else if (func == DO_PARA_BEGIN_VOID) - do_para_begin_void(); - else if (func == DO_PARA_END_VOID) - do_para_end_void(); - else if (func == DO_FULL_JUSTIFY) - do_full_justify(); -#endif - else if (func == DO_MARK) - do_mark(); - else if (func == DO_RESEARCH) - do_research(); - else if (func == DO_COPY_TEXT) - do_copy_text(); - else if (func == DO_INDENT_VOID) - do_indent_void(); - else if (func == DO_UNINDENT) - do_unindent(); - else if (func == DO_SCROLL_UP) - do_scroll_up(); - else if (func == DO_SCROLL_DOWN) - do_scroll_down(); - else if (func == DO_NEXT_WORD_VOID) - do_next_word_void(); -#ifndef DISABLE_SPELLER - else if (func == DO_SPELL) - do_spell(); -#endif - else if (func == DO_NEXT_WORD) - do_next_word_void(); - else if (func == DO_PREV_WORD) - do_prev_word_void(); -#endif -} - - /* Free the given shortcut. */ void free_shortcutage(shortcut **shortcutage) { @@ -1415,235 +1340,237 @@ sc *strtosc(int menu, char *input) #ifndef DISABLE_HELP if (!strcasecmp(input, "help")) - s->scfunc = DO_HELP_VOID; - else + s->scfunc = do_help_void; + else #endif if (!strcasecmp(input, "cancel")) { - s->scfunc = CANCEL_MSG; + s->scfunc = do_cancel; s->execute = FALSE; } else if (!strcasecmp(input, "exit")) - s->scfunc = DO_EXIT; + s->scfunc = do_exit; else if (!strcasecmp(input, "writeout")) - s->scfunc = DO_WRITEOUT_VOID; + s->scfunc = do_writeout_void; else if (!strcasecmp(input, "insert")) - s->scfunc = DO_INSERTFILE_VOID; + s->scfunc = do_insertfile_void; else if (!strcasecmp(input, "whereis")) - s->scfunc = DO_SEARCH; + s->scfunc = do_search; else if (!strcasecmp(input, "up")) - s->scfunc = DO_UP_VOID; + s->scfunc = do_up_void; else if (!strcasecmp(input, "down")) - s->scfunc = DO_DOWN_VOID; + s->scfunc = do_down_void; else if (!strcasecmp(input, "pageup") || !strcasecmp(input, "prevpage")) - s->scfunc = DO_PAGE_UP; + s->scfunc = do_page_up; else if (!strcasecmp(input, "pagedown") || !strcasecmp(input, "nextpage")) - s->scfunc = DO_PAGE_DOWN; + s->scfunc = do_page_down; else if (!strcasecmp(input, "cut")) - s->scfunc = DO_CUT_TEXT_VOID; + s->scfunc = do_cut_text_void; else if (!strcasecmp(input, "uncut")) - s->scfunc = DO_UNCUT_TEXT; + s->scfunc = do_uncut_text; else if (!strcasecmp(input, "curpos") || !strcasecmp(input, "cursorpos")) - s->scfunc = DO_CURSORPOS_VOID; + s->scfunc = do_cursorpos_void; else if (!strcasecmp(input, "firstline")) - s->scfunc = DO_FIRST_LINE; + s->scfunc = do_first_line; else if (!strcasecmp(input, "lastline")) - s->scfunc = DO_LAST_LINE; + s->scfunc = do_last_line; else if (!strcasecmp(input, "gotoline")) - s->scfunc = DO_GOTOLINECOLUMN_VOID; + s->scfunc = do_gotolinecolumn_void; else if (!strcasecmp(input, "replace")) - s->scfunc = DO_REPLACE; + s->scfunc = do_replace; #ifndef DISABLE_JUSTIFY else if (!strcasecmp(input, "justify")) - s->scfunc = DO_JUSTIFY_VOID; + s->scfunc = do_justify_void; else if (!strcasecmp(input, "beginpara")) - s->scfunc = DO_PARA_BEGIN_VOID; + s->scfunc = do_para_begin_void; else if (!strcasecmp(input, "endpara")) - s->scfunc = DO_PARA_END_VOID; + s->scfunc = do_para_end_void; else if (!strcasecmp(input, "fulljustify")) - s->scfunc = DO_FULL_JUSTIFY; + s->scfunc = do_full_justify; #endif #ifndef NANO_TINY else if (!strcasecmp(input, "mark")) - s->scfunc = DO_MARK; + s->scfunc = do_mark; else if (!strcasecmp(input, "searchagain") || !strcasecmp(input, "research")) - s->scfunc = DO_RESEARCH; + s->scfunc = do_research; else if (!strcasecmp(input, "copytext")) - s->scfunc = DO_COPY_TEXT; + s->scfunc = do_copy_text; else if (!strcasecmp(input, "indent")) - s->scfunc = DO_INDENT_VOID; + s->scfunc = do_indent_void; else if (!strcasecmp(input, "unindent")) - s->scfunc = DO_UNINDENT; + s->scfunc = do_unindent; else if (!strcasecmp(input, "scrollup")) - s->scfunc = DO_SCROLL_UP; + s->scfunc = do_scroll_up; else if (!strcasecmp(input, "scrolldown")) - s->scfunc = DO_SCROLL_DOWN; + s->scfunc = do_scroll_down; else if (!strcasecmp(input, "nextword")) - s->scfunc = DO_NEXT_WORD_VOID; + s->scfunc = do_next_word_void; else if (!strcasecmp(input, "suspend")) - s->scfunc = DO_SUSPEND_VOID; + s->scfunc = do_suspend_void; else if (!strcasecmp(input, "prevword")) - s->scfunc = DO_PREV_WORD_VOID; + s->scfunc = do_prev_word_void; else if (!strcasecmp(input, "findbracket")) - s->scfunc = DO_FIND_BRACKET; + s->scfunc = do_find_bracket; else if (!strcasecmp(input, "wordcount")) - s->scfunc = DO_WORDLINECHAR_COUNT; + s->scfunc = do_wordlinechar_count; else if (!strcasecmp(input, "undo")) - s->scfunc = DO_UNDO; + s->scfunc = do_undo; else if (!strcasecmp(input, "redo")) - s->scfunc = DO_REDO; + s->scfunc = do_redo; else if (!strcasecmp(input, "prevhistory")) { - s->scfunc = PREV_HISTORY_MSG; + s->scfunc = get_history_older_void; s->execute = FALSE; } else if (!strcasecmp(input, "nexthistory")) { - s->scfunc = NEXT_HISTORY_MSG; + s->scfunc = get_history_newer_void; s->execute = FALSE; } else if (!strcasecmp(input, "nohelp") || !strcasecmp(input, "nohelp")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = NO_HELP; } else if (!strcasecmp(input, "constupdate")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = CONST_UPDATE; } else if (!strcasecmp(input, "morespace")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = MORE_SPACE; } else if (!strcasecmp(input, "smoothscroll")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = SMOOTH_SCROLL; } else if (!strcasecmp(input, "whitespacedisplay")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = WHITESPACE_DISPLAY; } else if (!strcasecmp(input, "nosyntax")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = NO_COLOR_SYNTAX; } else if (!strcasecmp(input, "smarthome")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = SMART_HOME; } else if (!strcasecmp(input, "autoindent")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = AUTOINDENT; } else if (!strcasecmp(input, "cuttoend")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = CUT_TO_END; } else if (!strcasecmp(input, "nowrap")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = NO_WRAP; } else if (!strcasecmp(input, "tabstospaces")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = TABS_TO_SPACES; } else if (!strcasecmp(input, "backupfile")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = BACKUP_FILE; } else if (!strcasecmp(input, "mutlibuffer")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = MULTIBUFFER; } else if (!strcasecmp(input, "mouse")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = USE_MOUSE; } else if (!strcasecmp(input, "noconvert")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = NO_CONVERT; } else if (!strcasecmp(input, "suspendenable")) { - s->scfunc = DO_TOGGLE; + s->scfunc = do_toggle_void; s->execute = FALSE; s->toggle = SUSPEND; } #endif /* NANO_TINY */ else if (!strcasecmp(input, "right") || !strcasecmp(input, "forward")) - s->scfunc = DO_RIGHT; + s->scfunc = do_right; else if (!strcasecmp(input, "left") || !strcasecmp(input, "back")) - s->scfunc = DO_LEFT; + s->scfunc = do_left; else if (!strcasecmp(input, "up") || !strcasecmp(input, "prevline")) - s->scfunc = DO_UP_VOID; + s->scfunc = do_up_void; else if (!strcasecmp(input, "down") || !strcasecmp(input, "nextline")) - s->scfunc = DO_DOWN_VOID; + s->scfunc = do_down_void; else if (!strcasecmp(input, "home")) - s->scfunc = DO_HOME; + s->scfunc = do_home; else if (!strcasecmp(input, "end")) - s->scfunc = DO_END; + s->scfunc = do_end; #ifdef ENABLE_MULTIBUFFER else if (!strcasecmp(input, "prevbuf")) - s->scfunc = SWITCH_TO_PREV_BUFFER_VOID; + s->scfunc = switch_to_prev_buffer_void; else if (!strcasecmp(input, "nextbuf")) - s->scfunc = SWITCH_TO_NEXT_BUFFER_VOID; + s->scfunc = switch_to_next_buffer_void; #endif else if (!strcasecmp(input, "verbatim")) - s->scfunc = DO_VERBATIM_INPUT; + s->scfunc = do_verbatim_input; else if (!strcasecmp(input, "tab")) - s->scfunc = DO_TAB; + s->scfunc = do_tab; else if (!strcasecmp(input, "enter")) - s->scfunc = DO_ENTER; + s->scfunc = do_enter_void; else if (!strcasecmp(input, "delete")) - s->scfunc = DO_DELETE; + s->scfunc = do_delete; else if (!strcasecmp(input, "backspace")) - s->scfunc = DO_BACKSPACE; + s->scfunc = do_backspace; else if (!strcasecmp(input, "refresh")) - s->scfunc = TOTAL_REFRESH; + s->scfunc = total_refresh; else if (!strcasecmp(input, "casesens")) { - s->scfunc = CASE_SENS_MSG; + s->scfunc = case_sens_void; s->execute = FALSE; } else if (!strcasecmp(input, "regexp") || !strcasecmp(input, "regex")) { - s->scfunc = REGEXP_MSG; + s->scfunc = regexp_void; s->execute = FALSE; } else if (!strcasecmp(input, "dontreplace")) { - s->scfunc = NO_REPLACE_MSG; + s->scfunc = no_replace_void; s->execute = FALSE; } else if (!strcasecmp(input, "gototext")) { - s->scfunc = GOTOTEXT_MSG; + s->scfunc = gototext_void; s->execute = FALSE; } else if (!strcasecmp(input, "browser") || !strcasecmp(input, "tofiles")) { - s->scfunc = TO_FILES_MSG; + s->scfunc = to_files_void; s->execute = FALSE; } else if (!strcasecmp(input, "dosformat")) { - s->scfunc = DOS_FORMAT_MSG; + s->scfunc = dos_format_void; s->execute = FALSE; } else if (!strcasecmp(input, "macformat")) { - s->scfunc = MAC_FORMAT_MSG; + s->scfunc = mac_format_void; s->execute = FALSE; } else if (!strcasecmp(input, "append")) { - s->scfunc = APPEND_MSG; + s->scfunc = append_void; s->execute = FALSE; } else if (!strcasecmp(input, "prepend")) { - s->scfunc = PREPEND_MSG; + s->scfunc = prepend_void; s->execute = FALSE; } else if (!strcasecmp(input, "backup")) { - s->scfunc = BACKUP_FILE_MSG; + s->scfunc = backup_file_void; s->execute = FALSE; #ifdef ENABLE_MULTIBUFFER } else if (!strcasecmp(input, "newbuffer")) { - s->scfunc = NEW_BUFFER_MSG; + s->scfunc = new_buffer_void; s->execute = FALSE; #endif +#ifndef DISABLE_BROWSER } else if (!strcasecmp(input, "firstfile")) { - s->scfunc = FIRST_FILE_MSG; + s->scfunc = do_first_file; s->execute = FALSE; } else if (!strcasecmp(input, "lastfile")) { - s->scfunc = LAST_FILE_MSG; + s->scfunc = do_last_file; s->execute = FALSE; +#endif } else { free(s); return NULL; @@ -1796,5 +1723,6 @@ void thanks_for_all_the_fish(void) free(homedir); #endif } + #endif /* DEBUG */ diff --git a/src/help.c b/src/help.c index 950f87d2..d97fb44f 100644 --- a/src/help.c +++ b/src/help.c @@ -145,35 +145,35 @@ void do_help(void (*refresh_func)(void)) if (!f) continue; - if (f->scfunc == TOTAL_REFRESH) { + if (f->scfunc == total_refresh) { total_redraw(); break; - } else if (f->scfunc == DO_PAGE_UP) { + } else if (f->scfunc == do_page_up) { if (line > editwinrows - 2) line -= editwinrows - 2; else line = 0; - } else if (f->scfunc == DO_PAGE_DOWN) { + } else if (f->scfunc == do_page_down) { if (line + (editwinrows - 1) < last_line) line += editwinrows - 2; - } else if (f->scfunc == DO_UP_VOID) { + } else if (f->scfunc == do_up_void) { if (line > 0) line--; - } else if (f->scfunc == DO_DOWN_VOID) { + } else if (f->scfunc == do_down_void) { if (line + (editwinrows - 1) < last_line) line++; - } else if (f->scfunc == DO_FIRST_LINE) { + } else if (f->scfunc == do_first_line) { if (meta_key) line = 0; break; - } else if (f->scfunc == DO_LAST_LINE) { + } else if (f->scfunc == do_last_line) { if (meta_key) { if (line + (editwinrows - 1) < last_line) line = last_line - (editwinrows - 1); } break; /* Abort the help browser. */ - } else if (f->scfunc == DO_EXIT) { + } else if (f->scfunc == do_exit) { abort = TRUE; break; } @@ -407,7 +407,7 @@ void help_init(void) size_t endis_len = strlen(_("enable/disable")); for (s = sclist; s != NULL; s = s->next) - if (s->scfunc == DO_TOGGLE) + if (s->scfunc == do_toggle_void) allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9; } @@ -478,7 +478,7 @@ void help_init(void) /* And the toggles... */ if (currmenu == MMAIN) for (s = sclist; s != NULL; s = s->next) - if (s->scfunc == DO_TOGGLE) + if (s->scfunc == do_toggle_void) ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n", s->keystr, _(flagtostr(s->toggle)), _("enable/disable")); @@ -507,15 +507,15 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key) switch (*kbinput) { /* For consistency with the file browser. */ case ' ': - *kbinput = sc_seq_or(DO_PAGE_UP, 0); + *kbinput = sc_seq_or(do_page_up, 0); break; case '-': - *kbinput = sc_seq_or(DO_PAGE_DOWN, 0);; + *kbinput = sc_seq_or(do_page_down, 0);; break; /* Cancel is equivalent to Exit here. */ case 'E': case 'e': - *kbinput = sc_seq_or(DO_EXIT, 0);; + *kbinput = sc_seq_or(do_exit, 0);; break; } } diff --git a/src/nano.c b/src/nano.c index 9db84603..2bc5e4f1 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1063,7 +1063,11 @@ void do_exit(void) display_main_list(); } - +/* Another placeholder for function mapping */ +void do_cancel(void) +{ + ; +} static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */ static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */ @@ -1386,6 +1390,12 @@ void do_toggle(int flag) statusbar("%s %s", desc, enabled ? _("enabled") : _("disabled")); } + +/* Bleh */ +void do_toggle_void(void) +{ +; +} #endif /* !NANO_TINY */ /* Disable extended input and output processing in our terminal @@ -1581,7 +1591,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool * for verbatim input, turn off prepending of wrapped * text. */ if (have_shortcut && (!have_shortcut || s == NULL || s->scfunc != - DO_VERBATIM_INPUT)) + do_verbatim_input)) wrap_reset(); #endif @@ -1616,10 +1626,10 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool default: /* If the function associated with this shortcut is * cutting or copying text, indicate this. */ - if (s->scfunc == DO_CUT_TEXT_VOID + if (s->scfunc == do_cut_text_void #ifndef NANO_TINY - || s->scfunc == DO_COPY_TEXT || s->scfunc == - DO_CUT_TILL_END + || s->scfunc == do_copy_text || s->scfunc == + do_cut_till_end #endif ) cut_copy = TRUE; @@ -1631,13 +1641,13 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool print_view_warning(); else { #ifndef NANO_TINY - if (s->scfunc == DO_TOGGLE) + if (s->scfunc == do_toggle_void) do_toggle(s->toggle); else { #else { #endif - iso_me_harder_funcmap(s->scfunc); + s->scfunc(); #ifdef ENABLE_COLOR if (f && !f->viewok && openfile->syntax != NULL && openfile->syntax->nmultis > 0) { diff --git a/src/nano.h b/src/nano.h index 0c4d8f85..f2f3e50c 100644 --- a/src/nano.h +++ b/src/nano.h @@ -422,7 +422,7 @@ typedef struct sc { /* The actual sequence to check on the the type is determined */ int menu; /* What list does this apply to */ - short scfunc; + void (*scfunc)(void); /* The function we're going to run */ int toggle; /* If a toggle, what we're toggling */ @@ -434,7 +434,7 @@ typedef struct sc { } sc; typedef struct subnfunc { - short scfunc; + void (*scfunc)(void); /* What function is this */ int menus; /* In what menus does this function applu */ @@ -743,9 +743,9 @@ enum #define TOGGLE_MAC_KEY NANO_META_M /* Extra bits for the undo function */ -#define UNDO_DEL_DEL (1<<0) -#define UNDO_DEL_BACKSPACE (1<<1) -#define UNDO_SPLIT_MADENEW (1<<2) +#define UNdel_del (1<<0) +#define UNdel_backspace (1<<1) +#define UNsplit_madenew (1<<2) /* Since in ISO C you can't pass around function pointers anymore, let's make some integer macros for function names, and then I @@ -754,160 +754,6 @@ enum #endif /* !NANO_TINY */ -#define CASE_SENS_MSG 1 -#define BACKWARDS_MSG 2 -#define REGEXP_MSG 3 -#define WHEREIS_NEXT_MSG 4 -#define FIRST_FILE_MSG 5 -#define LAST_FILE_MSG 6 -#define GOTO_DIR_MSG 7 -#define TOTAL_REFRESH 8 -#define DO_HELP_VOID 9 -#define DO_SEARCH 10 -#define DO_PAGE_UP 11 -#define DO_PAGE_DOWN 12 -#define DO_UP_VOID 13 -#define DO_LEFT 14 -#define DO_DOWN_VOID 15 -#define DO_RIGHT 16 -#define DO_ENTER 17 -#define DO_EXIT 18 -#define NEW_BUFFER_MSG 19 -#define EXT_CMD_MSG 20 -#define TO_FILES_MSG 21 -#define DOS_FORMAT_MSG 23 -#define MAC_FORMAT_MSG 24 -#define BACKUP_FILE_MSG 25 -#define PREPEND_MSG 26 -#define APPEND_MSG 27 -#define DO_FIRST_LINE 28 -#define DO_LAST_LINE 29 -#define DO_TOGGLE 30 -#define GOTOTEXT_MSG 31 -#define NO_REPLACE_MSG 32 -#define DO_BACKSPACE 33 -#define DO_DELETE 34 -#define DO_TAB 35 -#define DO_VERBATIM_INPUT 36 -#define SWITCH_TO_NEXT_BUFFER_VOID 37 -#define SWITCH_TO_PREV_BUFFER_VOID 38 -#define DO_END 39 -#define DO_HOME 40 -#define NEXT_HISTORY_MSG 41 -#define PREV_HISTORY_MSG 42 -#define DO_REDO 43 -#define DO_UNDO 44 -#define DO_WORDLINECHAR_COUNT 45 -#define DO_FIND_BRACKET 46 -#define DO_PREV_WORD_VOID 47 -#define DO_SUSPEND_VOID 48 -#define CANCEL_MSG 49 -#define DO_WRITEOUT_VOID 50 -#define DO_INSERTFILE_VOID 51 -#define DO_CUT_TEXT_VOID 52 -#define DO_UNCUT_TEXT 53 -#define DO_CURSORPOS_VOID 54 -#define DO_GOTOLINECOLUMN_VOID 55 -#define DO_REPLACE 56 -#define DO_JUSTIFY_VOID 57 -#define DO_PARA_BEGIN_VOID 58 -#define DO_PARA_END_VOID 59 -#define DO_FULL_JUSTIFY 60 -#define DO_MARK 61 -#define DO_RESEARCH 62 -#define DO_COPY_TEXT 63 -#define DO_INDENT_VOID 64 -#define DO_UNINDENT 65 -#define DO_SCROLL_UP 66 -#define DO_SCROLL_DOWN 67 -#define DO_NEXT_WORD_VOID 68 -#define DO_CUT_TILL_END 69 -#define NANO_GOTODIR_MSG 70 -#define NANO_LASTFILE_MSG 71 -#define NANO_FIRSTFILE_MSG 72 -#define INSERT_FILE_MSG 73 -#define NANO_MULTIBUFFER_MSG 74 -#define NANO_EXECUTE_MSG 75 -#define NANO_BACKUP_MSG 76 -#define NANO_PREPEND_MSG 77 -#define NANO_APPEND_MSG 78 -#define NANO_MAC_MSG 79 -#define NANO_DOS_MSG 80 -#define NANO_TOFILES_MSG 81 -#define NANO_NEXT_HISTORY_MSG 82 -#define NANO_PREV_HISTORY_MSG 83 -#define NANO_REGEXP_MSG 84 -#define NANO_REVERSE_MSG 85 -#define NANO_CASE_MSG 86 -#define NANO_SUSPEND_MSG 87 -#define SUSPEND_MSG 88 -#define NANO_REFRESH_MSG 89 -#define REFRESH_MSG 90 -#define NANO_WORDCOUNT_MSG 91 -#define NANO_FULLJUSTIFY_MSG 92 -#define FULLJSTIFY_MSG 93 -#define XOFF_COMPLAINT 94 -#define XON_COMPLAINT 95 -#define NANO_CUT_TILL_END_MSG 96 -#define NANO_BACKSPACE_MSG 97 -#define NANO_DELETE_MSG 98 -#define NANO_ENTER_MSG 99 -#define NANO_TAB_MSG 100 -#define NANO_VERBATIM_MSG 101 -#define NANO_NEXTFILE_MSG 102 -#define NANO_PREVFILE_MSG 103 -#define NANO_SCROLLDOWN_MSG 104 -#define NANO_SCROLLUP_MSG 105 -#define NANO_BRACKET_MSG 106 -#define NANO_PARAEND_MSG 107 -#define END_OF_PAR_MSG 108 -#define NANO_PARABEGIN_MSG 109 -#define BEG_OF_PAR_MSG 110 -#define NANO_END_MSG 111 -#define NANO_HOME_MSG 112 -#define NANO_NEXTLINE_MSG 113 -#define NANO_PREVLINE_MSG 114 -#define NANO_PREVWORD_MSG 115 -#define NANO_NEXTWORD_MSG 116 -#define NANO_BACK_MSG 117 -#define NANO_FORWARD_MSG 118 -#define NANO_REDO_MSG 119 -#define NANO_UNDO_MSG 120 -#define NANO_UNINDENT_MSG 121 -#define NANO_INDENT_MSG 122 -#define NANO_COPY_MSG 123 -#define NANO_WHEREIS_NEXT_MSG 124 -#define NANO_MARK_MSG 125 -#define NANO_REPLACE_MSG 126 -#define REPLACE_MSG 127 -#define NANO_GOTOLINE_MSG 128 -#define NANO_LASTLINE_MSG 129 -#define NANO_FIRSTLINE_MSG 130 -#define NANO_SPELL_MSG 131 -#define DO_SPELL 132 -#define NANO_CURSORPOS_MSG 133 -#define NANO_UNCUT_MSG 134 -#define GET_HELP_MSG 135 -#define NANO_HELP_MSG 136 -#define NANO_CANCEL_MSG 137 -#define NANO_EXIT_MSG 138 -#define EXIT_MSG 139 -#define NANO_EXITBROWSER_MSG 140 -#define NANO_WRITEOUT_MSG 141 -#define NANO_DISABLED_MSG 142 -#define NANO_INSERT_MSG 143 -#define WHEREIS_MSG 144 -#define NANO_WHEREIS_MSG 145 -#define NANO_PREVPAGE_MSG 146 -#define NANO_NEXTPAGE_MSG 147 -#define NANO_CUT_MSG 148 -#define DO_CUT_TEXT 149 -#define DO_NEXT_WORD 150 -#define DO_PREV_WORD 151 - - - - #define VIEW TRUE #define NOVIEW FALSE diff --git a/src/prompt.c b/src/prompt.c index 38e89309..082edf20 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -152,38 +152,38 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut, } if (*have_shortcut) { - if (s->scfunc == DO_TAB || s->scfunc == DO_ENTER) + if (s->scfunc == do_tab || s->scfunc == do_enter_void) ; - else if (s->scfunc == TOTAL_REFRESH) + else if (s->scfunc == total_refresh) total_statusbar_refresh(refresh_func); - else if (s->scfunc == DO_CUT_TEXT) { + else if (s->scfunc == do_cut_text_void) { /* If we're using restricted mode, the filename * isn't blank, and we're at the "Write File" * prompt, disable Cut. */ if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' || currmenu != MWRITEFILE) do_statusbar_cut_text(); - } else if (s->scfunc == DO_RIGHT) + } else if (s->scfunc == do_right) do_statusbar_right(); - else if (s->scfunc == DO_LEFT) + else if (s->scfunc == do_left) do_statusbar_left(); #ifndef NANO_TINY - else if (s->scfunc == DO_NEXT_WORD) + else if (s->scfunc == do_next_word_void) do_statusbar_next_word(FALSE); - else if (s->scfunc == DO_PREV_WORD) + else if (s->scfunc == do_prev_word_void) do_statusbar_prev_word(FALSE); #endif - else if (s->scfunc == DO_HOME) + else if (s->scfunc == do_home) do_statusbar_home(); - else if (s->scfunc == DO_END) + else if (s->scfunc == do_end) do_statusbar_end(); #ifndef NANO_TINY - else if (s->scfunc == DO_FIND_BRACKET) + else if (s->scfunc == do_find_bracket) do_statusbar_find_bracket(); #endif - else if (s->scfunc == DO_VERBATIM_INPUT) { + else if (s->scfunc == do_verbatim_input) { /* If we're using restricted mode, the filename * isn't blank, and we're at the "Write File" * prompt, disable verbatim input. */ @@ -201,18 +201,18 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut, * to indicate that we're done. */ if (got_enter) { get_input(NULL, 1); - input = sc_seq_or(DO_ENTER, 0); + input = sc_seq_or(do_enter_void, 0); *finished = TRUE; } } - } else if (s->scfunc == DO_DELETE) { + } else if (s->scfunc == do_delete) { /* If we're using restricted mode, the filename * isn't blank, and we're at the "Write File" * prompt, disable Delete. */ if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' || currmenu != MWRITEFILE) do_statusbar_delete(); - } else if (s->scfunc == DO_BACKSPACE) { + } else if (s->scfunc == do_backspace) { /* If we're using restricted mode, the filename * isn't blank, and we're at the "Write File" * prompt, disable Backspace. */ @@ -230,7 +230,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut, if (s->scfunc != 0 && s->execute == TRUE) { *ran_func = TRUE; if (f && (!ISSET(VIEW_MODE) || (f->viewok))) - iso_me_harder_funcmap(f->scfunc); + f->scfunc(); } *finished = TRUE; } @@ -979,19 +979,19 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe s = get_shortcut(currmenu, &kbinput, meta_key, func_key); if (s) - if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER) + if (s->scfunc == do_cancel || s->scfunc == do_enter_void) break; #ifndef DISABLE_TABCOMP - if (s && s->scfunc != DO_TAB) + if (s && s->scfunc != do_tab) tabbed = FALSE; #endif #ifndef DISABLE_TABCOMP #ifndef NANO_TINY - if (s && s->scfunc == DO_TAB) { + if (s && s->scfunc == do_tab) { if (history_list != NULL) { - if (last_kbinput != sc_seq_or(DO_TAB, NANO_CONTROL_I)) + if (last_kbinput != sc_seq_or(do_tab, NANO_CONTROL_I)) complete_len = strlen(answer); if (complete_len > 0) { @@ -1007,10 +1007,10 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe &statusbar_x, &tabbed, refresh_func, list); update_statusbar_line(answer, statusbar_x); - } else + } else #endif /* !DISABLE_TABCOMP */ #ifndef NANO_TINY - if (s && s->scfunc == PREV_HISTORY_MSG) { + if (s && s->scfunc == get_history_older_void) { if (history_list != NULL) { /* If we're scrolling up at the bottom of the * history list and answer isn't blank, save answer @@ -1038,7 +1038,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe * statusbar prompt. */ finished = FALSE; } - } else if (s && s->scfunc == NEXT_HISTORY_MSG) { + } else if (s && s->scfunc == get_history_newer_void) { if (history_list != NULL) { /* Get the newer search from the history list and * save it in answer. If there is no newer search, @@ -1070,7 +1070,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe } } else #endif /* !NANO_TINY */ - if (s && s->scfunc == DO_HELP_VOID) { + if (s && s->scfunc == do_help_void) { update_statusbar_line(answer, statusbar_x); /* This key has a shortcut list entry when it's used to @@ -1114,7 +1114,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe * we've finished putting in an answer, reset the statusbar cursor * position too. */ if (s) { - if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER || + if (s->scfunc == do_cancel || s->scfunc == do_enter_void || ran_func) { statusbar_x = old_statusbar_x; statusbar_pww = old_pww; @@ -1201,9 +1201,9 @@ int do_prompt(bool allow_tabs, /* If we left the prompt via Cancel or Enter, set the return value * properly. */ - if (s && s->scfunc == CANCEL_MSG) + if (s && s->scfunc == do_cancel) retval = -1; - else if (s && s->scfunc == DO_ENTER) + else if (s && s->scfunc == do_enter_void) retval = (*answer == '\0') ? -2 : 0; blank_statusbar(); @@ -1311,7 +1311,7 @@ int do_yesno_prompt(bool all, const char *msg) kbinput = get_kbinput(bottomwin, &meta_key, &func_key); s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); - if (s && s->scfunc == CANCEL_MSG) + if (s && s->scfunc == do_cancel) ok = -1; #ifndef DISABLE_MOUSE else if (kbinput == KEY_MOUSE) { @@ -1343,7 +1343,7 @@ int do_yesno_prompt(bool all, const char *msg) } } #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 6ba08459..553a2a03 100644 --- a/src/proto.h +++ b/src/proto.h @@ -460,6 +460,7 @@ void allow_pending_sigwinch(bool allow); #endif #ifndef NANO_TINY void do_toggle(int flag); +void do_toggle_void(void); #endif void disable_extended_io(void); #ifdef USE_SLANG @@ -611,6 +612,8 @@ filestruct *find_history(const filestruct *h_start, const filestruct void update_history(filestruct **h, const char *s); char *get_history_older(filestruct **h); char *get_history_newer(filestruct **h); +void get_history_older_void(void); +void get_history_newer_void(void); #ifndef DISABLE_TABCOMP char *get_history_completion(filestruct **h, const char *s, size_t len); #endif @@ -631,6 +634,7 @@ void do_undo(void); void do_redo(void); #endif void do_enter(bool undoing); +void do_enter_void(void); #ifndef NANO_TINY RETSIGTYPE cancel_command(int signal); bool execute_command(const char *command); @@ -752,7 +756,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); #endif const sc *get_shortcut(int menu, int *kbinput, bool *meta_key, bool *func_key); -const sc *first_sc_for(int menu, short func); +const sc *first_sc_for(int menu, void (*func)(void)); void blank_line(WINDOW *win, int y, int x, int n); void blank_titlebar(void); void blank_topbar(void); @@ -793,7 +797,7 @@ int strtomenu(char *input); void assign_keyinfo(sc *s); void xon_complaint(void); void xoff_complaint(void); -int sc_seq_or (short func, int defaultval); +int sc_seq_or (void (*func)(void), int defaultval); void do_suspend_void(void); extern const char *cancel_msg; @@ -820,7 +824,6 @@ extern const char *backup_file_msg; extern const char *gototext_msg; extern const char *new_buffer_msg; -void iso_me_harder_funcmap(short func); void enable_nodelay(void); void disable_nodelay(void); @@ -832,4 +835,22 @@ extern const char *regexp_msg; void do_credits(void); #endif +/* May as just throw these here since they are just placeholders */ +void do_cancel(void); +void case_sens_void(void); +void regexp_void(void); +void gototext_void(void); +void to_files_void(void); +void dos_format_void(void); +void mac_format_void(void); +void append_void(void); +void prepend_void(void); +void backup_file_void(void); +void new_buffer_void(void); +void backwards_void(void); +void goto_dir_void(void); +void no_replace_void(void); +void ext_cmd_void(void); + + #endif /* !PROTO_H */ diff --git a/src/rcfile.c b/src/rcfile.c index 53504699..d5682b5a 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -863,7 +863,7 @@ static void check_vitals_mapped(void) subnfunc *f; int v; #define VITALS 5 - short vitals[VITALS] = { DO_EXIT, DO_EXIT, CANCEL_MSG, CANCEL_MSG, CANCEL_MSG }; + void (*vitals[VITALS])(void) = { do_exit, do_exit, do_cancel, do_cancel, do_cancel }; int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE }; for (v = 0; v < VITALS; v++) { diff --git a/src/search.c b/src/search.c index 6cb94696..fc0ba407 100644 --- a/src/search.c +++ b/src/search.c @@ -138,7 +138,7 @@ int search_init(bool replacing, bool use_answer) int i = 0; char *buf; sc *s; - char func = 0; + void (*func)(void); bool meta_key = FALSE, func_key = FALSE; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -236,26 +236,25 @@ int search_init(bool replacing, bool use_answer) #endif ; #ifndef NANO_TINY - } else if (func == CASE_SENS_MSG) { + } else if (func == case_sens_void) { TOGGLE(CASE_SENSITIVE); backupstring = mallocstrcpy(backupstring, answer); return 1; - } else if (func == BACKWARDS_MSG) { + } else if (func == backwards_void) { TOGGLE(BACKWARDS_SEARCH); backupstring = mallocstrcpy(backupstring, answer); return 1; #endif #ifdef HAVE_REGEX_H - } else if (func == REGEXP_MSG) { + } else if (func == regexp_void) { TOGGLE(USE_REGEXP); backupstring = mallocstrcpy(backupstring, answer); return 1; #endif - } else if (func == DO_REPLACE || - func == NO_REPLACE_MSG) { + } else if (func == do_replace || func == no_replace_void) { backupstring = mallocstrcpy(backupstring, answer); return -2; /* Call the opposite search function. */ - } else if (func == DO_GOTOLINECOLUMN_VOID) { + } else if (func == do_gotolinecolumn_void) { do_gotolinecolumn(openfile->current->lineno, openfile->placewewant + 1, TRUE, TRUE, FALSE, TRUE); @@ -310,7 +309,7 @@ bool findnextstr( if (time(NULL) - lastkbcheck > 1) { lastkbcheck = time(NULL); f = getfuncfromkey(edit); - if (f && f->scfunc == CANCEL_MSG) { + if (f && f->scfunc == do_cancel) { statusbar(_("Cancelled")); return FALSE; } @@ -1044,7 +1043,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, s = get_shortcut(currmenu, &i, &meta_key, &func_key); - if (s && s->scfunc == GOTOTEXT_MSG) { + if (s && s->scfunc == gototext_void) { /* Keep answer up on the statusbar. */ search_init(TRUE, TRUE); @@ -1431,6 +1430,16 @@ char *get_history_newer(filestruct **h) return (*h)->data; } +/* More placeholders */ +void get_history_newer_void(void) +{ + ; +} +void get_history_older_void(void) +{ + ; +} + #ifndef DISABLE_TABCOMP /* Move h to the next string that's a tab completion of the string s, * looking at only the first len characters of s, and return that diff --git a/src/text.c b/src/text.c index d34763d1..59459c21 100644 --- a/src/text.c +++ b/src/text.c @@ -481,7 +481,7 @@ void do_undo(void) strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]); free(f->data); f->data = data; - if (u->xflags == UNDO_DEL_BACKSPACE) + if (u->xflags == UNdel_backspace) openfile->current_x += strlen(u->strdata); break; #ifndef DISABLE_WRAPPING @@ -626,7 +626,7 @@ void do_redo(void) #ifndef DISABLE_WRAPPING case SPLIT: undidmsg = _("line wrap"); - if (u->xflags & UNDO_SPLIT_MADENEW) + if (u->xflags & UNsplit_madenew) prepend_wrap = TRUE; do_wrap(f, TRUE); renumber(f); @@ -741,6 +741,11 @@ void do_enter(bool undoing) edit_refresh_needed = TRUE; } +/* Need this again... */ +void do_enter_void(void) { + do_enter(FALSE); +} + #ifndef NANO_TINY /* Send a SIGKILL (unconditional kill) to the forked process in * execute_command(). */ @@ -1016,8 +1021,8 @@ void update_undo(undo_type action) if (fs->current_x == u->begin) { /* They're deleting */ if (!u->xflags) - u->xflags = UNDO_DEL_DEL; - else if (u->xflags != UNDO_DEL_DEL) { + u->xflags = UNdel_del; + else if (u->xflags != UNdel_del) { add_undo(action); return; } @@ -1030,8 +1035,8 @@ void update_undo(undo_type action) } else if (fs->current_x == u->begin - 1) { /* They're backspacing */ if (!u->xflags) - u->xflags = UNDO_DEL_BACKSPACE; - else if (u->xflags != UNDO_DEL_BACKSPACE) { + u->xflags = UNdel_backspace; + else if (u->xflags != UNdel_backspace) { add_undo(action); return; } @@ -1071,7 +1076,7 @@ void update_undo(undo_type action) case SPLIT: /* This will only be called if we made a completely new line, and as such we should note that so we can destroy it later */ - u->xflags = UNDO_SPLIT_MADENEW; + u->xflags = UNsplit_madenew; break; #endif /* DISABLE_WRAPPING */ case UNSPLIT: @@ -2281,7 +2286,7 @@ void do_justify(bool full_justify) &finished, FALSE); s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key); - if (s && s->scfunc == DO_UNCUT_TEXT) { + 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 a62b0cec..fd239225 100644 --- a/src/winio.c +++ b/src/winio.c @@ -497,36 +497,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) if (retval != ERR) { switch (retval) { case NANO_CONTROL_8: - retval = ISSET(REBIND_DELETE) ? sc_seq_or(DO_DELETE, 0) : - sc_seq_or(DO_BACKSPACE, 0); + retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) : + sc_seq_or(do_backspace, 0); break; case KEY_DOWN: #ifdef KEY_SDOWN /* ncurses and Slang don't support KEY_SDOWN. */ case KEY_SDOWN: #endif - retval = sc_seq_or(DO_DOWN_VOID, *kbinput); + retval = sc_seq_or(do_down_void, *kbinput); break; case KEY_UP: #ifdef KEY_SUP /* ncurses and Slang don't support KEY_SUP. */ case KEY_SUP: #endif - retval = sc_seq_or(DO_UP_VOID, *kbinput); + retval = sc_seq_or(do_up_void, *kbinput); break; case KEY_LEFT: #ifdef KEY_SLEFT /* Slang doesn't support KEY_SLEFT. */ case KEY_SLEFT: #endif - retval = sc_seq_or(DO_LEFT, *kbinput); + retval = sc_seq_or(do_left, *kbinput); break; case KEY_RIGHT: #ifdef KEY_SRIGHT /* Slang doesn't support KEY_SRIGHT. */ case KEY_SRIGHT: #endif - retval = sc_seq_or(DO_RIGHT, *kbinput); + retval = sc_seq_or(do_right, *kbinput); break; #ifdef KEY_SHOME /* HP-UX 10-11 and Slang don't support KEY_SHOME. */ @@ -534,36 +534,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) #endif case KEY_A1: /* Home (7) on numeric keypad with * NumLock off. */ - retval = sc_seq_or(DO_HOME, *kbinput); + retval = sc_seq_or(do_home, *kbinput); break; case KEY_BACKSPACE: - retval = sc_seq_or(DO_BACKSPACE, *kbinput); + retval = sc_seq_or(do_backspace, *kbinput); break; #ifdef KEY_SDC /* Slang doesn't support KEY_SDC. */ case KEY_SDC: if (ISSET(REBIND_DELETE)) - retval = sc_seq_or(DO_DELETE, *kbinput); + retval = sc_seq_or(do_delete, *kbinput); else - retval = sc_seq_or(DO_BACKSPACE, *kbinput); + retval = sc_seq_or(do_backspace, *kbinput); break; #endif #ifdef KEY_SIC /* Slang doesn't support KEY_SIC. */ case KEY_SIC: - retval = sc_seq_or(DO_INSERTFILE_VOID, *kbinput); + retval = sc_seq_or(do_insertfile_void, *kbinput); break; #endif case KEY_C3: /* PageDown (4) on numeric keypad with * NumLock off. */ - retval = sc_seq_or(DO_PAGE_DOWN, *kbinput); + retval = sc_seq_or(do_page_down, *kbinput); break; case KEY_A3: /* PageUp (9) on numeric keypad with * NumLock off. */ - retval = sc_seq_or(DO_PAGE_UP, *kbinput); + retval = sc_seq_or(do_page_up, *kbinput); break; case KEY_ENTER: - retval = sc_seq_or(DO_ENTER, *kbinput); + retval = sc_seq_or(do_enter_void, *kbinput); break; case KEY_B2: /* Center (5) on numeric keypad with * NumLock off. */ @@ -575,7 +575,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) /* HP-UX 10-11 and Slang don't support KEY_SEND. */ case KEY_SEND: #endif - retval = sc_seq_or(DO_END, *kbinput); + retval = sc_seq_or(do_end, *kbinput); break; #ifdef KEY_BEG /* Slang doesn't support KEY_BEG. */ @@ -591,7 +591,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) /* Slang doesn't support KEY_SCANCEL. */ case KEY_SCANCEL: #endif - retval = first_sc_for(currmenu, CANCEL_MSG)->seq; + retval = first_sc_for(currmenu, do_cancel)->seq; break; #endif #ifdef KEY_SBEG @@ -604,13 +604,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 = sc_seq_or(DO_SUSPEND_VOID, 0); + retval = sc_seq_or(do_suspend_void, 0); break; #endif #ifdef KEY_SUSPEND /* Slang doesn't support KEY_SUSPEND. */ case KEY_SUSPEND: - retval = sc_seq_or(DO_SUSPEND_VOID, 0); + retval = sc_seq_or(do_suspend_void, 0); break; #endif #ifdef PDCURSES @@ -758,15 +758,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) retval = KEY_B2; break; case 'F': /* Esc O F == End on xterm/Terminal. */ - retval = sc_seq_or(DO_END, 0); + retval = sc_seq_or(do_end, 0); break; case 'H': /* Esc O H == Home on xterm/Terminal. */ - retval = sc_seq_or(DO_HOME, 0);; + retval = sc_seq_or(do_home, 0);; break; case 'M': /* Esc O M == Enter on numeric keypad with * NumLock off on VT100/VT220/VT320/xterm/ * rxvt/Eterm. */ - retval = sc_seq_or(DO_HOME, 0);; + retval = sc_seq_or(do_home, 0);; break; case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach * console. */ @@ -831,7 +831,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) case 'n': /* Esc O n == Delete (.) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * xterm/rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_DELETE, 0);; + retval = sc_seq_or(do_delete, 0);; break; case 'o': /* Esc O o == '/' on numeric keypad with * NumLock off on VT100/VT220/VT320/xterm/ @@ -841,27 +841,27 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) case 'p': /* Esc O p == Insert (0) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_INSERTFILE_VOID, 0);; + retval = sc_seq_or(do_insertfile_void, 0);; break; case 'q': /* Esc O q == End (1) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_END, 0);; + retval = sc_seq_or(do_end, 0);; break; case 'r': /* Esc O r == Down (2) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_DOWN_VOID, 0);; + retval = sc_seq_or(do_down_void, 0);; break; case 's': /* Esc O s == PageDown (3) on numeric * keypad with NumLock off on VT100/VT220/ * VT320/rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_PAGE_DOWN, 0);; + retval = sc_seq_or(do_page_down, 0);; break; case 't': /* Esc O t == Left (4) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_LEFT, 0);; + retval = sc_seq_or(do_left, 0);; break; case 'u': /* Esc O u == Center (5) on numeric keypad * with NumLock off on VT100/VT220/VT320/ @@ -871,22 +871,22 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) case 'v': /* Esc O v == Right (6) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_RIGHT, 0); + retval = sc_seq_or(do_right, 0); break; case 'w': /* Esc O w == Home (7) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_HOME, 0); + retval = sc_seq_or(do_home, 0); break; case 'x': /* Esc O x == Up (8) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_UP_VOID, 0); + retval = sc_seq_or(do_up_void, 0); break; case 'y': /* Esc O y == PageUp (9) on numeric keypad * with NumLock off on VT100/VT220/VT320/ * rxvt/Eterm/Terminal. */ - retval = sc_seq_or(DO_PAGE_UP, 0); + retval = sc_seq_or(do_page_up, 0); break; } break; @@ -980,7 +980,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) break; default: /* Esc [ 1 ~ == Home on * VT320/Linux console. */ - retval = sc_seq_or(DO_HOME, 0);; + retval = sc_seq_or(do_home, 0);; break; } } @@ -1031,40 +1031,40 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) default: /* Esc [ 2 ~ == Insert on * VT220/VT320/Linux console/ * xterm/Terminal. */ - retval = sc_seq_or(DO_INSERTFILE_VOID, 0);; + retval = sc_seq_or(do_insertfile_void, 0);; break; } } break; case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/ * Linux console/xterm/Terminal. */ - retval = sc_seq_or(DO_DELETE, 0);; + retval = sc_seq_or(do_delete, 0);; break; case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux * console/xterm. */ - retval = sc_seq_or(DO_END, 0);; + retval = sc_seq_or(do_end, 0);; break; case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/ * Linux console/xterm/Terminal; * Esc [ 5 ^ == PageUp on Eterm. */ - retval = sc_seq_or(DO_PAGE_UP, 0);; + retval = sc_seq_or(do_page_up, 0);; break; case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/ * Linux console/xterm/Terminal; * Esc [ 6 ^ == PageDown on Eterm. */ - retval = sc_seq_or(DO_PAGE_DOWN, 0);; + retval = sc_seq_or(do_page_down, 0);; break; case '7': /* Esc [ 7 ~ == Home on rxvt. */ - retval = sc_seq_or(DO_HOME, 0); + retval = sc_seq_or(do_home, 0); break; case '8': /* Esc [ 8 ~ == End on rxvt. */ - retval = sc_seq_or(DO_END, 0); + retval = sc_seq_or(do_end, 0); break; case '9': /* Esc [ 9 == Delete on Mach console. */ - retval = sc_seq_or(DO_DELETE, 0);; + retval = sc_seq_or(do_delete, 0);; break; case '@': /* Esc [ @ == Insert on Mach console. */ - retval = sc_seq_or(DO_INSERTFILE_VOID, 0);; + retval = sc_seq_or(do_insertfile_void, 0);; break; case 'A': /* Esc [ A == Up on ANSI/VT220/Linux * console/FreeBSD console/Mach console/ @@ -1087,23 +1087,23 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) break; case 'F': /* Esc [ F == End on FreeBSD * console/Eterm. */ - retval = sc_seq_or(DO_END, 0); + retval = sc_seq_or(do_end, 0); break; case 'G': /* Esc [ G == PageDown on FreeBSD * console. */ - retval = sc_seq_or(DO_PAGE_DOWN, 0); + retval = sc_seq_or(do_page_down, 0); break; case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD * console/Mach console/Eterm. */ - retval = sc_seq_or(DO_HOME, 0); + retval = sc_seq_or(do_home, 0); break; case 'I': /* Esc [ I == PageUp on FreeBSD * console. */ - retval = sc_seq_or(DO_PAGE_UP, 0); + retval = sc_seq_or(do_page_up, 0); break; case 'L': /* Esc [ L == Insert on ANSI/FreeBSD * console. */ - retval = sc_seq_or(DO_INSERTFILE_VOID, 0); + retval = sc_seq_or(do_insertfile_void, 0); break; case 'M': /* Esc [ M == F1 on FreeBSD console. */ retval = KEY_F(1); @@ -1151,10 +1151,10 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) retval = KEY_F(8); break; case 'U': /* Esc [ U == PageDown on Mach console. */ - retval = sc_seq_or(DO_PAGE_DOWN, 0); + retval = sc_seq_or(do_page_down, 0); break; case 'V': /* Esc [ V == PageUp on Mach console. */ - retval = sc_seq_or(DO_PAGE_UP, 0); + retval = sc_seq_or(do_page_up, 0); break; case 'W': /* Esc [ W == F11 on FreeBSD console. */ retval = KEY_F(11); @@ -1163,7 +1163,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len) retval = KEY_F(12); break; case 'Y': /* Esc [ Y == End on Mach console. */ - retval = sc_seq_or(DO_END, 0); + retval = sc_seq_or(do_end, 0); break; case 'Z': /* Esc [ Z == F14 on FreeBSD console. */ retval = KEY_F(14); @@ -1220,13 +1220,13 @@ int get_escape_seq_abcd(int kbinput) { switch (tolower(kbinput)) { case 'a': - return sc_seq_or(DO_UP_VOID, 0);; + return sc_seq_or(do_up_void, 0);; case 'b': - return sc_seq_or(DO_DOWN_VOID, 0);; + return sc_seq_or(do_down_void, 0);; case 'c': - return sc_seq_or(DO_RIGHT, 0);; + return sc_seq_or(do_right, 0);; case 'd': - return sc_seq_or(DO_LEFT, 0);; + return sc_seq_or(do_left, 0);; default: return ERR; } @@ -1746,7 +1746,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) * wheel is equivalent to moving down three lines. */ for (i = 0; i < 3; i++) unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ? - sc_seq_or(DO_UP_VOID, 0) : sc_seq_or(DO_DOWN_VOID, 0), FALSE, + sc_seq_or(up_void, 0) : sc_seq_or(DO_DOWN_VOID, 0), FALSE, FALSE); return 1; -- 2.39.5