-/* $Id$ */
+/* $Id$
+*/
/**************************************************************************
* global.c *
* *
* *
**************************************************************************/
+#include <ctype.h>
+#include <strings.h>
+#include "assert.h"
#include "proto.h"
/* Global variables. */
/* The command to use for the alternate spell checker. */
#endif
-shortcut *main_list = NULL;
- /* The main shortcut list. */
-shortcut *whereis_list = NULL;
- /* The "Search" shortcut list. */
-shortcut *replace_list = NULL;
- /* The "Search (to replace)" shortcut list. */
-shortcut *replace_list_2 = NULL;
- /* The "Replace with" shortcut list. */
-shortcut *gotoline_list = NULL;
- /* The "Enter line number, column number" shortcut list. */
-shortcut *writefile_list = NULL;
- /* The "File Name to Write" shortcut list. */
-shortcut *insertfile_list = NULL;
- /* The "File to insert" shortcut list. */
-#ifndef NANO_TINY
-shortcut *extcmd_list = NULL;
- /* The "Command to execute" shortcut list. */
-#endif
-#ifndef DISABLE_HELP
-shortcut *help_list = NULL;
- /* The help text shortcut list. */
-#endif
-#ifndef DISABLE_SPELLER
-shortcut *spell_list = NULL;
- /* The internal spell checker shortcut list. */
-#endif
-#ifndef DISABLE_BROWSER
-shortcut *browser_list = NULL;
- /* The file browser shortcut list. */
-shortcut *whereis_file_list = NULL;
- /* The file browser "Search" shortcut list. */
-shortcut *gotodir_list = NULL;
- /* The "Go To Directory" shortcut list. */
-#endif
-
#ifdef ENABLE_COLOR
syntaxtype *syntaxes = NULL;
/* The global list of color syntaxes. */
const shortcut *currshortcut;
/* The current shortcut list we're using. */
+int currmenu;
+ /* The currently loaded menu */
+
#ifndef NANO_TINY
toggle *toggles = NULL;
/* The global toggle list. */
#endif
+sc *sclist = NULL;
+ /* New shortcut key struct */
+subnfunc *allfuncs = NULL;
+ /* New struct for the function list */
+
#ifndef NANO_TINY
filestruct *search_history = NULL;
/* The search string history list. */
char *homedir = NULL;
/* The user's home directory, from $HOME or /etc/passwd. */
-/* Return the number of entries in the shortcut list s. */
-size_t length_of_list(const shortcut *s)
+/* Return the number of entries in the shortcut list s for a given menu. */
+size_t length_of_list(int menu)
{
+ subnfunc *f;
size_t i = 0;
- for (; s != NULL; s = s->next)
- i++;
+ for (f = allfuncs; f != NULL; f = f->next)
+ if ((f->menus & menu) != 0) {
+ i++;
+ }
return i;
}
-/* Add a new shortcut to the end of the shortcut list. */
-void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
-#ifndef DISABLE_HELP
- , const char *help, bool blank_after
+/* Set type of function based on the string */
+function_type strtokeytype(char *str)
+{
+ if (str[0] == 'M' || str[0] == 'm') {
+ return META;
+ } else if (str[0] == '^') {
+ return CONTROL;
+ } else if (str[0] == 'M' || str[0] == 'm') {
+ return FKEY;
+ } else {
+ return RAW;
+ }
+}
+
+/* Add a string to the new function list strict.
+ Does not allow updates, yet anyway */
+void add_to_funcs(void *func, int menus, const char *desc, const char *help,
+ bool blank_after, bool viewok)
+{
+ subnfunc *f;
+
+ if (allfuncs == NULL) {
+ allfuncs = nmalloc(sizeof(subnfunc));
+ f = allfuncs;
+ } else {
+ for (f = allfuncs; f->next != NULL; f = f->next)
+ ;
+ f->next = (subnfunc *)nmalloc(sizeof(subnfunc));
+ f = f->next;
+ }
+ f->next = NULL;
+ f->scfunc = func;
+ f->menus = menus;
+ f->desc = desc;
+ f->viewok = viewok;
+#ifndef NANO_TINY
+ f->help = help;
+ f->blank_after = blank_after;
+#endif
+
+#ifdef DEBUG
+ fprintf(stderr, "Added func \"%s\"", f->desc);
#endif
- , int metaval, int funcval, int miscval, bool view,
- void (*func)(void))
+}
+
+const sc *first_sc_for(int menu, void *func) {
+ const sc *s;
+
+ for (s = sclist; s != NULL; s = s->next) {
+ if ((s->menu & menu) && s->scfunc == func) {
+ return s;
+ }
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "Whoops, returning null given func %ld\n", (long) func);
+#endif
+ /* Otherwise... */
+ return NULL;
+}
+
+
+/* Add a string to the new shortcut list implementation
+ Allows updates to existing entries in the list */
+void add_to_sclist(int menu, char *scstring, void *func, int toggle, int execute)
{
- shortcut *s;
+ sc *s;
- if (*shortcutage == NULL) {
- *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
- s = *shortcutage;
+ if (sclist == NULL) {
+ sclist = nmalloc(sizeof(sc));
+ s = sclist;
+ s->next = NULL;
} else {
- for (s = *shortcutage; s->next != NULL; s = s->next)
- ;
- s->next = (shortcut *)nmalloc(sizeof(shortcut));
- s = s->next;
+ for (s = sclist; s->next != NULL; s = s->next)
+ if (s->menu == menu && s->keystr == scstring)
+ break;
+
+ if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
+#ifdef DEBUG
+ fprintf(stderr, "No match found...\n");
+#endif
+ s->next = (sc *)nmalloc(sizeof(sc));
+ s = s->next;
+ s->next = NULL;
+ }
}
- s->ctrlval = ctrlval;
- s->desc = (desc == NULL) ? "" : _(desc);
-#ifndef DISABLE_HELP
- s->help = (help == NULL) ? "" : _(help);
- s->blank_after = blank_after;
-#endif
- s->metaval = metaval;
- s->funcval = funcval;
- s->miscval = miscval;
- s->viewok = view;
- s->func = func;
- s->next = NULL;
+ s->type = strtokeytype(scstring);
+ s->menu = menu;
+ s->toggle = toggle;
+ s->keystr = scstring;
+ s->scfunc = func;
+ s->execute = execute;
+ assign_keyinfo(s);
+
+#ifdef DEBUG
+ fprintf(stderr, "list val = %d\n", (int) s->menu);
+ fprintf(stderr, "Hey, set sequence to %d for shortcut \"%s\"\n", s->seq, scstring);
+#endif
}
+/* Assign the info to the shortcut struct
+ Assumes keystr is already assigned, naturally */
+void assign_keyinfo(sc *s)
+{
+ if (s->type == CONTROL) {
+ assert(strlen(s->keystr) > 1);
+ s->seq = s->keystr[1] - 64;
+ } else if (s->type == META) {
+ assert(strlen(s->keystr) > 2);
+ s->seq = tolower((int) s->keystr[2]);
+ } else if (s->type == FKEY) {
+ assert(strlen(s->keystr) > 1);
+ s->seq = KEY_F0 + atoi(&s->keystr[1]);
+ } else /* raw */
+ s->seq = (int) s->keystr[0];
+}
+
+#ifdef DEBUG
+
+void print_sclist(void)
+{
+ sc *s;
+ const subnfunc *f;
+
+ 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);
+ else
+ fprintf(stderr, "Hmm, didnt find a func for \"%s\"\n", s->keystr);
+ }
+
+}
+#endif
+
+
+/* Stuff we need to make at least static here so we can access it below */
+const char *cancel_msg = N_("Cancel");
+
+#ifndef NANO_TINY
+const char *case_sens_msg = N_("Case Sens");
+const char *backwards_msg = N_("Backwards");
+#endif
+
+#ifdef HAVE_REGEX_H
+const char *regexp_msg = N_("Regexp");
+#endif
+
+/* Stuff we want to just stun out if we're in TINY mode */
+#ifdef NANO_TINY
+const char *nano_cancel_msg = "";
+const char *nano_exit_msg = "";
+const char *nano_writeout_msg = "";
+const char *nano_insert_msg = "";
+const char *nano_whereis_msg = "";
+const char *nano_prevpage_msg = "";
+const char *nano_nextpage_msg = "";
+const char *nano_cut_msg = "";
+const char *nano_uncut_msg = "";
+const char *nano_cursorpos_msg = "";
+const char *nano_lastline_msg = "";
+const char *nano_gotoline_msg = "";
+const char *nano_replace_msg = "";
+const char *nano_forward_msg = "";
+const char *nano_back_msg = "";
+const char *nano_prevline_msg = "";
+const char *nano_nextline_msg = "";
+const char *nano_home_msg = "";
+const char *nano_end_msg = "";
+const char *nano_verbatim_msg = "";
+const char *nano_tab_msg = "";
+const char *nano_enter_msg = "";
+const char *nano_delete_msg = "";
+const char *nano_backspace_msg = "";
+const char *nano_regexp_msg = "";
+const char *gototext_msg = "";
+const char *do_para_begin_void = "";
+const char *do_para_end_void = "";
+const char *case_sens_msg = "";
+const char *backwards_msg = "";
+const char *do_cut_till_end = "";
+const char *dos_format_msg = "";
+const char *mac_format_msg = "";
+const char *append_msg = "";
+const char *prepend_msg = "";
+const char *backup_file_msg = "";
+const char *to_files_msg = "";
+#else /* NANO_TINY */
+const char *prev_history_msg = N_("PrevHstory");
+/* TRANSLATORS: Try to keep this and previous strings at most 10
+ * characters. */
+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");
+#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 12 characters. */
+const char *first_file_msg = N_("First File");
+/* TRANSLATORS: Try to keep this at most 12 characters. */
+const char *last_file_msg = N_("Last File");
+#endif
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *dos_format_msg = N_("DOS Format");
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *mac_format_msg = N_("Mac Format");
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *append_msg = N_("Append");
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *prepend_msg = N_("Prepend");
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *backup_file_msg = N_("Backup File");
+
+#ifdef ENABLE_MULTIBUFFER
+/* TRANSLATORS: Try to keep this at most 16 characters. */
+const char *new_buffer_msg = N_("New Buffer");
+#endif
+
+#endif
+
/* Initialize all shortcut lists. If unjustify is TRUE, replace the
* Uncut shortcut in the main shortcut list with UnJustify. */
void shortcut_init(bool unjustify)
{
/* TRANSLATORS: Try to keep this and following strings at most 10
* characters. */
- const char *cancel_msg = N_("Cancel");
const char *get_help_msg = N_("Get Help");
const char *exit_msg = N_("Exit");
const char *whereis_msg = N_("Where Is");
const char *prev_page_msg = N_("Prev Page");
const char *next_page_msg = N_("Next Page");
- const char *go_to_line_msg = N_("Go To Line");
- /* TRANSLATORS: Try to keep this and previous strings at most 10
- * characters. */
- const char *replace_msg = N_("Replace");
+ /* 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");
const char *fulljstify_msg = N_("FullJstify");
#endif
const char *refresh_msg = N_("Refresh");
-#ifndef NANO_TINY
- const char *case_sens_msg = N_("Case Sens");
- const char *backwards_msg = N_("Backwards");
-#endif
-#ifdef HAVE_REGEX_H
- const char *regexp_msg = N_("Regexp");
-#endif
-#ifndef NANO_TINY
- const char *prev_history_msg = N_("PrevHstory");
- /* TRANSLATORS: Try to keep this and previous strings at most 10
- * characters. */
- const char *next_history_msg = N_("NextHstory");
-#ifdef ENABLE_MULTIBUFFER
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- const char *new_buffer_msg = N_("New Buffer");
-#endif
-#endif
-#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 12 characters. */
- const char *first_file_msg = N_("First File");
- /* TRANSLATORS: Try to keep this at most 12 characters. */
- const char *last_file_msg = N_("Last File");
-#endif
+ 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");
+
#ifndef DISABLE_HELP
const char *nano_cancel_msg = N_("Cancel the current function");
const char *nano_help_msg = N_("Display this help text");
N_("Display the position of the cursor");
const char *nano_spell_msg =
N_("Invoke the spell checker, if available");
- const char *nano_gotoline_msg = N_("Go to line and column number");
const char *nano_replace_msg =
N_("Replace a string or a regular expression");
+ const char *nano_gotoline_msg = N_("Go to line and column number");
#ifndef NANO_TINY
const char *nano_mark_msg = N_("Mark text at the cursor position");
const char *nano_whereis_next_msg = N_("Repeat last search");
const char *nano_lastfile_msg =
N_("Go to the last file in the list");
const char *nano_gotodir_msg = N_("Go to directory");
+
#endif
#endif /* !DISABLE_HELP */
-/* The following macro is to be used in calling sc_init_one(). The
- * point is that sc_init_one() takes 10 arguments, unless DISABLE_HELP
- * is defined, when the 4th and 5th ones should not be there. */
#ifndef DISABLE_HELP
#define IFSCHELP(help, blank, nextvar) help, blank, nextvar
#else
#define IFSCHELP(help, blank, nextvar) nextvar
#endif
- free_shortcutage(&main_list);
+ while (allfuncs != NULL) {
+ subnfunc *f = allfuncs;
+ allfuncs = (allfuncs)->next;
+ free(f);
+ }
- sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
+ add_to_funcs(do_help_void, MALL, get_help_msg, nano_help_msg,
+ FALSE, VIEW);
#endif
- );
- sc_init_one(&main_list, NANO_EXIT_KEY,
+ add_to_funcs((void *) cancel_msg,
+ (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR),
+ cancel_msg, nano_cancel_msg, FALSE, VIEW);
+
+ add_to_funcs(do_exit, MMAIN,
#ifdef ENABLE_MULTIBUFFER
/* TRANSLATORS: Try to keep this at most 10 characters. */
openfile != NULL && openfile != openfile->next ? N_("Close") :
#endif
- exit_msg, IFSCHELP(nano_exit_msg, FALSE, NANO_NO_KEY),
- NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, do_exit);
+ exit_msg, nano_exit_msg, FALSE, VIEW);
- /* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
- IFSCHELP(nano_writeout_msg, FALSE, NANO_NO_KEY),
- NANO_WRITEOUT_FKEY, NANO_NO_KEY, NOVIEW, do_writeout_void);
+ add_to_funcs(do_exit, MBROWSER|MHELP, exit_msg, nano_exit_msg, FALSE, VIEW);
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_JUSTIFY_KEY, N_("Justify"),
- IFSCHELP(nano_justify_msg, TRUE, NANO_NO_KEY),
- NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW,
+ add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"),
+ nano_writeout_msg, FALSE, NOVIEW);
+
#ifndef DISABLE_JUSTIFY
- do_justify_void
-#else
- nano_disabled_msg
+ /* TRANSLATORS: Try to keep this at most 10 characters. */
+ add_to_funcs(do_justify_void, MMAIN, N_("Justify"),
+ nano_justify_msg, TRUE, NOVIEW);
#endif
- );
/* We allow inserting files in view mode if multibuffers are
* available, so that we can view multiple files. If we're using
* reading from or writing to files not specified on the command
* line. */
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"),
- IFSCHELP(nano_insert_msg, FALSE, NANO_NO_KEY),
- NANO_INSERTFILE_FKEY, NANO_NO_KEY,
+ add_to_funcs(!ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg,
+ MMAIN, N_("Read File"), nano_insert_msg, FALSE,
#ifdef ENABLE_MULTIBUFFER
- VIEW
+ VIEW);
#else
- NOVIEW
+ NOVIEW);
#endif
- , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
- sc_init_one(&main_list, NANO_WHEREIS_KEY, whereis_msg,
- IFSCHELP(nano_whereis_msg, FALSE, NANO_NO_KEY),
- NANO_WHEREIS_FKEY, NANO_NO_KEY, VIEW, do_search);
+ add_to_funcs(do_search, MMAIN, whereis_msg,
+ nano_whereis_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg,
- IFSCHELP(nano_prevpage_msg, FALSE, NANO_NO_KEY),
- NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_up);
-
- sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg,
- IFSCHELP(nano_nextpage_msg, TRUE, NANO_NO_KEY),
- NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_down);
+ add_to_funcs(do_page_up, (MMAIN|MHELP|MBROWSER),
+ prev_page_msg, nano_prevpage_msg, FALSE, VIEW);
+ add_to_funcs(do_page_down, (MMAIN|MHELP|MBROWSER),
+ next_page_msg, nano_nextpage_msg, TRUE, VIEW);
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"),
- IFSCHELP(nano_cut_msg, FALSE, NANO_NO_KEY), NANO_CUT_FKEY,
- NANO_NO_KEY, NOVIEW, do_cut_text_void);
+ add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), nano_cut_msg,
+ FALSE, NOVIEW);
if (unjustify)
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
- IFSCHELP(NULL, FALSE, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
- NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs(do_uncut_text, MMAIN, N_("UnJustify"), "",
+ FALSE, NOVIEW);
+
else
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Text"),
- IFSCHELP(nano_uncut_msg, FALSE, NANO_NO_KEY),
- NANO_UNCUT_FKEY, NANO_NO_KEY, NOVIEW, do_uncut_text);
+ add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), nano_uncut_msg,
+ FALSE, NOVIEW);
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"),
- IFSCHELP(nano_cursorpos_msg, FALSE, NANO_NO_KEY),
- NANO_CURSORPOS_FKEY, NANO_NO_KEY, VIEW, do_cursorpos_void);
+ add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), nano_cursorpos_msg,
+ FALSE, VIEW);
/* If we're using restricted mode, spell checking is disabled
* because it allows reading from or writing to files not specified
* on the command line. */
/* TRANSLATORS: Try to keep this at most 10 characters. */
- sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"),
- IFSCHELP(nano_spell_msg, TRUE, NANO_NO_KEY), NANO_SPELL_FKEY,
- NANO_NO_KEY, NOVIEW,
#ifndef DISABLE_SPELLER
- !ISSET(RESTRICTED) ? do_spell :
+ if (!ISSET(RESTRICTED))
+ add_to_funcs(do_spell, MMAIN, N_("To Spell"), nano_spell_msg,
+ TRUE, NOVIEW);
#endif
- nano_disabled_msg);
- sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
- IFSCHELP(nano_gotoline_msg, FALSE, NANO_GOTOLINE_METAKEY),
- NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW,
- do_gotolinecolumn_void);
+ add_to_funcs(do_first_line,
+ (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
+ first_line_msg, first_line_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg
-#ifndef NANO_TINY
- , IFSCHELP(nano_replace_msg, FALSE, NANO_REPLACE_METAKEY)
-#else
- , IFSCHELP(nano_replace_msg, TRUE, NANO_REPLACE_METAKEY)
-#endif
- , NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
+ add_to_funcs(do_last_line,
+ (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
+ last_line_msg, nano_lastline_msg, TRUE, VIEW);
-#ifndef NANO_TINY
- sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
- IFSCHELP(nano_mark_msg, FALSE, NANO_MARK_METAKEY),
- NANO_MARK_FKEY, NANO_NO_KEY, VIEW, do_mark);
-
- sc_init_one(&main_list, NANO_NO_KEY, whereis_next_msg,
- IFSCHELP(nano_whereis_next_msg, TRUE, NANO_WHEREIS_NEXT_KEY),
- NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Copy Text"),
- IFSCHELP(nano_copy_msg, FALSE, NANO_COPY_KEY), NANO_NO_KEY,
- NANO_COPY_METAKEY, NOVIEW, do_copy_text);
+ add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS),
+ go_to_line_msg, nano_gotoline_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Indent Text"),
- IFSCHELP(nano_indent_msg, FALSE, NANO_INDENT_KEY), NANO_NO_KEY,
- NANO_NO_KEY, NOVIEW, do_indent_void);
+ add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, nano_replace_msg,
- sc_init_one(&main_list, NANO_NO_KEY, N_("Unindent Text"),
- IFSCHELP(nano_unindent_msg, TRUE, NANO_UNINDENT_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_unindent);
+#ifndef NANO_TINY
+ FALSE,
+#else
+ TRUE,
#endif
-
- sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
- IFSCHELP(nano_forward_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_right);
-
- sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
- IFSCHELP(nano_back_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_left);
+ NOVIEW);
#ifndef NANO_TINY
- sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
- IFSCHELP(nano_nextword_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_next_word_void);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
- IFSCHELP(nano_prevword_msg, FALSE, NANO_PREVWORD_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, do_prev_word_void);
-#endif
+ add_to_funcs(do_mark, MMAIN, N_("Mark Text"),
+ nano_mark_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
- IFSCHELP(nano_prevline_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_up_void);
+ add_to_funcs(do_research, (MMAIN|MBROWSER), whereis_next_msg,
+ nano_whereis_next_msg, TRUE, VIEW);
- sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"),
- IFSCHELP(nano_nextline_msg, TRUE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_down_void);
+ add_to_funcs(do_copy_text, MMAIN, N_("Copy Text"),
+ nano_copy_msg, FALSE, NOVIEW);
- sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
- IFSCHELP(nano_home_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_home);
+ add_to_funcs(do_indent_void, MMAIN, N_("Indent Text"),
+ nano_indent_msg, FALSE, NOVIEW);
- sc_init_one(&main_list, NANO_END_KEY, N_("End"),
- IFSCHELP(nano_end_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, do_end);
+ add_to_funcs(do_unindent, MMAIN, N_("Unindent Text"),
+ nano_unindent_msg, TRUE, NOVIEW);
-#ifndef DISABLE_JUSTIFY
- sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
- IFSCHELP(nano_parabegin_msg, FALSE, NANO_PARABEGIN_METAKEY),
- NANO_NO_KEY, NANO_PARABEGIN_METAKEY2, VIEW, do_para_begin_void);
-
- sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
- IFSCHELP(nano_paraend_msg, FALSE, NANO_PARAEND_METAKEY),
- NANO_NO_KEY, NANO_PARAEND_METAKEY2, VIEW, do_para_end_void);
#endif
- sc_init_one(&main_list, NANO_NO_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_NO_KEY, NANO_FIRSTLINE_METAKEY2, VIEW, do_first_line);
- sc_init_one(&main_list, NANO_NO_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, TRUE, NANO_LASTLINE_METAKEY),
- NANO_NO_KEY, NANO_LASTLINE_METAKEY2, VIEW, do_last_line);
+ add_to_funcs(do_right, MMAIN, N_("Forward"), nano_forward_msg,
+ FALSE, VIEW);
-#ifndef NANO_TINY
- sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
- IFSCHELP(nano_bracket_msg, FALSE, NANO_BRACKET_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, do_find_bracket);
+ add_to_funcs(do_left, MMAIN, N_("Back"), nano_back_msg,
+ FALSE, VIEW);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Up"),
- IFSCHELP(nano_scrollup_msg, FALSE, NANO_SCROLLUP_KEY),
- NANO_NO_KEY, NANO_SCROLLUP_METAKEY, VIEW, do_scroll_up);
+#ifndef NANO_TINY
+ add_to_funcs(do_next_word_void, MMAIN, N_("Next Word"),
+ nano_nextword_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Down"),
- IFSCHELP(nano_scrolldown_msg, TRUE, NANO_SCROLLDOWN_KEY),
- NANO_NO_KEY, NANO_SCROLLDOWN_METAKEY, VIEW, do_scroll_down);
+ add_to_funcs(do_prev_word_void, MMAIN, N_("Prev Word"),
+ nano_prevword_msg, FALSE, VIEW);
#endif
-#ifdef ENABLE_MULTIBUFFER
- sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
- IFSCHELP(nano_prevfile_msg, FALSE, NANO_PREVFILE_KEY),
- NANO_NO_KEY, NANO_PREVFILE_METAKEY, VIEW,
- switch_to_prev_buffer_void);
+ add_to_funcs(do_up_void, (MMAIN|MHELP), N_("Prev Line"),
+ nano_prevline_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
- IFSCHELP(nano_nextfile_msg, TRUE, NANO_NEXTFILE_KEY),
- NANO_NO_KEY, NANO_NEXTFILE_METAKEY, VIEW,
- switch_to_next_buffer_void);
-#endif
+ add_to_funcs(do_down_void, (MMAIN|MHELP), N_("Next Line"),
+ nano_nextline_msg, TRUE, VIEW);
- sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
- IFSCHELP(nano_verbatim_msg, FALSE, NANO_VERBATIM_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_verbatim_input);
+ add_to_funcs(do_home, MMAIN, N_("Home"), nano_home_msg,
+ FALSE, VIEW);
- sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"),
- IFSCHELP(nano_tab_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, NOVIEW, do_tab);
+ add_to_funcs(do_end, MMAIN, N_("End"), nano_end_msg,
+ FALSE, VIEW);
- sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"),
- IFSCHELP(nano_enter_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, NOVIEW, do_enter);
-
- sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
- IFSCHELP(nano_delete_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, NOVIEW, do_delete);
+#ifndef DISABLE_JUSTIFY
+ add_to_funcs(do_para_begin_void, (MMAIN|MWHEREIS), beg_of_par_msg,
+ nano_parabegin_msg, FALSE, VIEW);
- sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace")
-#ifndef NANO_TINY
- , IFSCHELP(nano_backspace_msg, FALSE, NANO_NO_KEY)
-#else
- , IFSCHELP(nano_backspace_msg, TRUE, NANO_NO_KEY)
+ add_to_funcs(do_para_end_void, (MMAIN|MWHEREIS), end_of_par_msg,
+ nano_paraend_msg, FALSE, VIEW);
#endif
- , NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_backspace);
#ifndef NANO_TINY
- sc_init_one(&main_list, NANO_NO_KEY, N_("CutTillEnd"),
- IFSCHELP(nano_cut_till_end_msg, TRUE, NANO_CUTTILLEND_METAKEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
-#endif
+ add_to_funcs(do_find_bracket, MMAIN, _("Find Other Bracket"),
+ nano_bracket_msg, FALSE, VIEW);
-#ifndef DISABLE_JUSTIFY
- sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
- IFSCHELP(nano_fulljustify_msg, FALSE, NANO_FULLJUSTIFY_METAKEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
-#endif
+ add_to_funcs(do_scroll_up, MMAIN, N_("Scroll Up"),
+ nano_scrollup_msg, FALSE, VIEW);
-#ifndef NANO_TINY
- sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
- IFSCHELP(nano_wordcount_msg, FALSE, NANO_WORDCOUNT_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, do_wordlinechar_count);
+ add_to_funcs(do_scroll_down, MMAIN, N_("Scroll Down"),
+ nano_scrolldown_msg, FALSE, VIEW);
#endif
- sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg
+#ifdef ENABLE_MULTIBUFFER
+ add_to_funcs(switch_to_prev_buffer_void, MMAIN, _("Previous File"),
+ nano_prevfile_msg, FALSE, VIEW);
+ add_to_funcs(switch_to_next_buffer_void, MMAIN, N_("Next File"),
+ nano_nextfile_msg, TRUE, VIEW);
+#endif
+
+ add_to_funcs(do_verbatim_input, MMAIN, N_("Verbatim Input"),
+ nano_verbatim_msg, FALSE, NOVIEW);
+ add_to_funcs(do_tab, MMAIN, N_("Tab"), nano_tab_msg,
+ FALSE, NOVIEW);
+ add_to_funcs(do_enter, MMAIN, N_("Enter"), nano_enter_msg,
+ FALSE, NOVIEW);
+ add_to_funcs(do_delete, MMAIN, N_("Delete"), nano_delete_msg,
+ FALSE, NOVIEW);
+ add_to_funcs(do_backspace, MMAIN, N_("Backspace"), nano_backspace_msg,
#ifndef NANO_TINY
- , IFSCHELP(nano_refresh_msg, TRUE, NANO_NO_KEY)
+ FALSE,
#else
- , IFSCHELP(nano_refresh_msg, FALSE, NANO_NO_KEY)
+ TRUE,
#endif
- , NANO_NO_KEY, NANO_NO_KEY, VIEW, total_refresh);
+ VIEW);
- free_shortcutage(&whereis_list);
-
- sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
+#ifndef NANO_TINY
+ add_to_funcs(do_cut_till_end, MMAIN, N_("CutTillEnd"),
+ nano_cut_till_end_msg, TRUE, NOVIEW);
#endif
- );
-
- sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_METAKEY2, VIEW,
- do_first_line);
-
- sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, FALSE, NANO_LASTLINE_METAKEY),
- NANO_LASTLINE_FKEY, NANO_LASTLINE_METAKEY2, VIEW, do_last_line);
- sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
- IFSCHELP(nano_replace_msg, FALSE, NANO_NO_KEY),
- NANO_REPLACE_FKEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
- IFSCHELP(nano_gotoline_msg, FALSE, NANO_NO_KEY),
- NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs(xon_complaint, MMAIN, "", "", FALSE, VIEW);
+ add_to_funcs(xoff_complaint, MMAIN, "", "", FALSE, VIEW);
#ifndef DISABLE_JUSTIFY
- sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
- IFSCHELP(nano_parabegin_msg, FALSE, NANO_PARABEGIN_METAKEY),
- NANO_NO_KEY, NANO_PARABEGIN_METAKEY2, VIEW, do_para_begin_void);
-
- sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
- IFSCHELP(nano_paraend_msg, FALSE, NANO_PARAEND_METAKEY),
- NANO_NO_KEY, NANO_PARAEND_METAKEY2, VIEW, do_para_end_void);
+ add_to_funcs(do_full_justify, (MMAIN|MWHEREIS), fulljstify_msg,
+ nano_fulljustify_msg, FALSE, NOVIEW);
#endif
#ifndef NANO_TINY
- sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
- IFSCHELP(nano_case_msg, FALSE, TOGGLE_CASE_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg,
- IFSCHELP(nano_reverse_msg, FALSE, TOGGLE_BACKWARDS_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-#endif
-
-#ifdef HAVE_REGEX_H
- sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
- IFSCHELP(nano_regexp_msg, FALSE, NANO_REGEXP_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs(do_wordlinechar_count, MMAIN, N_("Word Count"),
+ nano_wordcount_msg, FALSE, VIEW);
#endif
+ add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg, refresh_msg,
#ifndef NANO_TINY
- sc_init_one(&whereis_list, NANO_PREVLINE_KEY, prev_history_msg,
- IFSCHELP(nano_prev_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_list, NANO_NEXTLINE_KEY, next_history_msg,
- IFSCHELP(nano_next_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-#endif
-
-#ifndef DISABLE_JUSTIFY
- sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
- IFSCHELP(nano_fulljustify_msg, FALSE, NANO_FULLJUSTIFY_METAKEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
-#endif
-
- free_shortcutage(&replace_list);
-
- sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
+ TRUE,
#else
- nano_disabled_msg
+ FALSE,
#endif
- );
-
- sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_METAKEY2, VIEW,
- do_first_line);
-
- sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, FALSE, NANO_LASTLINE_METAKEY),
- NANO_LASTLINE_FKEY, NANO_LASTLINE_METAKEY2, VIEW, do_last_line);
-
- /* TRANSLATORS: Try to keep this at most 12 characters. */
- sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
- IFSCHELP(nano_whereis_msg, FALSE, NANO_NO_KEY),
- NANO_REPLACE_FKEY, NANO_NO_KEY, VIEW, NULL);
+ VIEW);
#ifndef NANO_TINY
- sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
- IFSCHELP(nano_case_msg, FALSE, TOGGLE_CASE_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) case_sens_msg,
+ (MWHEREIS|MREPLACE|MWHEREISFILE),
+ case_sens_msg, nano_case_msg, FALSE, VIEW);
- sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg,
- IFSCHELP(nano_reverse_msg, FALSE, TOGGLE_BACKWARDS_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) backwards_msg,
+ (MWHEREIS|MREPLACE|MWHEREISFILE),
+ backwards_msg, nano_reverse_msg, FALSE, VIEW);
#endif
#ifdef HAVE_REGEX_H
- sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
- IFSCHELP(nano_regexp_msg, FALSE, NANO_REGEXP_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) regexp_msg,
+ (MWHEREIS|MREPLACE|MWHEREISFILE),
+ regexp_msg, nano_regexp_msg, FALSE, VIEW);
#endif
#ifndef NANO_TINY
- sc_init_one(&replace_list, NANO_PREVLINE_KEY, prev_history_msg,
- IFSCHELP(nano_prev_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) prev_history_msg,
+ (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE),
+ prev_history_msg, nano_prev_history_msg, FALSE, VIEW);
- sc_init_one(&replace_list, NANO_NEXTLINE_KEY, next_history_msg,
- IFSCHELP(nano_next_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) next_history_msg,
+ (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE),
+ next_history_msg, nano_next_history_msg, FALSE, VIEW);
#endif
- free_shortcutage(&replace_list_2);
+ add_to_funcs((void *) no_replace_msg, MREPLACE,
+ no_replace_msg, nano_whereis_msg, FALSE, VIEW);
- sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_METAKEY2, VIEW,
- do_first_line);
-
- sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, FALSE, NANO_LASTLINE_METAKEY),
- NANO_LASTLINE_FKEY, NANO_LASTLINE_METAKEY2, VIEW, do_last_line);
-
-#ifndef NANO_TINY
- sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, prev_history_msg,
- IFSCHELP(nano_prev_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&replace_list_2, NANO_NEXTLINE_KEY, next_history_msg,
- IFSCHELP(nano_next_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-#endif
-
- free_shortcutage(&gotoline_list);
-
- sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_METAKEY2, VIEW,
- do_first_line);
-
- sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, FALSE, NANO_LASTLINE_METAKEY),
- NANO_LASTLINE_FKEY, NANO_LASTLINE_METAKEY2, VIEW, do_last_line);
-
- sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
- N_("Go To Text"), IFSCHELP(nano_whereis_msg, FALSE,
- NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-
- free_shortcutage(&writefile_list);
-
- sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) gototext_msg, MGOTOLINE,
+ gototext_msg, nano_whereis_msg, FALSE, VIEW);
#ifndef DISABLE_BROWSER
- /* If we're using restricted mode, the file browser is disabled.
- * It's useless since inserting files is disabled. */
if (!ISSET(RESTRICTED))
- sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
- IFSCHELP(nano_tofiles_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) to_files_msg,
+ (MGOTOLINE|MINSERTFILE),
+ to_files_msg, nano_tofiles_msg, FALSE, VIEW);
#endif
#ifndef NANO_TINY
* specified on the command line, and the fifth is useless since
* backups are disabled. */
if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
- IFSCHELP(nano_dos_msg, FALSE, TOGGLE_DOS_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) dos_format_msg, MWRITEFILE,
+ dos_format_msg, nano_dos_msg, FALSE, NOVIEW);
if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
- IFSCHELP(nano_mac_msg, FALSE, TOGGLE_MAC_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
-#endif
+ add_to_funcs((void *) mac_format_msg, MWRITEFILE,
+ mac_format_msg, nano_mac_msg, FALSE, NOVIEW);
if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
- IFSCHELP(nano_append_msg, FALSE, NANO_APPEND_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) append_msg, MWRITEFILE,
+ append_msg, nano_append_msg, FALSE, NOVIEW);
if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
- IFSCHELP(nano_prepend_msg, FALSE, NANO_PREPEND_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) prepend_msg, MWRITEFILE,
+ prepend_msg, nano_prepend_msg, FALSE, NOVIEW);
-#ifndef NANO_TINY
if (!ISSET(RESTRICTED))
- /* TRANSLATORS: Try to keep this at most 16 characters. */
- sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
- IFSCHELP(nano_backup_msg, FALSE, TOGGLE_BACKUP_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
-#endif
-
- free_shortcutage(&insertfile_list);
-
- sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
-#ifndef DISABLE_BROWSER
- /* If we're using restricted mode, the file browser is disabled.
- * It's useless since inserting files is disabled. */
- if (!ISSET(RESTRICTED))
- sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
- IFSCHELP(nano_tofiles_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) backup_file_msg, MWRITEFILE,
+ backup_file_msg, nano_backup_msg, FALSE, NOVIEW);
#endif
#ifndef NANO_TINY
/* If we're using restricted mode, command execution is disabled.
* It's useless since inserting files is disabled. */
if (!ISSET(RESTRICTED))
- sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
- /* TRANSLATORS: Try to keep this at most 22
- * characters. */
- N_("Execute Command"), IFSCHELP(nano_execute_msg, FALSE,
- NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) ext_cmd_msg, MINSERTFILE,
+ ext_cmd_msg, 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))
- sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
- IFSCHELP(nano_multibuffer_msg, FALSE,
- TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY, NANO_NO_KEY,
- NOVIEW, NULL);
-#endif
+ add_to_funcs((void *) new_buffer_msg, MWRITEFILE,
+ new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW);
#endif
-#ifndef NANO_TINY
- free_shortcutage(&extcmd_list);
-
- sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
- IFSCHELP(nano_insert_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) insert_file_msg, MEXTCMD,
+ insert_file_msg, nano_insert_msg, FALSE, VIEW);
#ifdef ENABLE_MULTIBUFFER
- sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
- IFSCHELP(nano_multibuffer_msg, FALSE, TOGGLE_MULTIBUFFER_KEY),
- NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
+ add_to_funcs((void *) new_buffer_msg, MEXTCMD,
+ new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW);
#endif
#endif
#ifndef DISABLE_HELP
- free_shortcutage(&help_list);
-
- sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg,
- IFSCHELP(nano_refresh_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
- IFSCHELP(nano_exit_msg, FALSE, NANO_NO_KEY), NANO_EXIT_FKEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
- IFSCHELP(nano_prevpage_msg, FALSE, NANO_NO_KEY),
- NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
- IFSCHELP(nano_nextpage_msg, FALSE, NANO_NO_KEY),
- NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
- IFSCHELP(nano_prevline_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
- IFSCHELP(nano_nextline_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_NO_KEY, first_line_msg,
- IFSCHELP(nano_firstline_msg, FALSE, NANO_FIRSTLINE_METAKEY),
- NANO_NO_KEY, NANO_FIRSTLINE_METAKEY2, VIEW, NULL);
-
- sc_init_one(&help_list, NANO_NO_KEY, last_line_msg,
- IFSCHELP(nano_lastline_msg, TRUE, NANO_LASTLINE_METAKEY),
- NANO_NO_KEY, NANO_LASTLINE_METAKEY2, VIEW, NULL);
-#endif
-
-#ifndef DISABLE_SPELLER
- free_shortcutage(&spell_list);
-
- sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_help_void
-#else
- nano_disabled_msg
-#endif
- );
-
- sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) refresh_msg, MHELP,
+ refresh_msg, nano_refresh_msg, FALSE, VIEW);
#endif
#ifndef DISABLE_BROWSER
- free_shortcutage(&browser_list);
-
- sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
- IFSCHELP(nano_exitbrowser_msg, FALSE, NANO_NO_KEY),
- NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&browser_list, NANO_WHEREIS_KEY, whereis_msg,
- IFSCHELP(nano_whereis_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&browser_list, NANO_NO_KEY, whereis_next_msg,
- IFSCHELP(nano_whereis_next_msg, FALSE, NANO_WHEREIS_NEXT_KEY),
- NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, NULL);
- sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
- IFSCHELP(nano_prevpage_msg, FALSE, NANO_NO_KEY),
- NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) first_file_msg,
+ (MBROWSER|MWHEREISFILE),
+ first_file_msg, nano_firstfile_msg, FALSE, VIEW);
- sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
- IFSCHELP(nano_nextpage_msg, FALSE, NANO_NO_KEY),
- NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
+ add_to_funcs((void *) last_file_msg,
+ (MBROWSER|MWHEREISFILE),
+ last_file_msg, nano_lastfile_msg, FALSE, VIEW);
- sc_init_one(&browser_list, NANO_NO_KEY, first_file_msg,
- IFSCHELP(nano_firstfile_msg, FALSE, NANO_FIRSTFILE_METAKEY),
- NANO_NO_KEY, NANO_FIRSTFILE_METAKEY2, VIEW, NULL);
-
- sc_init_one(&browser_list, NANO_NO_KEY, last_file_msg,
- IFSCHELP(nano_lastfile_msg, FALSE, NANO_LASTFILE_METAKEY),
- NANO_NO_KEY, NANO_LASTFILE_METAKEY2, VIEW, NULL);
-
- /* TRANSLATORS: Try to keep this at most 12 characters. */
- sc_init_one(&browser_list, NANO_GOTODIR_KEY, N_("Go To Dir"),
- IFSCHELP(nano_gotodir_msg, FALSE, NANO_GOTODIR_METAKEY),
- NANO_GOTODIR_FKEY, NANO_NO_KEY, VIEW, NULL);
-
- free_shortcutage(&whereis_file_list);
-
- sc_init_one(&whereis_file_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_browser_help
-#else
- nano_disabled_msg
+ add_to_funcs((void *) goto_dir_msg, MBROWSER,
+ goto_dir_msg, nano_gotodir_msg, FALSE, VIEW);
#endif
- );
-
- sc_init_one(&whereis_file_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg,
- IFSCHELP(nano_firstfile_msg, FALSE, NANO_FIRSTFILE_METAKEY),
- NANO_FIRSTFILE_FKEY, NANO_FIRSTFILE_METAKEY2, VIEW,
- do_first_file);
-
- sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg,
- IFSCHELP(nano_lastfile_msg, FALSE, NANO_LASTFILE_METAKEY),
- NANO_LASTFILE_FKEY, NANO_LASTFILE_METAKEY2, VIEW, do_last_file);
-#ifndef NANO_SMALL
- sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg,
- IFSCHELP(nano_case_msg, FALSE, TOGGLE_CASE_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+ currmenu = MMAIN;
- sc_init_one(&whereis_file_list, NANO_NO_KEY, backwards_msg,
- IFSCHELP(nano_reverse_msg, FALSE, TOGGLE_BACKWARDS_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-#endif
-
-#ifdef HAVE_REGEX_H
- sc_init_one(&whereis_file_list, NANO_NO_KEY, regexp_msg,
- IFSCHELP(nano_regexp_msg, FALSE, NANO_REGEXP_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
-#endif
-
-#ifndef NANO_SMALL
- sc_init_one(&whereis_file_list, NANO_PREVLINE_KEY, prev_history_msg,
- IFSCHELP(nano_prev_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
-
- sc_init_one(&whereis_file_list, NANO_NEXTLINE_KEY, next_history_msg,
- IFSCHELP(nano_next_history_msg, FALSE, NANO_NO_KEY),
- NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
+#ifndef NANO_TINY
+ 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, "^_", 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);
+ add_to_sclist(MMAIN, "F3", do_writeout_void, 0, TRUE);
+#ifndef NANO_TINY
+ 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, "^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, "^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 NANO_TINY
+ add_to_sclist(MMAIN, "^T", do_spell, 0, TRUE);
+ add_to_sclist(MMAIN, "F12", do_spell, 0, TRUE);
+#endif
+ 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, "^\\", 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", (void *) no_replace_msg, 0, FALSE);
+ add_to_sclist(MWHEREIS, "^T", do_gotolinecolumn_void, 0, TRUE);
+#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(MALL, "F16", do_research, 0, TRUE);
+ add_to_sclist(MALL, "M-W", 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|MBROWSER|MHELP, "^F", do_right, 0, TRUE);
+ add_to_sclist(MMAIN|MBROWSER|MHELP, "^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, "^Q", xon_complaint, 0, TRUE);
+ add_to_sclist(MALL, "^X", xoff_complaint, 0, TRUE);
+ add_to_sclist(MALL, "^P", do_up_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);
+ add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
+ "^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);
+ add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
+ "^Y", do_first_line, 0, TRUE);
+ add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
+ "^V", do_last_line, 0, TRUE);
+
+ add_to_sclist(MWHEREIS,
+ "M-C", (void *) case_sens_msg, 0, FALSE);
+ add_to_sclist(MREPLACE,
+ "M-C", (void *) case_sens_msg, 0, FALSE);
+ add_to_sclist(MREPLACE2,
+ "M-C", (void *) case_sens_msg, 0, FALSE);
+ add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
+ "M-B", (void *) backwards_msg, 0, FALSE);
+ add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
+ "M-R", (void *) regexp_msg, 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);
+#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);
#endif
- free_shortcutage(&gotodir_list);
-
- sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg,
- IFSCHELP(nano_help_msg, FALSE, NANO_NO_KEY), NANO_HELP_FKEY,
- NANO_NO_KEY, VIEW,
-#ifndef DISABLE_HELP
- do_browser_help
-#else
- nano_disabled_msg
-#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);
+#endif
+ add_to_sclist(MMAIN, "M-V", do_verbatim_input, 0, TRUE);
+ add_to_sclist(MALL, "^I", do_tab, 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-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);
+ 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);
+#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, "^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);
+ add_to_sclist(MWRITEFILE, "M-M", (void *) mac_format_msg, 0, FALSE);
+ add_to_sclist(MWRITEFILE, "M-A", (void *) append_msg, 0, FALSE);
+ add_to_sclist(MWRITEFILE, "M-P", (void *) prepend_msg, 0, FALSE);
+ add_to_sclist(MWRITEFILE, "M-B", (void *) backup_file_msg, 0, FALSE);
+ add_to_sclist(MWRITEFILE, "^T", (void *) to_files_msg, 0, FALSE);
+ add_to_sclist(MINSERTFILE, "^T", (void *) to_files_msg, 0, FALSE);
+ add_to_sclist(MINSERTFILE, "^X", (void *) ext_cmd_msg, 0, FALSE);
+ add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE);
- sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
- IFSCHELP(nano_cancel_msg, FALSE, NANO_NO_KEY), NANO_NO_KEY,
- NANO_NO_KEY, VIEW, NULL);
+#ifdef DEBUG
+ print_sclist();
#endif
- currshortcut = main_list;
-
-#ifndef NANO_TINY
- toggle_init();
-#endif
}
/* Free the given shortcut. */
}
}
-#ifndef NANO_TINY
-/* Add a new toggle to the end of the global toggle list. */
-void toggle_init_one(int val
-#ifndef DISABLE_HELP
- , const char *desc, bool blank_after
-#endif
- , long flag)
+const subnfunc *sctofunc(sc *s)
{
- toggle *u;
+ subnfunc *f;
- if (toggles == NULL) {
- toggles = (toggle *)nmalloc(sizeof(toggle));
- u = toggles;
- } else {
- for (u = toggles; u->next != NULL; u = u->next)
- ;
- u->next = (toggle *)nmalloc(sizeof(toggle));
- u = u->next;
- }
+ for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next)
+ ;
- u->val = val;
-#ifndef DISABLE_HELP
- u->desc = (desc == NULL) ? "" : _(desc);
- u->blank_after = blank_after;
-#endif
- u->flag = flag;
- u->next = NULL;
+ return f;
}
-/* Initialize the global toggle list. */
-void toggle_init(void)
+#ifndef NANO_TINY
+/* Now lets come up with a single (hopefully)
+ function to get a string for each flag */
+char *flagtostr(int flag)
{
- /* There is no need to reinitialize the toggles. They can't
- * change. */
- if (toggles != NULL)
- return;
-
-/* The following macro is to be used in calling toggle_init_one(). The
- * point is that toggle_init_one() takes 4 arguments, unless
- * DISABLE_HELP is defined, when the 2nd and 3rd ones should not be
- * there. */
-#ifndef DISABLE_HELP
-#define IFTHELP(help, blank, nextvar) help, blank, nextvar
-#else
-#define IFTHELP(help, blank, nextvar) nextvar
-#endif
-
- toggle_init_one(TOGGLE_NOHELP_KEY, IFTHELP(N_("Help mode"), FALSE,
- NO_HELP));
-
- toggle_init_one(TOGGLE_CONST_KEY,
- IFTHELP(N_("Constant cursor position display"), FALSE,
- CONST_UPDATE));
-
- toggle_init_one(TOGGLE_MORESPACE_KEY,
- IFTHELP(N_("Use of one more line for editing"), FALSE,
- MORE_SPACE));
-
- toggle_init_one(TOGGLE_SMOOTH_KEY,
-#ifdef ENABLE_NANORC
- IFTHELP(N_("Smooth scrolling"), FALSE, SMOOTH_SCROLL)
-#else
- IFTHELP(N_("Smooth scrolling"), TRUE, SMOOTH_SCROLL)
-#endif
- );
-
-#ifdef ENABLE_NANORC
- toggle_init_one(TOGGLE_WHITESPACE_KEY,
-#ifdef ENABLE_COLOR
- IFTHELP(N_("Whitespace display"), FALSE, WHITESPACE_DISPLAY)
-#else
- IFTHELP(N_("Whitespace display"), TRUE, WHITESPACE_DISPLAY)
-#endif
- );
-#endif
-
-#ifdef ENABLE_COLOR
- toggle_init_one(TOGGLE_SYNTAX_KEY,
- IFTHELP(N_("Color syntax highlighting"), TRUE, NO_COLOR_SYNTAX));
-#endif
-
- toggle_init_one(TOGGLE_SMARTHOME_KEY, IFTHELP(N_("Smart home key"),
- FALSE, SMART_HOME));
-
- toggle_init_one(TOGGLE_AUTOINDENT_KEY, IFTHELP(N_("Auto indent"),
- FALSE, AUTOINDENT));
+ switch (flag) {
+ case NO_HELP:
+ return N_("Help mode");
+ case CONST_UPDATE:
+ return N_("Constant cursor position display");
+ case MORE_SPACE:
+ return N_("Use of one more line for editing");
+ case SMOOTH_SCROLL:
+ return N_("Smooth scrolling");
+ case WHITESPACE_DISPLAY:
+ return N_("Whitespace display");
+ case NO_COLOR_SYNTAX:
+ return N_("Color syntax highlighting");
+ case SMART_HOME:
+ return N_("Smart home key");
+ case AUTOINDENT:
+ return N_("Auto indent");
+ case CUT_TO_END:
+ return N_("Cut to end");
+ case NO_WRAP:
+ return N_("Long line wrapping");
+ case TABS_TO_SPACES:
+ return N_("Conversion of typed tabs to spaces");
+ case BACKUP_FILE:
+ return N_("Backup files");
+ case MULTIBUFFER:
+ return N_("Multiple file buffers");
+ case USE_MOUSE:
+ return N_("Mouse support");
+ case NO_CONVERT:
+ return N_("No conversion from DOS/Mac format");
+ case SUSPEND:
+ return N_("Suspension");
+ default:
+ return "?????";
+ }
+}
- toggle_init_one(TOGGLE_CUTTOEND_KEY, IFTHELP(N_("Cut to end"),
- FALSE, CUT_TO_END));
+/* Interpret the string given by the rc file and return a
+ shortcut struct, complete with proper value for execute */
+sc *strtosc(int menu, char *input)
+{
+ sc *s;
+
+ s = (sc *)nmalloc(sizeof(sc));
+ s->execute = TRUE; /* overridden as needed below */
+
+ if (!strcasecmp(input, "help"))
+ s->scfunc = do_help_void;
+ else 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_search;
+ else if (!strcasecmp(input, "up"))
+ s->scfunc = do_page_up;
+ else if (!strcasecmp(input, "down"))
+ s->scfunc = do_page_down;
+ else if (!strcasecmp(input, "cut"))
+ s->scfunc = do_cut_text_void;
+ else if (!strcasecmp(input, "uncut"))
+ s->scfunc = do_uncut_text;
+ else if (!strcasecmp(input, "curpos") ||
+ !strcasecmp(input, "cursorpos"))
+ s->scfunc = do_cursorpos_void;
+ else if (!strcasecmp(input, "firstline"))
+ s->scfunc = do_first_line;
+ else if (!strcasecmp(input, "lastline"))
+ s->scfunc = do_last_line;
+ else if (!strcasecmp(input, "gotoline"))
+ s->scfunc = do_gotolinecolumn_void;
+ else if (!strcasecmp(input, "replace"))
+ s->scfunc = do_replace;
+ else if (!strcasecmp(input, "mark"))
+ s->scfunc = do_mark;
+ else if (!strcasecmp(input, "searchagain") ||
+ !strcasecmp(input, "research"))
+ s->scfunc = do_research;
+ else if (!strcasecmp(input, "copytext"))
+ s->scfunc = do_copy_text;
+ else if (!strcasecmp(input, "indent"))
+ 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, "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")) {
+ 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->execute = FALSE;
+ s->toggle = NO_HELP;
+ } else if (!strcasecmp(input, "constupdate")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = CONST_UPDATE;
+ } else if (!strcasecmp(input, "morespace")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = MORE_SPACE;
+ } else if (!strcasecmp(input, "smoothscroll")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = SMOOTH_SCROLL;
+ } else if (!strcasecmp(input, "whitesplacedisplay")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = WHITESPACE_DISPLAY;
+ } else if (!strcasecmp(input, "nosyntax")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = NO_COLOR_SYNTAX;
+ } else if (!strcasecmp(input, "smarthome")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = SMART_HOME;
+ } else if (!strcasecmp(input, "autoindent")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = AUTOINDENT;
+ } else if (!strcasecmp(input, "cuttoend")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = CUT_TO_END;
+ } else if (!strcasecmp(input, "nowrap")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = NO_WRAP;
+ } else if (!strcasecmp(input, "tabstospaces")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = TABS_TO_SPACES;
+ } else if (!strcasecmp(input, "backupfile")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = BACKUP_FILE;
+ } else if (!strcasecmp(input, "mutlibuffer")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = MULTIBUFFER;
+ } else if (!strcasecmp(input, "mouse")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = USE_MOUSE;
+ } else if (!strcasecmp(input, "noconvert")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = NO_CONVERT;
+ } else if (!strcasecmp(input, "suspend")) {
+ s->scfunc = (void *) do_toggle;
+ s->execute = FALSE;
+ s->toggle = SUSPEND;
+ } else {
+ free(s);
+ return NULL;
+ }
-#ifndef DISABLE_WRAPPING
- toggle_init_one(TOGGLE_WRAP_KEY, IFTHELP(N_("Long line wrapping"),
- FALSE, NO_WRAP));
-#endif
+ return s;
- toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
-#ifndef DISABLE_MOUSE
- IFTHELP(N_("Conversion of typed tabs to spaces"), TRUE,
- TABS_TO_SPACES)
-#else
- IFTHELP(N_("Conversion of typed tabs to spaces"),
- !ISSET(RESTRICTED) ? TRUE : FALSE, TABS_TO_SPACES)
-#endif
- );
+}
- /* If we're using restricted mode, the backup toggle is disabled.
- * It's useless since backups are disabled. */
- if (!ISSET(RESTRICTED))
- toggle_init_one(TOGGLE_BACKUP_KEY, IFTHELP(N_("Backup files"),
- FALSE, BACKUP_FILE));
+/* Same thing as abnove but for the menu */
+int strtomenu(char *input)
+{
+ if (!strcasecmp(input, "all"))
+ return MALL;
+ else if (!strcasecmp(input, "main"))
+ return MMAIN;
+ else if (!strcasecmp(input, "search"))
+ return MWHEREIS;
+ else if (!strcasecmp(input, "replace"))
+ return MREPLACE;
+ else if (!strcasecmp(input, "replace2") ||
+ !strcasecmp(input, "replacewith"))
+ return MREPLACE2;
+ else if (!strcasecmp(input, "gotoline"))
+ return MGOTOLINE;
+ else if (!strcasecmp(input, "writeout"))
+ return MWRITEFILE;
+ else if (!strcasecmp(input, "insert"))
+ return MINSERTFILE;
+ else if (!strcasecmp(input, "externalcmd") ||
+ !strcasecmp(input, "extcmd"))
+ return MEXTCMD;
+ else if (!strcasecmp(input, "help"))
+ return MHELP;
+ else if (!strcasecmp(input, "spell"))
+ return MSPELL;
+ else if (!strcasecmp(input, "browser"))
+ return MBROWSER;
+ else if (!strcasecmp(input, "whereisfile"))
+ return MWHEREISFILE;
+ else if (!strcasecmp(input, "gotodir"))
+ return MGOTODIR;
+
+ return -1;
+}
-#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))
- toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
- IFTHELP(N_("Multiple file buffers"), FALSE,
- MULTIBUFFER));
-#endif
-#ifndef DISABLE_MOUSE
- toggle_init_one(TOGGLE_MOUSE_KEY, IFTHELP(N_("Mouse support"),
- FALSE, USE_MOUSE));
#endif
- /* If we're using restricted mode, the DOS/Mac conversion toggle is
- * disabled. It's useless since inserting files is disabled. */
- if (!ISSET(RESTRICTED))
- toggle_init_one(TOGGLE_NOCONVERT_KEY,
- IFTHELP(N_("No conversion from DOS/Mac format"), FALSE,
- NO_CONVERT));
-
- /* If we're using restricted mode, the suspend toggle is disabled.
- * It's useless since suspending is disabled. */
- if (!ISSET(RESTRICTED))
- toggle_init_one(TOGGLE_SUSPEND_KEY, IFTHELP(N_("Suspension"),
- FALSE, SUSPEND));
-}
-#endif /* !NANO_TINY */
-
#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
#ifndef DISABLE_JUSTIFY
if (jusbuffer != NULL)
free_filestruct(jusbuffer);
-#endif
- free_shortcutage(&main_list);
- free_shortcutage(&whereis_list);
- free_shortcutage(&replace_list);
- free_shortcutage(&replace_list_2);
- free_shortcutage(&gotoline_list);
- free_shortcutage(&writefile_list);
- free_shortcutage(&insertfile_list);
-#ifndef NANO_TINY
- free_shortcutage(&extcmd_list);
-#endif
-#ifndef DISABLE_HELP
- free_shortcutage(&help_list);
-#endif
-#ifndef DISABLE_SPELLER
- free_shortcutage(&spell_list);
-#endif
-#ifndef DISABLE_BROWSER
- free_shortcutage(&browser_list);
- free_shortcutage(&gotodir_list);
#endif
#ifndef NANO_TINY
/* Free the memory associated with each toggle. */
#endif
}
#endif /* DEBUG */
+