/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
#ifdef ENABLE_MULTIBUFFER
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
- IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
- 0, VIEW, do_exit);
+ IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
+ NANO_NO_KEY, VIEW, do_exit);
else
#endif
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
- IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
- 0, VIEW, do_exit);
+ IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
+ NANO_NO_KEY, VIEW, do_exit);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
- IFHELP(nano_writeout_msg, 0), NANO_WRITEOUT_FKEY,
- 0, NOVIEW, do_writeout_void);
+ IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY,
+ NANO_NO_KEY, NOVIEW, do_writeout_void);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
- IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY,
- 0, NOVIEW, do_justify);
+ IFHELP(nano_justify_msg, NANO_NO_KEY),
+ NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW, do_justify);
/* this is so we can view multiple files */
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
- IFHELP(nano_insert_msg, 0), NANO_INSERTFILE_FKEY,
- 0,
+ IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY,
+ NANO_NO_KEY,
#ifdef ENABLE_MULTIBUFFER
VIEW
#else
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
- IFHELP(nano_whereis_msg, 0), NANO_WHEREIS_FKEY,
- 0, VIEW, do_search);
+ IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY,
+ NANO_NO_KEY, VIEW, do_search);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
- IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
- 0, VIEW, do_page_up);
+ IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
+ NANO_NO_KEY, VIEW, do_page_up);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
- IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
- 0, VIEW, do_page_down);
+ IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
+ NANO_NO_KEY, VIEW, do_page_down);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
- IFHELP(nano_cut_msg, 0), NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
+ IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY,
+ NANO_NO_KEY, NOVIEW, do_cut_text);
if (unjustify)
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
- IFHELP(nano_unjustify_msg, 0), 0, 0, NOVIEW, do_uncut_text);
+ IFHELP(nano_unjustify_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_uncut_text);
else
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
- IFHELP(nano_uncut_msg, 0), NANO_UNCUT_FKEY,
- 0, NOVIEW, do_uncut_text);
+ IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY,
+ NANO_NO_KEY, NOVIEW, do_uncut_text);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
- IFHELP(nano_cursorpos_msg, 0), NANO_CURSORPOS_FKEY,
- 0, VIEW, do_cursorpos_void);
+ IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY,
+ NANO_NO_KEY, VIEW, do_cursorpos_void);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
- IFHELP(nano_spell_msg, 0), NANO_SPELL_FKEY,
- 0, NOVIEW, do_spell);
+ IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY,
+ NANO_NO_KEY, NOVIEW, do_spell);
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
- IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
- NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
+ IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
+ NANO_NO_KEY, VIEW, do_gotoline_void);
sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
- IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
- NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
+ IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
+ NANO_NO_KEY, NOVIEW, do_replace);
sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
- IFHELP(nano_up_msg, 0), 0, 0, VIEW, do_up);
+ IFHELP(nano_up_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_up);
sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
- IFHELP(nano_down_msg, 0), 0, 0, VIEW, do_down);
+ IFHELP(nano_down_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_down);
sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
- IFHELP(nano_forward_msg, 0), 0, 0, VIEW, do_right);
+ IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_right);
sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
- IFHELP(nano_back_msg, 0), 0, 0, VIEW, do_left);
+ IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_left);
sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
- IFHELP(nano_home_msg, 0), 0, 0, VIEW, do_home);
+ IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_home);
sc_init_one(&main_list, NANO_END_KEY, _("End"),
- IFHELP(nano_end_msg, 0), 0, 0, VIEW, do_end);
+ IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_end);
sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
- IFHELP(nano_refresh_msg, 0), 0, 0, VIEW, total_refresh);
+ IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, total_refresh);
sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
- 0, 0, NOVIEW, do_mark);
+ NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_mark);
sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
- IFHELP(nano_delete_msg, 0), 0, 0, NOVIEW, do_delete);
+ IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_delete);
sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
- IFHELP(nano_backspace_msg, 0), 0, 0, NOVIEW, do_backspace);
+ IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_backspace);
sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
- IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
+ IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_tab);
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
- IFHELP(nano_enter_msg, 0), 0, 0, NOVIEW, do_enter);
+ IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, do_enter);
#ifndef NANO_SMALL
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
- IFHELP(nano_nextword_msg, 0), 0, 0, VIEW, do_next_word);
+ IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_next_word);
- sc_init_one(&main_list, -1, _("Prev Word"),
- IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY),
- 0, 0, VIEW, do_prev_word);
+ sc_init_one(&main_list, NANO_NO_KEY, _("Prev Word"),
+ IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_prev_word);
#endif
- sc_init_one(&main_list, -1, _("Verbatim Input"),
- IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY),
- 0, 0, VIEW, do_verbatim_input);
+ sc_init_one(&main_list, NANO_NO_KEY, _("Verbatim Input"),
+ IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_verbatim_input);
#ifdef ENABLE_MULTIBUFFER
- sc_init_one(&main_list, -1, _("Previous File"),
- IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
- 0, NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
+ sc_init_one(&main_list, NANO_NO_KEY, _("Previous File"),
+ IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
+ NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
- sc_init_one(&main_list, -1, _("Next File"),
- IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
- 0, NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
+ sc_init_one(&main_list, NANO_NO_KEY, _("Next File"),
+ IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
+ NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
- sc_init_one(&main_list, -1, _("Find Other Bracket"),
- IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
- 0, 0, VIEW, do_find_bracket);
+ sc_init_one(&main_list, NANO_NO_KEY, _("Find Other Bracket"),
+ IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_find_bracket);
#endif
- sc_init_one(&main_list, -1, _("Where Is Next"),
+ sc_init_one(&main_list, NANO_NO_KEY, _("Where Is Next"),
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
- 0, 0, VIEW, do_research);
+ NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
free_shortcutage(&whereis_list);
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
- IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
+ IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_first_line);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
- IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
+ IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_last_line);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
- IFHELP(nano_replace_msg, 0), NANO_REPLACE_FKEY,
- 0, VIEW, do_replace);
+ IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
+ NANO_NO_KEY, VIEW, do_replace);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
- IFHELP(nano_goto_msg, 0), NANO_GOTO_FKEY,
- 0, VIEW, do_gotoline_void);
+ IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
+ NANO_NO_KEY, VIEW, do_gotoline_void);
#ifndef DISABLE_JUSTIFY
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, _("Beg of Par"),
- IFHELP(nano_parabegin_msg, 0), 0, 0, VIEW, do_para_begin);
+ IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_para_begin);
/* Translators: try to keep this string under 10 characters long */
sc_init_one(&whereis_list, NANO_PARAEND_KEY, _("End of Par"),
- IFHELP(nano_paraend_msg, 0), 0, 0, VIEW, do_para_end);
+ IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_para_end);
#endif
#ifndef NANO_SMALL
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"),
- IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&whereis_list, NANO_NO_KEY, _("Case Sens"),
+ IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
- IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&whereis_list, NANO_NO_KEY, _("Direction"),
+ IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#ifdef HAVE_REGEX_H
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
- IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&whereis_list, NANO_NO_KEY, _("Regexp"),
+ IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
#ifndef NANO_SMALL
/* Translators: try to keep this string under 10 characters long */
- sc_init_one(&whereis_list, NANO_UP_KEY, _("History"),
- IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
+ sc_init_one(&whereis_list, NANO_HISTORY_KEY, _("History"),
+ IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
#endif /* !NANO_SMALL */
free_shortcutage(&replace_list);
sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
- IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
+ IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_first_line);
sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
- IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
+ IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_last_line);
/* Translators: try to keep this string under 12 characters long */
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
- IFHELP(nano_whereis_msg, 0), NANO_REPLACE_FKEY,
- 0, VIEW, do_search);
+ IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
+ NANO_NO_KEY, VIEW, do_search);
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
- IFHELP(nano_goto_msg, 0), NANO_GOTO_FKEY,
- 0, VIEW, do_gotoline_void);
+ IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
+ NANO_NO_KEY, VIEW, do_gotoline_void);
#ifndef NANO_SMALL
- sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
- IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&replace_list, NANO_NO_KEY, _("Case Sens"),
+ IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
- sc_init_one(&replace_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
- IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&replace_list, NANO_NO_KEY, _("Direction"),
+ IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#ifdef HAVE_REGEX_H
- sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"),
- IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
+ sc_init_one(&replace_list, NANO_NO_KEY, _("Regexp"),
+ IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
- sc_init_one(&replace_list, NANO_UP_KEY, _("History"),
- IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
+ sc_init_one(&replace_list, NANO_HISTORY_KEY, _("History"),
+ IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_DOWN_KEY, VIEW, 0);
#endif /* !NANO_SMALL */
free_shortcutage(&replace_list_2);
sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
- IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
+ IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_first_line);
sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
- IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
+ IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_last_line);
#ifndef NANO_SMALL
sc_init_one(&replace_list_2, NANO_UP_KEY, _("History"),
- IFHELP(nano_editstr_msg, 0), 0, NANO_DOWN_KEY, VIEW, 0);
+ IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_DOWN_KEY, VIEW, 0);
#endif
free_shortcutage(&goto_list);
sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
- IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
+ IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_first_line);
sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
- IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
+ IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, do_last_line);
#ifndef DISABLE_HELP
free_shortcutage(&help_list);
sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
- IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
- 0, VIEW, do_page_up);
+ IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
+ NANO_NO_KEY, VIEW, do_page_up);
sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
- IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
- 0, VIEW, do_page_down);
+ IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
+ NANO_NO_KEY, VIEW, do_page_down);
sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
- IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY,
- 0, VIEW, do_exit);
+ IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
+ NANO_NO_KEY, VIEW, do_exit);
#endif
free_shortcutage(&writefile_list);
sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
#ifndef DISABLE_BROWSER
/* Translators: try to keep this string under 16 characters long */
sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
- IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
+ IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#endif
#ifndef NANO_SMALL
/* Translators: try to keep this string under 16 characters long */
- sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"),
- IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&writefile_list, NANO_NO_KEY, _("DOS Format"),
+ IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
/* Translators: try to keep this string under 16 characters long */
- sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"),
- IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&writefile_list, NANO_NO_KEY, _("Mac Format"),
+ IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#endif
/* Translators: try to keep this string under 16 characters long */
- sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"),
- IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&writefile_list, NANO_NO_KEY, _("Append"),
+ IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
/* Translators: try to keep this string under 16 characters long */
- sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
- IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&writefile_list, NANO_NO_KEY, _("Prepend"),
+ IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#ifndef NANO_SMALL
/* Translators: try to keep this string under 16 characters long */
- sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
- IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&writefile_list, NANO_NO_KEY, _("Backup File"),
+ IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#endif
sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
free_shortcutage(&insertfile_list);
sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#ifndef DISABLE_BROWSER
sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
- IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
+ IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#endif
#ifndef NANO_SMALL
/* Translators: try to keep this string under 22 characters long */
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
- IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
+ IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#ifdef ENABLE_MULTIBUFFER
/* Translators: try to keep this string under 22 characters long */
- sc_init_one(&insertfile_list, TOGGLE_MULTIBUFFER_KEY, _("New Buffer"),
- IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
+ sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
+ IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, NOVIEW, 0);
#endif
#endif
free_shortcutage(&spell_list);
sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
#ifndef NANO_SMALL
free_shortcutage(&extcmd_list);
sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
#ifndef DISABLE_BROWSER
free_shortcutage(&browser_list);
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
- IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
- 0, VIEW, 0);
+ IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
+ NANO_NO_KEY, VIEW, 0);
sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
- IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
- 0, VIEW, 0);
+ IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
+ NANO_NO_KEY, VIEW, 0);
/* Translators: try to keep this string under 22 characters long */
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
- IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
- NANO_GOTO_FKEY, 0, VIEW, 0);
+ IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
+ NANO_NO_KEY, VIEW, 0);
free_shortcutage(&gotodir_list);
sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
- IFHELP(nano_help_msg, 0), NANO_HELP_FKEY,
- 0, VIEW, do_help);
+ IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
+ NANO_NO_KEY, VIEW, do_help);
sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
- IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
+ IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
+ NANO_NO_KEY, VIEW, 0);
#endif
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
/* Read in a single input character. If it's ignored, swallow it and go
* on. Otherwise, try to translate it from ASCII and extended (keypad)
* input. Assume nodelay(win) is FALSE. */
-int get_kbinput(WINDOW *win, int *meta, int rebind_delete)
+int get_kbinput(WINDOW *win, int *meta)
{
int kbinput, retval;
kbinput = get_ignored_kbinput(win);
- retval = get_accepted_kbinput(win, kbinput, meta, rebind_delete);
+ retval = get_accepted_kbinput(win, kbinput, meta);
return retval;
}
/* Read in a string of input characters (e. g. an escape sequence)
* verbatim, and return the length of the string in kbinput_len. Assume
* nodelay(win) is FALSE. */
-char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len)
+char *get_verbatim_kbinput(WINDOW *win, int *kbinput_len,
+ int allow_ascii)
{
char *verbatim_kbinput;
int kbinput = wgetch(win);
verbatim_kbinput[0] = kbinput;
*kbinput_len = 1;
- if (kbinput >= '0' && kbinput <= '2')
+ if (allow_ascii && kbinput >= '0' && kbinput <= '2')
/* Entering a three-digit decimal ASCII code from 000-255 in
* verbatim mode will produce the corresponding ASCII
* character. */
/* Translate acceptable ASCII and extended (keypad) input. Set meta to
* 1 if we get a Meta sequence. Assume nodelay(win) is FALSE. */
-int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta,
- int rebind_delete)
+int get_accepted_kbinput(WINDOW *win, int kbinput, int *meta)
{
*meta = 0;
else if (kbinput >= 'a' && kbinput <= '~')
kbinput -= 96;
break;
+ case 'O':
+ case 'o':
/* Terminal breakage, part 1: We shouldn't get an escape
* sequence here for terminals that support Delete, but
* we do sometimes on FreeBSD. Thank you, Wouter van
* Hemel. */
case '[':
+ {
+ int old_kbinput = kbinput, escape_seq_len;
+ char *escape_seq;
nodelay(win, TRUE);
kbinput = wgetch(win);
switch (kbinput) {
case ERR:
- kbinput = '[';
+ kbinput = tolower(old_kbinput);
*meta = 1;
break;
default:
- kbinput = get_escape_seq_kbinput(win, kbinput);
+ ungetch(kbinput);
+ ungetch(old_kbinput);
+ escape_seq = get_verbatim_kbinput(win, &escape_seq_len, 0);
+ kbinput = get_escape_seq_kbinput(win, escape_seq, escape_seq_len);
+ free(escape_seq);
}
nodelay(win, FALSE);
break;
+ }
default:
/* Esc [character] == Meta-[character] */
kbinput = tolower(kbinput);
break;
case NANO_CONTROL_8:
/* Terminal breakage, part 2: We shouldn't get Ctrl-8
- * (Ctrl-?) for Backspace, but we do sometimes on Linux. */
- kbinput = NANO_BACKSPACE_KEY;
+ * (Ctrl-?) for Backspace or Delete, but we do sometimes. */
+ kbinput = ISSET(REBIND_DELETE) ? NANO_DELETE_KEY : NANO_BACKSPACE_KEY;
break;
case KEY_DOWN:
kbinput = NANO_DOWN_KEY;
/* Terminal breakage, part 3: We should only get KEY_DC when
* hitting Delete, but we get it when hitting Backspace
* sometimes on FreeBSD. Thank you, Lee Nelson. */
- kbinput = (rebind_delete) ? NANO_BACKSPACE_KEY : NANO_DELETE_KEY;
+ kbinput = ISSET(REBIND_DELETE) ? NANO_BACKSPACE_KEY : NANO_DELETE_KEY;
break;
case KEY_IC:
kbinput = NANO_INSERTFILE_KEY;
case KEY_SUSPEND:
kbinput = NANO_SUSPEND_KEY;
break;
+ case KEY_SLEFT:
+ kbinput = NANO_BACK_KEY;
+ break;
+ case KEY_SRIGHT:
+ kbinput = NANO_FORWARD_KEY;
+ break;
}
#ifdef DEBUG
fprintf(stderr, "get_accepted_kbinput(): kbinput = %d, meta = %d\n", kbinput, *meta);
case '0':
case '1':
case '2':
- retval = (kbinput - 48) * 100;
+ retval = (kbinput - '0') * 100;
break;
default:
return kbinput;
case '3':
case '4':
case '5':
- retval += (kbinput - 48) * 10;
+ retval += (kbinput - '0') * 10;
break;
case '6':
case '7':
case '8':
case '9':
if (retval < 200) {
- retval += (kbinput - 48) * 10;
+ retval += (kbinput - '0') * 10;
break;
}
default:
case '3':
case '4':
case '5':
- retval += kbinput - 48;
+ retval += kbinput - '0';
break;
case '6':
case '7':
case '8':
case '9':
if (retval < 250) {
- retval += kbinput - 48;
+ retval += kbinput - '0';
break;
}
default:
}
/* Translate common escape sequences for some keys. These are generated
- * when the terminal doesn't support those keys. Assume nodelay(win) is
- * TRUE. */
-int get_escape_seq_kbinput(WINDOW *win, int kbinput)
+ * when the terminal doesn't support those keys. Assume that Escape has
+ * already been read in, and that nodelay(win) is TRUE. */
+int get_escape_seq_kbinput(WINDOW *win, char *escape_seq, int
+ escape_seq_len)
{
- switch (kbinput) {
- case '3':
- /* Esc [ 3 ~ == kdch1 on many terminals. */
- kbinput = get_skip_tilde_kbinput(win, kbinput, NANO_DELETE_KEY);
- break;
+ int kbinput = -1;
+
+ if (escape_seq_len > 1) {
+ switch (escape_seq[0]) {
+ case 'O':
+ switch (escape_seq[1]) {
+ case 'A': /* Esc O A == Up on xterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'B': /* Esc O B == Down on xterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'C': /* Esc O C == Right on xterm. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'D': /* Esc O D == Left on xterm. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ case 'F': /* Esc O F == End on xterm. */
+ kbinput = NANO_END_KEY;
+ break;
+ case 'H': /* Esc O H == Home on xterm. */
+ kbinput = NANO_HOME_KEY;
+ break;
+ case 'a': /* Esc O a == Ctrl-Up on rxvt. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'b': /* Esc O b == Ctrl-Down on rxvt. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'c': /* Esc O c == Ctrl-Right on rxvt. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'd': /* Esc O d == Ctrl-Left on rxvt. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ }
+ break;
+ case 'o':
+ switch (escape_seq[1]) {
+ case 'a': /* Esc o a == Ctrl-Up on Eterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'b': /* Esc o b == Ctrl-Down on Eterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'c': /* Esc o c == Ctrl-Right on Eterm. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'd': /* Esc o d == Ctrl-Left on Eterm. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ }
+ break;
+ case '[':
+ switch (escape_seq[1]) {
+ case '1':
+ if (escape_seq_len >= 5) {
+ if (!strncmp(escape_seq, "[1;2", 4)) {
+ switch (escape_seq[4]) {
+ case 'A':
+ /* Esc [ 1 ; 2 A == Shift-Up on
+ * xterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'B':
+ /* Esc [ 1 ; 2 B == Shift-Down
+ * on xterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'C':
+ /* Esc [ 1 ; 2 C == Shift-Right
+ * on xterm. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'D':
+ /* Esc [ 1 ; 2 D == Shift-Left
+ * on xterm. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ }
+ } else if (!strncmp(escape_seq, "[1;5", 4)) {
+ switch (escape_seq[4]) {
+ case 'A':
+ /* Esc [ 1 ; 5 A == Ctrl-Up on
+ * xterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'B':
+ /* Esc [ 1 ; 5 B == Ctrl-Down on
+ * xterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'C':
+ /* Esc [ 1 ; 5 C == Ctrl-Right
+ * on xterm. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'D':
+ /* Esc [ 1 ; 5 D == Ctrl-Left on
+ * xterm. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ }
+ }
+ break;
+ } else {
+ /* Esc [ 1 ~ == Home on Linux console. */
+ kbinput = NANO_HOME_KEY;
+ break;
+ }
+ case '2': /* Esc [ 2 ~ == Insert on Linux
+ * console/xterm. */
+ kbinput = NANO_INSERTFILE_KEY;
+ break;
+ case '3': /* Esc [ 3 ~ == Delete on Linux
+ * console/xterm. */
+ kbinput = NANO_DELETE_KEY;
+ break;
+ case '4': /* Esc [ 4 ~ == End on Linux
+ * console/xterm. */
+ kbinput = NANO_END_KEY;
+ break;
+ case '5': /* Esc [ 5 ~ == PageUp on Linux
+ * console/xterm, Esc [ 5 ^ == PageUp on
+ * Eterm. */
+ kbinput = NANO_PREVPAGE_KEY;
+ break;
+ case '6': /* Esc [ 6 ~ == PageDown on Linux
+ * console/xterm, Esc [ 6 ^ == PageDown on
+ * Eterm. */
+ kbinput = NANO_NEXTPAGE_KEY;
+ break;
+ case '7': /* Esc [ 7 ~ == Home on rxvt. */
+ kbinput = NANO_HOME_KEY;
+ break;
+ case '8': /* Esc [ 8 ~ == End on rxvt. */
+ kbinput = NANO_END_KEY;
+ break;
+ case '9': /* Esc [ 9 == Delete on Hurd console. */
+ kbinput = NANO_DELETE_KEY;
+ break;
+ case '@': /* Esc [ @ == Insert on Hurd console. */
+ kbinput = NANO_INSERTFILE_KEY;
+ break;
+ case 'A': /* Esc [ A == Up on Linux console/FreeBSD
+ * console/Hurd console/rxvt/Eterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'B': /* Esc [ B == Down on Linux
+ * console/FreeBSD console/Hurd
+ * console/rxvt/Eterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'C': /* Esc [ C == Right on Linux
+ * console/FreeBSD console/Hurd
+ * console/rxvt/Eterm. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'D': /* Esc [ D == Left on Linux
+ * console/FreeBSD console/Hurd
+ * console/rxvt/Eterm. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ case 'F': /* Esc [ F == End on FreeBSD
+ * console/Eterm. */
+ kbinput = NANO_END_KEY;
+ break;
+ case 'G': /* Esc [ G == PageDown on FreeBSD
+ * console. */
+ kbinput = NANO_NEXTPAGE_KEY;
+ break;
+ case 'H': /* Esc [ H == Home on FreeBSD
+ * console/Hurd console/Eterm. */
+ kbinput = NANO_HOME_KEY;
+ break;
+ case 'I': /* Esc [ I == PageUp on FreeBSD
+ * console. */
+ kbinput = NANO_PREVPAGE_KEY;
+ break;
+ case 'L': /* Esc [ L == Insert on FreeBSD
+ * console. */
+ kbinput = NANO_INSERTFILE_KEY;
+ break;
+ case 'U': /* Esc [ U == PageDown on Hurd console. */
+ kbinput = NANO_NEXTPAGE_KEY;
+ break;
+ case 'V': /* Esc [ V == PageUp on Hurd console. */
+ kbinput = NANO_PREVPAGE_KEY;
+ break;
+ case 'Y': /* Esc [ Y == End on Hurd console. */
+ kbinput = NANO_END_KEY;
+ break;
+ case 'a': /* Esc [ a == Shift-Up on rxvt and
+ * Eterm. */
+ kbinput = NANO_UP_KEY;
+ break;
+ case 'b': /* Esc [ b == Shift-Down on rxvt and
+ * Eterm. */
+ kbinput = NANO_DOWN_KEY;
+ break;
+ case 'c': /* Esc [ c == Shift-Right on rxvt. */
+ kbinput = NANO_FORWARD_KEY;
+ break;
+ case 'd': /* Esc [ d == Shift-Left on rxvt. */
+ kbinput = NANO_BACK_KEY;
+ break;
+ }
+ break;
+ }
}
- return kbinput;
-}
-/* If there is no next character, return the passed-in error value. If
- * the next character's a tilde, eat it and return the passed-in
- * return value. Otherwise, return the next character. Assume
- * nodelay(win) is TRUE. */
-int get_skip_tilde_kbinput(WINDOW *win, int errval, int retval)
-{
- int kbinput = wgetch(win);
- switch (kbinput) {
- case ERR:
- return errval;
- case '~':
- return retval;
- default:
- return kbinput;
+ if (kbinput == -1) {
+ /* This escape sequence is unrecognized; send it back. */
+ for (; escape_seq_len > 1; escape_seq_len--)
+ ungetch(escape_seq[escape_seq_len - 1]);
+ kbinput = escape_seq[0];
}
+
+ return kbinput;
}
#ifndef DISABLE_MOUSE
-/* Check for a mouse event. If it took place on the shortcut list on
- * the bottom two lines of the screen (assuming that the shortcut list is
- * visible), figure out which shortcut was clicked and ungetch() the
- * equivalent keystroke(s), otherwise do nothing. Return 0 if no
- * keystrokes were ungetch()ed, or 1 if at least one was. Also, return
- * the screen coordinates where the mouse event took place in *mouse_x
- * and *mouse_y. Assume that KEY_MOUSE has already been read in. */
-int get_mouseinput(int *mouse_x, int *mouse_y)
+/* Check for a mouse event, and if one's taken place, save the
+ * coordinates where it took place in mouse_x and mouse_y. After that,
+ * if allow_shortcuts is zero, return 0. Otherwise, if the mouse event
+ * took place on the shortcut list on the bottom two lines of the screen
+ * (assuming that the shortcut list is visible), figure out which
+ * shortcut was clicked and ungetch() the equivalent keystroke(s).
+ * Return 0 if no keystrokes were ungetch()ed, or 1 if at least one was.
+ * Assume that KEY_MOUSE has already been read in. */
+int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts)
{
MEVENT mevent;
*mouse_x = mevent.x;
*mouse_y = mevent.y;
- /* If the current shortcut list is being displayed on the last two
- * lines of the screen and the mouse event took place inside it,
- * we need to figure out which shortcut was clicked and ungetch()
- * the equivalent keystroke(s) for it. */
+ /* If we're not allowing shortcuts' we're done now. */
+ if (!allow_shortcuts)
+ return 0;
+
+ /* Otherwise, if the current shortcut list is being displayed on the
+ * last two lines of the screen and the mouse event took place
+ * inside it, we need to figure out which shortcut was clicked and
+ * ungetch() the equivalent keystroke(s) for it. */
if (!ISSET(NO_HELP) && wenclose(bottomwin, *mouse_y, *mouse_x)) {
int i, j;
int currslen;
input */
wrefresh(edit);
- while ((kbinput = get_kbinput(bottomwin, &meta, ISSET(REBIND_DELETE))) != NANO_ENTER_KEY) {
+ while ((kbinput = get_kbinput(bottomwin, &meta)) != NANO_ENTER_KEY) {
for (t = s; t != NULL; t = t->next) {
#ifdef DEBUG
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput, kbinput);
fprintf(stderr, "Aha! \'%c\' (%d)\n", kbinput,
kbinput);
#endif
- if (meta == 1 && kbinput == t->val)
+ if (meta == 1 && kbinput == t->altval)
/* We hit an Alt key. Do like above. We don't
just ungetch() the letter and let it get
caught above cause that screws the
keypad... */
- return t->val;
+ return t->altval;
}
if (is_cntrl_char(kbinput))
wmove(bottomwin, 1 + j, i * (COLS / numcols));
/* Yucky sentinel values we can't handle a better way */
- if (s->val == NANO_CONTROL_SPACE)
- strcpy(keystr, "^ ");
+ if (s->val != NANO_NO_KEY) {
#ifndef NANO_SMALL
- else if (s->val == NANO_UP_KEY && s->misc == NANO_DOWN_KEY)
- strncpy(keystr, _("Up"), 8);
-#endif /* NANO_SMALL */
- else if (s->val > 0) {
- if (s->val < 64)
- sprintf(keystr, "^%c", s->val + 64);
+ if (s->val == NANO_HISTORY_KEY)
+ strncpy(keystr, _("Up"), 8);
+ else
+#endif
+ if (s->val == NANO_CONTROL_SPACE)
+ strcpy(keystr, "^ ");
+ else if (s->val == NANO_CONTROL_8)
+ strcpy(keystr, "^?");
else
- sprintf(keystr, "M-%c", toupper(s->val));
- } else if (s->altval > 0)
- sprintf(keystr, "M-%c", s->altval);
+ sprintf(keystr, "^%c", s->val + 64);
+ } else if (s->altval != NANO_NO_KEY)
+ sprintf(keystr, "M-%c", toupper(s->altval));
onekey(keystr, s->desc, COLS / numcols);
/* Ask a simple yes/no question on the statusbar. Returns 1 for Y, 0
* for N, 2 for All (if all is nonzero when passed in) and -1 for abort
* (^C). */
-int do_yesno(int all, int leavecursor, const char *msg, ...)
+int do_yesno(int all, const char *msg)
{
- va_list ap;
- char *foo;
- int ok = -2;
+ int ok = -2, width = 16;
const char *yesstr; /* String of yes characters accepted */
const char *nostr; /* Same for no */
const char *allstr; /* And all, surprise! */
if (!ISSET(NO_HELP)) {
char shortstr[3]; /* Temp string for Y, N, A. */
+ if (COLS < 32)
+ width = COLS / 2;
+
/* Write the bottom of the screen. */
blank_bottombars();
sprintf(shortstr, " %c", yesstr[0]);
wmove(bottomwin, 1, 0);
- onekey(shortstr, _("Yes"), 16);
+ onekey(shortstr, _("Yes"), width);
if (all) {
- wmove(bottomwin, 1, 16);
+ wmove(bottomwin, 1, width);
shortstr[1] = allstr[0];
- onekey(shortstr, _("All"), 16);
+ onekey(shortstr, _("All"), width);
}
wmove(bottomwin, 2, 0);
shortstr[1] = nostr[0];
- onekey(shortstr, _("No"), 16);
+ onekey(shortstr, _("No"), width);
wmove(bottomwin, 2, 16);
- onekey("^C", _("Cancel"), 16);
+ onekey("^C", _("Cancel"), width);
}
- foo = charalloc(COLS);
- va_start(ap, msg);
- vsnprintf(foo, COLS, msg, ap);
- va_end(ap);
- foo[COLS - 1] = '\0';
-
wattron(bottomwin, A_REVERSE);
blank_statusbar();
- mvwaddstr(bottomwin, 0, 0, foo);
- free(foo);
+ mvwaddnstr(bottomwin, 0, 0, msg, COLS - 1);
wattroff(bottomwin, A_REVERSE);
wrefresh(bottomwin);
do {
- int kbinput = wgetch(edit);
+ int kbinput;
+ int meta;
#ifndef DISABLE_MOUSE
- MEVENT mevent;
+ int mouse_x, mouse_y;
#endif
- if (kbinput == NANO_CONTROL_C)
+ kbinput = get_kbinput(edit, &meta);
+
+ if (kbinput == NANO_CANCEL_KEY)
ok = -1;
#ifndef DISABLE_MOUSE
- /* Look ma! We get to duplicate lots of code from do_mouse!! */
- else if (kbinput == KEY_MOUSE && getmouse(&mevent) != ERR &&
- wenclose(bottomwin, mevent.y, mevent.x) &&
- !ISSET(NO_HELP) && mevent.x < 32 &&
- mevent.y >= editwinrows + 3) {
- int x = mevent.x /= 16;
- /* Did we click in the first column of shortcuts, or the
- * second? */
- int y = mevent.y - editwinrows - 3;
- /* Did we click in the first row of shortcuts? */
-
- assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
- /* x = 0 means they clicked Yes or No.
- * y = 0 means Yes or All. */
- ok = -2 * x * y + x - y + 1;
-
- if (ok == 2 && !all)
- ok = -2;
+ /* Look ma! We get to duplicate lots of code from
+ * do_mouse()!! */
+ else if (kbinput == KEY_MOUSE) {
+ kbinput = get_mouseinput(&mouse_x, &mouse_y, 0);
+
+ if (mouse_x != -1 && mouse_y != -1 && !ISSET(NO_HELP) &&
+ wenclose(bottomwin, mouse_y, mouse_x) && mouse_x <
+ (width * 2) && mouse_y >= editwinrows + 3) {
+
+ int x = mouse_x / width;
+ /* Did we click in the first column of shortcuts, or
+ * the second? */
+ int y = mouse_y - editwinrows - 3;
+ /* Did we click in the first row of shortcuts? */
+
+ assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
+
+ /* x = 0 means they clicked Yes or No.
+ * y = 0 means Yes or All. */
+ ok = -2 * x * y + x - y + 1;
+
+ if (ok == 2 && !all)
+ ok = -2;
+ }
}
#endif
/* Look for the kbinput in the yes, no and (optionally) all
ok = 2;
} while (ok == -2);
- /* Then blank the statusbar. */
- blank_statusbar_refresh();
-
return ok;
}
no_more = 1;
continue;
}
- } while ((kbinput = get_kbinput(edit, &meta, ISSET(REBIND_DELETE))) != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
+ } while ((kbinput = get_kbinput(edit, &meta)) != NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
currshortcut = oldshortcut;