return META;
} else if (str[0] == '^') {
return CONTROL;
- } else if (str[0] == 'M' || str[0] == 'm') {
+ } else if (str[0] == 'F' || str[0] == 'F') {
return FKEY;
} else {
return RAW;
}
#ifdef DEBUG
- fprintf(stderr, "Whoops, returning null given func %ld\n", (long) func);
+ fprintf(stderr, "Whoops, returning null given func %ld in menu %d\n", (long) func, menu);
#endif
/* Otherwise... */
return NULL;
#endif
}
+/* 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 (void *func, int defaultval)
+{
+ const sc *s = first_sc_for(currmenu, func);
+
+ if (s)
+ return s->seq;
+ /* else */
+ return defaultval;
+
+}
+
/* Assign the info to the shortcut struct
Assumes keystr is already assigned, naturally */
void assign_keyinfo(sc *s)
for (s = sclist; s->next != NULL; s = s->next) {
f = sctofunc(s);
if (f)
- fprintf(stderr, "Shortcut \"%s\", function: %s\n", s->keystr, f->desc);
+ fprintf(stderr, "Shortcut \"%s\", function: %s, menus %d\n", s->keystr, f->desc, f->menus);
else
fprintf(stderr, "Hmm, didnt find a func for \"%s\"\n", s->keystr);
}
const char *nano_backspace_msg = "";
const char *nano_regexp_msg = "";
const char *gototext_msg = "";
-const char *do_para_begin_void = "";
-const char *do_para_end_void = "";
+const char *do_para_begin_msg = "";
+const char *do_para_end_msg = "";
const char *case_sens_msg = "";
const char *backwards_msg = "";
const char *do_cut_till_end = "";
const char *prepend_msg = "";
const char *backup_file_msg = "";
const char *to_files_msg = "";
-#else /* NANO_TINY */
-const char *prev_history_msg = N_("PrevHstory");
+const char *first_file_msg = "";
+const char *whereis_next_msg = "";
+/* TRANSLATORS: Try to keep this at most 12 characters. */
+const char *last_file_msg = "";
+const char *new_buffer_msg = "";
+const char *goto_dir_msg;
+
+#else
/* TRANSLATORS: Try to keep this and previous strings at most 10
* characters. */
+const char *prev_history_msg = N_("PrevHstory");
const char *next_history_msg = N_("NextHstory");
const char *replace_msg = N_("Replace");
const char *no_replace_msg = N_("No Replace");
-const char *go_to_line_msg = N_("Go To Line");
const char *gototext_msg = N_("Go To Text");
+/* TRANSLATORS: Try to keep this at most 12 characters. */
+const char *whereis_next_msg = N_("WhereIs Next");
#ifndef DISABLE_BROWSER
/* TRANSLATORS: Try to keep this at most 16 characters. */
const char *to_files_msg = N_("To Files");
/* TRANSLATORS: Try to keep this at most 16 characters. */
const char *new_buffer_msg = N_("New Buffer");
#endif
+const char *goto_dir_msg = N_("Go To Dir");
-#endif
+#endif /* NANO_TINY */
/* Initialize all shortcut lists. If unjustify is TRUE, replace the
* Uncut shortcut in the main shortcut list with UnJustify. */
const char *next_page_msg = N_("Next Page");
/* TRANSLATORS: Try to keep this string at most 10 characters. */
-#ifndef NANO_TINY
- /* TRANSLATORS: Try to keep this at most 12 characters. */
- const char *whereis_next_msg = N_("WhereIs Next");
-#endif
/* TRANSLATORS: Try to keep this and following strings at most 10
* characters. */
const char *first_line_msg = N_("First Line");
#endif
const char *refresh_msg = N_("Refresh");
const char *insert_file_msg = N_("Insert File");
- const char *goto_dir_msg = N_("Go To Dir");
const char *ext_cmd_msg = N_("Execute Command");
+ const char *go_to_line_msg = N_("Go To Line");
#ifndef DISABLE_HELP
const char *nano_cancel_msg = N_("Cancel the current function");
NOVIEW);
#endif
- add_to_funcs(do_search, MMAIN, whereis_msg,
+ add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg,
nano_whereis_msg, FALSE, VIEW);
- add_to_funcs(do_page_up, (MMAIN|MHELP|MBROWSER),
+ add_to_funcs(do_page_up, MMAIN|MHELP,
prev_page_msg, nano_prevpage_msg, FALSE, VIEW);
- add_to_funcs(do_page_down, (MMAIN|MHELP|MBROWSER),
+ add_to_funcs(do_page_down, MMAIN|MHELP,
next_page_msg, nano_nextpage_msg, TRUE, VIEW);
/* TRANSLATORS: Try to keep this at most 10 characters. */
add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), nano_uncut_msg,
FALSE, NOVIEW);
- /* TRANSLATORS: Try to keep this at most 10 characters. */
+#ifndef NANO_TINY
add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), nano_cursorpos_msg,
FALSE, VIEW);
+#endif
/* If we're using restricted mode, spell checking is disabled
* because it allows reading from or writing to files not specified
add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS),
go_to_line_msg, 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,
+ FALSE, VIEW);
+#endif
+
+
add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, nano_replace_msg,
#ifndef NANO_TINY
#endif
+ add_to_funcs(do_page_up, MBROWSER,
+ prev_page_msg, nano_prevpage_msg, FALSE, VIEW);
+ add_to_funcs(do_page_down, MBROWSER,
+ next_page_msg, nano_nextpage_msg, TRUE, VIEW);
+
- add_to_funcs(do_right, MMAIN, N_("Forward"), nano_forward_msg,
+ add_to_funcs(do_right, (MMAIN|MBROWSER), N_("Forward"), nano_forward_msg,
FALSE, VIEW);
- add_to_funcs(do_left, MMAIN, N_("Back"), nano_back_msg,
+ add_to_funcs(do_left, (MMAIN|MBROWSER), N_("Back"), nano_back_msg,
FALSE, VIEW);
#ifndef NANO_TINY
nano_prevword_msg, FALSE, VIEW);
#endif
- add_to_funcs(do_up_void, (MMAIN|MHELP), N_("Prev Line"),
+ add_to_funcs(do_up_void, (MMAIN|MHELP|MBROWSER), N_("Prev Line"),
nano_prevline_msg, FALSE, VIEW);
- add_to_funcs(do_down_void, (MMAIN|MHELP), N_("Next Line"),
+ add_to_funcs(do_down_void, (MMAIN|MHELP|MBROWSER), N_("Next Line"),
nano_nextline_msg, TRUE, VIEW);
add_to_funcs(do_home, MMAIN, N_("Home"), nano_home_msg,
add_to_sclist(MALL, "^G", do_help_void, 0, TRUE);
add_to_sclist(MALL, "F1", do_help_void, 0, TRUE);
#endif
- add_to_sclist(MMAIN, "^X", do_exit, 0, TRUE);
- add_to_sclist(MMAIN, "F2", do_exit, 0, TRUE);
- add_to_sclist(MHELP, "^X", do_exit, 0, TRUE);
- add_to_sclist(MHELP, "F2", do_exit, 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, "^O", do_writeout_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, "^W", do_search, 0, TRUE);
- add_to_sclist(MMAIN, "F6", do_search, 0, TRUE);
- add_to_sclist(MMAIN, "^Y", do_page_up, 0, TRUE);
- add_to_sclist(MMAIN, "F7", do_page_up, 0, TRUE);
- add_to_sclist(MMAIN, "^V", do_page_down, 0, TRUE);
- add_to_sclist(MMAIN, "F8", do_page_down, 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, "^Y", do_page_up, 0, TRUE);
+ add_to_sclist(MMAIN|MBROWSER, "F7", do_page_up, 0, TRUE);
+ add_to_sclist(MMAIN|MBROWSER, "^V", do_page_down, 0, TRUE);
+ add_to_sclist(MMAIN|MBROWSER, "F8", 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, "^^", 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(MALL, "F16", do_research, 0, TRUE);
add_to_sclist(MALL, "M-W", do_research, 0, TRUE);
+ add_to_sclist(MALL, "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(MALL, "^N", do_down_void, 0, TRUE);
add_to_sclist(MALL, "^A", do_home, 0, TRUE);
add_to_sclist(MALL, "^E", do_end, 0, TRUE);
+#ifndef NANO_TINY
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
"^W", do_para_begin_void, 0, TRUE);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
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|MREPLACE|MREPLACE2,
"^Y", do_first_line, 0, TRUE);
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
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(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);
+ add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", (void *) last_file_msg, 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(MALL, "^M", do_enter, 0, TRUE);
add_to_sclist(MALL, "^D", do_delete, 0, TRUE);
add_to_sclist(MALL, "^H", do_backspace, 0, TRUE);
- add_to_sclist(MALL, "M-T", do_cut_till_end, 0, TRUE);
#ifndef NANO_TINY
+ add_to_sclist(MALL, "M-T", do_cut_till_end, 0, TRUE);
add_to_sclist(MALL, "M-J", do_full_justify, 0, TRUE);
add_to_sclist(MALL, "M-D", do_wordlinechar_count, 0, TRUE);
add_to_sclist(MMAIN, "M-X", do_toggle, NO_HELP, TRUE);
#endif
add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR),
"^C", (void *) cancel_msg, 0, FALSE);
- add_to_sclist(MHELP, "^Y", do_page_up, 0, TRUE);
- add_to_sclist(MHELP, "F7", do_page_up, 0, TRUE);
- add_to_sclist(MHELP, "^V", do_page_down, 0, TRUE);
- add_to_sclist(MHELP, "F8", do_page_down, 0, TRUE);
+ add_to_sclist(MHELP|MBROWSER|MWHEREISFILE, "^Y", do_page_up, 0, TRUE);
+ add_to_sclist(MHELP|MBROWSER|MWHEREISFILE, "F7", do_page_up, 0, TRUE);
+ add_to_sclist(MHELP|MBROWSER|MWHEREISFILE, "^V", do_page_down, 0, TRUE);
+ add_to_sclist(MHELP|MBROWSER|MWHEREISFILE, "F8", do_page_down, 0, TRUE);
add_to_sclist(MHELP, "^X", do_exit, 0, TRUE);
add_to_sclist(MHELP, "F2", do_exit, 0, TRUE);
add_to_sclist(MWRITEFILE, "M-D", (void *) dos_format_msg, 0, FALSE);
return "?????";
}
}
+#endif /* NANO_TINY */
/* Interpret the string given by the rc file and return a
shortcut struct, complete with proper value for execute */
s = (sc *)nmalloc(sizeof(sc));
s->execute = TRUE; /* overridden as needed below */
+
+#ifndef DISABLE_HELP
if (!strcasecmp(input, "help"))
s->scfunc = do_help_void;
- else if (!strcasecmp(input, "cancel")) {
+ else
+#endif
+ if (!strcasecmp(input, "cancel")) {
s->scfunc = (void *) cancel_msg;
s->execute = FALSE;
} else if (!strcasecmp(input, "exit"))
s->scfunc = do_exit;
else if (!strcasecmp(input, "writeout"))
s->scfunc = do_writeout_void;
- else if (!strcasecmp(input, "justify"))
- s->scfunc = do_justify_void;
else if (!strcasecmp(input, "insert"))
s->scfunc = do_insertfile_void;
else if (!strcasecmp(input, "whereis"))
s->scfunc = do_gotolinecolumn_void;
else if (!strcasecmp(input, "replace"))
s->scfunc = do_replace;
+#ifndef NANO_TINY
+ else if (!strcasecmp(input, "justify"))
+ s->scfunc = do_justify_void;
else if (!strcasecmp(input, "mark"))
s->scfunc = do_mark;
else if (!strcasecmp(input, "searchagain") ||
s->scfunc = do_indent_void;
else if (!strcasecmp(input, "unindent"))
s->scfunc = do_unindent;
- else if (!strcasecmp(input, "right") ||
- !strcasecmp(input, "forward"))
- s->scfunc = do_right;
- else if (!strcasecmp(input, "left") ||
- !strcasecmp(input, "back"))
- s->scfunc = do_left;
+ else if (!strcasecmp(input, "scrollup"))
+ s->scfunc = do_scroll_up;
+ else if (!strcasecmp(input, "scrolldown"))
+ s->scfunc = do_scroll_down;
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "prevword"))
s->scfunc = do_prev_word_void;
- else if (!strcasecmp(input, "up") ||
- !strcasecmp(input, "prevline"))
- s->scfunc = do_up_void;
- else if (!strcasecmp(input, "down") ||
- !strcasecmp(input, "nextline"))
- s->scfunc = do_down_void;
- else if (!strcasecmp(input, "home"))
- s->scfunc = do_home;
- else if (!strcasecmp(input, "end"))
- s->scfunc = do_end;
- else if (!strcasecmp(input, "beginpara"))
- s->scfunc = do_para_begin_void;
- else if (!strcasecmp(input, "endpara"))
- s->scfunc = do_para_end_void;
else if (!strcasecmp(input, "findbracket"))
s->scfunc = do_find_bracket;
- else if (!strcasecmp(input, "scrollup"))
- s->scfunc = do_scroll_up;
- else if (!strcasecmp(input, "scrolldown"))
- s->scfunc = do_scroll_down;
-#ifdef ENABLE_MULTIBUFFER
- else if (!strcasecmp(input, "prevbuf"))
- s->scfunc = switch_to_prev_buffer_void;
- else if (!strcasecmp(input, "nextbuf"))
- s->scfunc = switch_to_next_buffer_void;
-#endif
- else if (!strcasecmp(input, "verbatim"))
- s->scfunc = do_verbatim_input;
- else if (!strcasecmp(input, "tab"))
- s->scfunc = do_tab;
- else if (!strcasecmp(input, "enter"))
- s->scfunc = do_enter;
- else if (!strcasecmp(input, "delete"))
- s->scfunc = do_delete;
- else if (!strcasecmp(input, "fulljustify"))
- s->scfunc = do_full_justify;
else if (!strcasecmp(input, "wordcount"))
s->scfunc = do_wordlinechar_count;
- else if (!strcasecmp(input, "refresh"))
- s->scfunc = total_refresh;
- else if (!strcasecmp(input, "casesens")) {
- s->scfunc = (void *) case_sens_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "regexp") ||
- !strcasecmp(input, "regex")) {
- s->scfunc = (void *) regexp_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "prevhistory")) {
+ else if (!strcasecmp(input, "prevhistory")) {
s->scfunc = (void *) prev_history_msg;
s->execute = FALSE;
} else if (!strcasecmp(input, "nexthistory")) {
s->scfunc = (void *) next_history_msg;
s->execute = FALSE;
- } else if (!strcasecmp(input, "dontreplace")) {
- s->scfunc = (void *) no_replace_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "gototext")) {
- s->scfunc = (void *) gototext_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "browser") ||
- !strcasecmp(input, "tofiles")) {
- s->scfunc = (void *) to_files_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "dosformat")) {
- s->scfunc = (void *) dos_format_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "macformat")) {
- s->scfunc = (void *) mac_format_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "append")) {
- s->scfunc = (void *) append_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "prepend")) {
- s->scfunc = (void *) prepend_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "backup")) {
- s->scfunc = (void *) backup_file_msg;
- s->execute = FALSE;
-#ifdef ENABLE_MULTIBUFFER
- } else if (!strcasecmp(input, "newbuffer")) {
- s->scfunc = (void *) new_buffer_msg;
- s->execute = FALSE;
-#endif
- } else if (!strcasecmp(input, "firstfile")) {
- s->scfunc = (void *) first_file_msg;
- s->execute = FALSE;
- } else if (!strcasecmp(input, "lastfile")) {
- s->scfunc = (void *) last_file_msg;
- s->execute = FALSE;
} else if (!strcasecmp(input, "nohelp") ||
!strcasecmp(input, "nohelp")) {
s->scfunc = (void *) do_toggle;
s->scfunc = (void *) do_toggle;
s->execute = FALSE;
s->toggle = SUSPEND;
+ } else if (!strcasecmp(input, "beginpara"))
+ s->scfunc = do_para_begin_void;
+ else if (!strcasecmp(input, "endpara"))
+ s->scfunc = do_para_end_void;
+ else if (!strcasecmp(input, "fulljustify"))
+ s->scfunc = do_full_justify;
+#endif /* NANO_TINY */
+ else if (!strcasecmp(input, "right") ||
+ !strcasecmp(input, "forward"))
+ s->scfunc = do_right;
+ else if (!strcasecmp(input, "left") ||
+ !strcasecmp(input, "back"))
+ s->scfunc = do_left;
+ else if (!strcasecmp(input, "up") ||
+ !strcasecmp(input, "prevline"))
+ s->scfunc = do_up_void;
+ else if (!strcasecmp(input, "down") ||
+ !strcasecmp(input, "nextline"))
+ s->scfunc = do_down_void;
+ else if (!strcasecmp(input, "home"))
+ s->scfunc = do_home;
+ else if (!strcasecmp(input, "end"))
+ s->scfunc = do_end;
+#ifdef ENABLE_MULTIBUFFER
+ else if (!strcasecmp(input, "prevbuf"))
+ s->scfunc = switch_to_prev_buffer_void;
+ else if (!strcasecmp(input, "nextbuf"))
+ s->scfunc = switch_to_next_buffer_void;
+#endif
+ else if (!strcasecmp(input, "verbatim"))
+ s->scfunc = do_verbatim_input;
+ else if (!strcasecmp(input, "tab"))
+ s->scfunc = do_tab;
+ else if (!strcasecmp(input, "enter"))
+ s->scfunc = do_enter;
+ else if (!strcasecmp(input, "delete"))
+ s->scfunc = do_delete;
+ else if (!strcasecmp(input, "refresh"))
+ s->scfunc = total_refresh;
+ else if (!strcasecmp(input, "casesens")) {
+ s->scfunc = (void *) case_sens_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "regexp") ||
+ !strcasecmp(input, "regex")) {
+ s->scfunc = (void *) regexp_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "dontreplace")) {
+ s->scfunc = (void *) no_replace_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "gototext")) {
+ s->scfunc = (void *) gototext_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "browser") ||
+ !strcasecmp(input, "tofiles")) {
+ s->scfunc = (void *) to_files_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "dosformat")) {
+ s->scfunc = (void *) dos_format_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "macformat")) {
+ s->scfunc = (void *) mac_format_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "append")) {
+ s->scfunc = (void *) append_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "prepend")) {
+ s->scfunc = (void *) prepend_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "backup")) {
+ s->scfunc = (void *) backup_file_msg;
+ s->execute = FALSE;
+#ifdef ENABLE_MULTIBUFFER
+ } else if (!strcasecmp(input, "newbuffer")) {
+ s->scfunc = (void *) new_buffer_msg;
+ s->execute = FALSE;
+#endif
+ } else if (!strcasecmp(input, "firstfile")) {
+ s->scfunc = (void *) first_file_msg;
+ s->execute = FALSE;
+ } else if (!strcasecmp(input, "lastfile")) {
+ s->scfunc = (void *) last_file_msg;
+ s->execute = FALSE;
} else {
free(s);
return NULL;
}
+#ifdef ENABLE_NANORC
/* Same thing as abnove but for the menu */
int strtomenu(char *input)
{
return -1;
}
-
-
#endif
+
#ifdef DEBUG
/* This function is used to gracefully return all the memory we've used.
* It should be called just before calling exit(). Practically, the
if (retval != ERR) {
switch (retval) {
case NANO_CONTROL_8:
- retval = ISSET(REBIND_DELETE) ? NANO_DELETE_KEY :
- NANO_BACKSPACE_KEY;
+ 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
- s = first_sc_for(currmenu, (void *) do_down_void);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_down_void, *kbinput);
break;
case KEY_UP:
#ifdef KEY_SUP
/* ncurses and Slang don't support KEY_SUP. */
case KEY_SUP:
#endif
- s = first_sc_for(currmenu, (void *) do_up_void);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_up_void, *kbinput);
break;
case KEY_LEFT:
#ifdef KEY_SLEFT
/* Slang doesn't support KEY_SLEFT. */
case KEY_SLEFT:
#endif
- s = first_sc_for(currmenu, (void *) do_up_void);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_left, *kbinput);
break;
case KEY_RIGHT:
#ifdef KEY_SRIGHT
/* Slang doesn't support KEY_SRIGHT. */
case KEY_SRIGHT:
#endif
- s = first_sc_for(currmenu, (void *) do_right);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_right, *kbinput);
break;
#ifdef KEY_HOME
/* HP-UX 10-11 doesn't support KEY_HOME. */
#endif
case KEY_A1: /* Home (7) on numeric keypad with
* NumLock off. */
- s = first_sc_for(currmenu, (void *) do_home);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_home, *kbinput);
break;
case KEY_BACKSPACE:
- s = first_sc_for(currmenu, (void *) do_backspace);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_backspace, *kbinput);
break;
case KEY_DC:
#ifdef KEY_SDC
case KEY_SDC:
#endif
if (ISSET(REBIND_DELETE))
- s = first_sc_for(currmenu, (void *) do_delete);
+ retval = sc_seq_or((void *) do_delete, *kbinput);
else
- s = first_sc_for(currmenu, (void *) do_backspace);
-
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_backspace, *kbinput);
break;
case KEY_IC:
#ifdef KEY_SIC
/* Slang doesn't support KEY_SIC. */
case KEY_SIC:
#endif
- s = first_sc_for(currmenu, (void *) do_insertfile_void);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_insertfile_void, *kbinput);
break;
case KEY_NPAGE:
case KEY_C3: /* PageDown (4) on numeric keypad with
* NumLock off. */
- s = first_sc_for(currmenu, (void *) do_page_down);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_page_down, *kbinput);
break;
case KEY_PPAGE:
case KEY_A3: /* PageUp (9) on numeric keypad with
* NumLock off. */
- s = first_sc_for(currmenu, (void *) do_page_up);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_page_up, *kbinput);
break;
case KEY_ENTER:
- s = first_sc_for(currmenu, (void *) do_enter);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_enter, *kbinput);
break;
case KEY_B2: /* Center (5) on numeric keypad with
* NumLock off. */
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
case KEY_SEND:
#endif
- s = first_sc_for(currmenu, (void *) do_end);
- if (s)
- retval = s->seq;
+ retval = sc_seq_or((void *) do_end, *kbinput);
break;
#ifdef KEY_BEG
/* Slang doesn't support KEY_BEG. */
retval = KEY_B2;
break;
case 'F': /* Esc O F == End on xterm/Terminal. */
- retval = NANO_END_KEY;
+ retval = sc_seq_or(do_end, 0);
break;
case 'H': /* Esc O H == Home on xterm/Terminal. */
- retval = NANO_HOME_KEY;
+ 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 = NANO_ENTER_KEY;
+ retval = sc_seq_or(do_home, 0);;
break;
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach
* console. */
case 'n': /* Esc O n == Delete (.) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* xterm/rxvt/Eterm/Terminal. */
- retval = NANO_DELETE_KEY;
+ retval = sc_seq_or(do_delete, 0);;
break;
case 'o': /* Esc O o == '/' on numeric keypad with
* NumLock off on VT100/VT220/VT320/xterm/
case 'p': /* Esc O p == Insert (0) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
- retval = NANO_INSERTFILE_KEY;
+ 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 = NANO_END_KEY;
+ 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 = NANO_NEXTLINE_KEY;
+ 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 = NANO_NEXTPAGE_KEY;
+ 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 = NANO_BACK_KEY;
+ 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/
case 'v': /* Esc O v == Right (6) on numeric keypad
* with NumLock off on VT100/VT220/VT320/
* rxvt/Eterm/Terminal. */
- retval = NANO_FORWARD_KEY;
+ 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 = NANO_HOME_KEY;
+ 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 = NANO_PREVLINE_KEY;
+ 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 = NANO_PREVPAGE_KEY;
+ retval = sc_seq_or(do_up, 0);;
break;
}
break;
break;
default: /* Esc [ 1 ~ == Home on
* VT320/Linux console. */
- retval = NANO_HOME_KEY;
+ retval = sc_seq_or(do_home, 0);;
break;
}
}
default: /* Esc [ 2 ~ == Insert on
* VT220/VT320/Linux console/
* xterm/Terminal. */
- retval = NANO_INSERTFILE_KEY;
+ retval = sc_seq_or(do_insertfile_void, 0);;
break;
}
}
break;
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
* Linux console/xterm/Terminal. */
- retval = NANO_DELETE_KEY;
+ retval = sc_seq_or(do_delete, 0);;
break;
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
* console/xterm. */
- retval = NANO_END_KEY;
+ 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 = NANO_PREVPAGE_KEY;
+ 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 = NANO_NEXTPAGE_KEY;
+ retval = sc_seq_or(do_page_down, 0);;
break;
case '7': /* Esc [ 7 ~ == Home on rxvt. */
- retval = NANO_HOME_KEY;
+ retval = sc_seq_or(do_home, 0);
break;
case '8': /* Esc [ 8 ~ == End on rxvt. */
- retval = NANO_END_KEY;
+ retval = sc_seq_or(do_end, 0);
break;
case '9': /* Esc [ 9 == Delete on Mach console. */
- retval = NANO_DELETE_KEY;
+ retval = sc_seq_or(do_delete, 0);;
break;
case '@': /* Esc [ @ == Insert on Mach console. */
- retval = NANO_INSERTFILE_KEY;
+ retval = sc_seq_or(do_insertfile_void, 0);;
break;
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
* console/FreeBSD console/Mach console/
break;
case 'F': /* Esc [ F == End on FreeBSD
* console/Eterm. */
- retval = NANO_END_KEY;
+ retval = sc_seq_or(do_end, 0);
break;
case 'G': /* Esc [ G == PageDown on FreeBSD
* console. */
- retval = NANO_NEXTPAGE_KEY;
+ retval = sc_seq_or(do_page_down, 0);
break;
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
* console/Mach console/Eterm. */
- retval = NANO_HOME_KEY;
+ retval = sc_seq_or(do_home, 0);
break;
case 'I': /* Esc [ I == PageUp on FreeBSD
* console. */
- retval = NANO_PREVPAGE_KEY;
+ retval = sc_seq_or(do_page_up, 0);
break;
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD
* console. */
- retval = NANO_INSERTFILE_KEY;
+ retval = sc_seq_or(do_insertfile_void, 0);
break;
case 'M': /* Esc [ M == F1 on FreeBSD console. */
retval = KEY_F(1);
retval = KEY_F(8);
break;
case 'U': /* Esc [ U == PageDown on Mach console. */
- retval = NANO_NEXTPAGE_KEY;
+ retval = sc_seq_or(do_page_down, 0);
break;
case 'V': /* Esc [ V == PageUp on Mach console. */
- retval = NANO_PREVPAGE_KEY;
+ retval = sc_seq_or(do_page_up, 0);
break;
case 'W': /* Esc [ W == F11 on FreeBSD console. */
retval = KEY_F(11);
retval = KEY_F(12);
break;
case 'Y': /* Esc [ Y == End on Mach console. */
- retval = NANO_END_KEY;
+ retval = sc_seq_or(do_end, 0);
break;
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
retval = KEY_F(14);
{
switch (tolower(kbinput)) {
case 'a':
- return NANO_PREVLINE_KEY;
+ return sc_seq_or(do_up_void, 0);;
case 'b':
- return NANO_NEXTLINE_KEY;
+ return sc_seq_or(do_down_void, 0);;
case 'c':
- return NANO_FORWARD_KEY;
+ return sc_seq_or(do_right, 0);;
case 'd':
- return NANO_BACK_KEY;
+ return sc_seq_or(do_left, 0);;
default:
return ERR;
}
* wheel is equivalent to moving down three lines. */
for (i = 0; i < 3; i++)
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
- NANO_PREVLINE_KEY : NANO_NEXTLINE_KEY, FALSE,
+ sc_seq_or(do_up_void, 0) : sc_seq_or(do_down_void, 0);, FALSE,
FALSE);
return 1;