blob: a11a9dc777110a3c97e55856651ba7397dc46f39 [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * global.c *
4 * *
David Lawrence Ramsey315eb322005-11-28 19:35:29 +00005 * Copyright (C) 1999-2004 Chris Allegretta *
David Lawrence Ramseyd89617f2006-01-06 21:51:10 +00006 * Copyright (C) 2005-2006 David Lawrence Ramsey *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00007 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
Chris Allegretta3a24f3f2001-10-24 11:33:54 +00009 * the Free Software Foundation; either version 2, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000010 * any later version. *
11 * *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000012 * This program is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15 * General Public License for more details. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000016 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
20 * 02110-1301, USA. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000021 * *
22 **************************************************************************/
23
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000024#include "proto.h"
25
Chris Allegretta7662c862003-01-13 01:35:15 +000026/* Global variables */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000027#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000028ssize_t fill = 0;
29 /* The column where we will wrap lines. */
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000030ssize_t wrap_at = -CHARS_FROM_EOL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000031 /* The position where we will wrap lines. fill is equal to this
32 * if it's greater than zero, and equal to (COLS + this) if it
33 * isn't. */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000034#endif
35
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000036char *last_search = NULL;
37 /* The last string we searched for. */
38char *last_replace = NULL;
39 /* The last replacement string we searched for. */
Chris Allegretta6df90f52002-07-19 01:08:59 +000040
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000041long flags = 0;
42 /* Our flag containing the states of all global options. */
43WINDOW *topwin;
44 /* The top portion of the window, where we display the version
45 * number of nano, the name of the current file, and whether the
46 * current file has been modified. */
47WINDOW *edit;
48 /* The middle portion of the window, i.e, the edit window, where
49 * we display the current file we're editing. */
50WINDOW *bottomwin;
51 /* The bottom portion of the window, where we display statusbar
52 * messages, the statusbar prompt, and a list of shortcuts. */
53int editwinrows = 0;
54 /* How many rows does the edit window take up? */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000055
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000056filestruct *cutbuffer = NULL;
57 /* The buffer where we store cut text. */
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000058#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000059filestruct *jusbuffer = NULL;
60 /* The buffer where we store unjustified text. */
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000061#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000062partition *filepart = NULL;
63 /* The partition where we store a portion of the current
64 * file. */
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +000065openfilestruct *openfile = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000066 /* The list of all open file buffers. */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000067
David Lawrence Ramseyd89617f2006-01-06 21:51:10 +000068#ifndef NANO_TINY
69char *matchbrackets = NULL;
70 /* The opening and closing brackets that can be found by bracket
71 * searches. */
72#endif
73
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000074#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000075char *whitespace = NULL;
76 /* The characters used when displaying the first characters of
77 * tabs and spaces. */
78int whitespace_len[2];
79 /* The length of these characters. */
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000080#endif
81
Chris Allegrettae4f940d2002-03-03 22:36:36 +000082#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000083char *punct = NULL;
84 /* The closing punctuation that can end sentences. */
85char *brackets = NULL;
86 /* The closing brackets that can follow closing punctuation and
87 * can end sentences. */
88char *quotestr = NULL;
89 /* The quoting string. The default value is set in main(). */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000090#ifdef HAVE_REGEX_H
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000091regex_t quotereg;
92 /* The compiled regular expression from the quoting string. */
93int quoterc;
94 /* Whether it actually compiled. */
95char *quoteerr = NULL;
96 /* The error message, if it didn't. */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000097#else
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000098size_t quotelen;
99 /* The length of the quoting string in bytes. */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000100#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000101#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +0000102
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000103char *answer = NULL;
104 /* The answer string used in the statusbar prompt. */
105
106ssize_t tabsize = -1;
107 /* The width of a tab in spaces. The default value is set in
108 * main(). */
109
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000110#ifndef NANO_TINY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000111char *backup_dir = NULL;
112 /* The directory where we store backup files. */
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000113#endif
Chris Allegrettae1f14522001-09-19 03:19:43 +0000114#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000115char *operating_dir = NULL;
116 /* The relative path to the operating directory, which we can't
117 * move outside of. */
118char *full_operating_dir = NULL;
119 /* The full path to it. */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000120#endif
121
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000122#ifndef DISABLE_SPELLER
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000123char *alt_speller = NULL;
124 /* The command to use for the alternate spell checker. */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000125#endif
126
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000127shortcut *main_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000128 /* The main shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000129shortcut *whereis_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000130 /* The "Search" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000131shortcut *replace_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000132 /* The "Search (to replace)" shortcut list. */
133shortcut *replace_list_2 = NULL;
134 /* The "Replace with" shortcut list. */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000135shortcut *gotoline_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000136 /* The "Enter line number, column number" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000137shortcut *writefile_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000138 /* The "File Name to Write" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000139shortcut *insertfile_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000140 /* The "File to insert" shortcut list. */
141#ifndef NANO_TINY
142shortcut *extcmd_list = NULL;
143 /* The "Command to execute" shortcut list. */
144#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000145#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000146shortcut *help_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000147 /* The help text shortcut list. */
Chris Allegretta7662c862003-01-13 01:35:15 +0000148#endif
149#ifndef DISABLE_SPELLER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000150shortcut *spell_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000151 /* The internal spell checker shortcut list. */
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000152#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000153#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000154shortcut *browser_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000155 /* The file browser shortcut list. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000156shortcut *whereis_file_list = NULL;
157 /* The file browser "Search" shortcut list. */
Chris Allegretta201f1d92003-02-05 02:51:19 +0000158shortcut *gotodir_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000159 /* The "Go To Directory" shortcut list. */
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000160#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000161
Chris Allegretta8ce24132001-04-30 11:28:46 +0000162#ifdef ENABLE_COLOR
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000163syntaxtype *syntaxes = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000164 /* The global list of color syntaxes. */
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000165char *syntaxstr = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000166 /* The color syntax name specified on the command line. */
Chris Allegretta8ce24132001-04-30 11:28:46 +0000167#endif
168
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000169const shortcut *currshortcut;
170 /* The current shortcut list we're using. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000171#ifndef NANO_TINY
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000172toggle *toggles = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000173 /* The global toggle list. */
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000174#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000175
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000176#ifndef NANO_TINY
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000177filestruct *search_history = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000178 /* The search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000179filestruct *searchage = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000180 /* The top of the search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000181filestruct *searchbot = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000182 /* The bottom of the search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000183filestruct *replace_history = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000184 /* The replace string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000185filestruct *replaceage = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000186 /* The top of the replace string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000187filestruct *replacebot = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000188 /* The bottom of the replace string history list. */
Chris Allegretta5beed502003-01-05 20:41:21 +0000189#endif
190
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000191/* Regular expressions */
Chris Allegretta805c26d2000-09-06 13:39:17 +0000192#ifdef HAVE_REGEX_H
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000193regex_t search_regexp;
194 /* The compiled regular expression to use in searches. */
195regmatch_t regmatches[10];
196 /* The match positions for parenthetical subexpressions, 10
197 * maximum, used in regular expression searches. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000198#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000199
David Lawrence Ramsey4d72de72006-04-12 15:27:40 +0000200int reverse_attr = A_REVERSE;
201 /* The curses attribute we use for reverse video. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000202bool curses_ended = FALSE;
203 /* Whether endwin() has ended curses mode and statusbar()
204 * should hence write to stderr instead of displaying on the
205 * statusbar. */
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000206
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000207char *homedir = NULL;
208 /* The user's home directory, from $HOME or
209 * /etc/passwd. */
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000210
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000211/* Return the number of entries in the shortcut list s. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000212size_t length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000213{
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000214 size_t i = 0;
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000215
Chris Allegrettadab017e2002-04-23 10:56:06 +0000216 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000217 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000218 return i;
219}
220
David Lawrence Ramseye6757b92006-04-19 13:36:56 +0000221/* Add a new shortcut to the end of the shortcut list. */
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000222void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000223#ifndef DISABLE_HELP
Chris Allegrettaf717f982003-02-13 22:25:01 +0000224 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000225#endif
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000226 bool blank_after, int metaval, int funcval, int miscval, bool
227 view, void (*func)(void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000228{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000229 shortcut *s;
230
231 if (*shortcutage == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000232 *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000233 s = *shortcutage;
234 } else {
235 for (s = *shortcutage; s->next != NULL; s = s->next)
236 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000237 s->next = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000238 s = s->next;
239 }
240
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000241 s->ctrlval = ctrlval;
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000242 s->desc = (desc == NULL) ? "" : _(desc);
Chris Allegrettadab017e2002-04-23 10:56:06 +0000243#ifndef DISABLE_HELP
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000244 s->help = (help == NULL) ? "" : _(help);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000245#endif
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000246 s->blank_after = blank_after;
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000247 s->metaval = metaval;
248 s->funcval = funcval;
249 s->miscval = miscval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000250 s->viewok = view;
251 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000252 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000253}
254
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000255/* Initialize all shortcut lists. If unjustify is TRUE, replace the
256 * Uncut shortcut in the main shortcut list with UnJustify. */
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000257void shortcut_init(bool unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000258{
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000259 /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */
David Lawrence Ramsey12c08dd2006-03-25 15:56:40 +0000260 const char *cancel_msg = N_("Cancel");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000261 const char *get_help_msg = N_("Get Help");
262 const char *exit_msg = N_("Exit");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000263 const char *whereis_msg = N_("Where Is");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000264 const char *prev_page_msg = N_("Prev Page");
265 const char *next_page_msg = N_("Next Page");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000266 const char *go_to_line_msg = N_("Go To Line");
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000267 /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */
David Lawrence Ramsey12c08dd2006-03-25 15:56:40 +0000268 const char *replace_msg = N_("Replace");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000269#ifndef NANO_TINY
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000270 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000271 const char *whereis_next_msg = N_("Where Is Next");
272#endif
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000273 /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */
David Lawrence Ramsey12c08dd2006-03-25 15:56:40 +0000274 const char *refresh_msg = N_("Refresh");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000275 const char *first_line_msg = N_("First Line");
276 const char *last_line_msg = N_("Last Line");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000277#ifndef NANO_TINY
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000278 const char *cut_till_end_msg = N_("CutTillEnd");
279#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000280#ifndef DISABLE_JUSTIFY
281 const char *beg_of_par_msg = N_("Beg of Par");
282 const char *end_of_par_msg = N_("End of Par");
283 const char *fulljstify_msg = N_("FullJstify");
284#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000285#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000286 const char *case_sens_msg = N_("Case Sens");
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000287 const char *backwards_msg = N_("Backwards");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000288#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000289#ifdef HAVE_REGEX_H
290 const char *regexp_msg = N_("Regexp");
291#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000292#ifndef NANO_TINY
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000293 /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000294 const char *history_msg = N_("History");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000295#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaf318aa2006-04-12 12:54:23 +0000296 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000297 const char *new_buffer_msg = N_("New Buffer");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000298#endif
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000299#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000300#ifndef DISABLE_BROWSER
David Lawrence Ramseyb61dc892006-04-15 17:21:52 +0000301 /* TRANSLATORS: Try to keep this and following strings at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000302 const char *to_files_msg = N_("To Files");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000303 const char *first_file_msg = N_("First File");
David Lawrence Ramseyb61dc892006-04-15 17:21:52 +0000304 /* TRANSLATORS: Try to keep this and previous strings at most 16 characters. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000305 const char *last_file_msg = N_("Last File");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000306#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000307#ifndef DISABLE_HELP
David Lawrence Ramsey804e1072006-03-29 19:43:32 +0000308 const char *nano_cancel_msg = N_("Cancel the current function");
David Lawrence Ramsey57c9afb2006-04-14 20:21:45 +0000309 const char *nano_help_msg = N_("Display this help text");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000310 const char *nano_exit_msg =
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000311#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey95f7a742005-06-16 03:11:39 +0000312 N_("Close the current file buffer/Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000313#else
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000314 N_("Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000315#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000316 ;
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000317 const char *nano_writeout_msg =
318 N_("Write the current file to disk");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000319 const char *nano_justify_msg = N_("Justify the current paragraph");
320 const char *nano_insert_msg =
321 N_("Insert another file into the current one");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000322 const char *nano_whereis_msg =
323 N_("Search for text within the editor");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000324 const char *nano_prevpage_msg = N_("Move to the previous screen");
325 const char *nano_nextpage_msg = N_("Move to the next screen");
326 const char *nano_cut_msg =
327 N_("Cut the current line and store it in the cutbuffer");
328 const char *nano_uncut_msg =
329 N_("Uncut from the cutbuffer into the current line");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000330 const char *nano_cursorpos_msg =
David Lawrence Ramseyf50bd4b2006-04-14 20:15:44 +0000331 N_("Display the position of the cursor");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000332 const char *nano_spell_msg =
333 N_("Invoke the spell checker, if available");
David Lawrence Ramsey16349c92005-07-11 20:50:43 +0000334 const char *nano_gotoline_msg = N_("Go to line and column number");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000335 const char *nano_replace_msg = N_("Replace text within the editor");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000336#ifndef NANO_TINY
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000337 const char *nano_mark_msg = N_("Mark text at the cursor position");
338 const char *nano_whereis_next_msg = N_("Repeat last search");
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000339#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000340 const char *nano_prevline_msg = N_("Move to the previous line");
341 const char *nano_nextline_msg = N_("Move to the next line");
342 const char *nano_forward_msg = N_("Move forward one character");
343 const char *nano_back_msg = N_("Move back one character");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000344 const char *nano_home_msg =
345 N_("Move to the beginning of the current line");
346 const char *nano_end_msg =
347 N_("Move to the end of the current line");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000348 const char *nano_delete_msg =
349 N_("Delete the character under the cursor");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000350 const char *nano_backspace_msg =
351 N_("Delete the character to the left of the cursor");
David Lawrence Ramseye7c41682004-10-23 14:53:07 +0000352 const char *nano_tab_msg =
353 N_("Insert a tab character at the cursor position");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000354 const char *nano_enter_msg =
355 N_("Insert a carriage return at the cursor position");
David Lawrence Ramseyb9eb2be2006-04-19 22:55:37 +0000356 const char *nano_refresh_msg =
357 N_("Refresh (redraw) the current screen");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000358#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000359 const char *nano_nextword_msg = N_("Move forward one word");
360 const char *nano_prevword_msg = N_("Move backward one word");
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000361 const char *nano_wordcount_msg =
David Lawrence Ramsey72936852005-07-25 03:47:08 +0000362 N_("Count the number of words, lines, and characters");
David Lawrence Ramseyae9eea72005-11-10 07:40:55 +0000363 const char *nano_scrollup_msg =
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000364 N_("Scroll up one line without scrolling the cursor");
David Lawrence Ramseyae9eea72005-11-10 07:40:55 +0000365 const char *nano_scrolldown_msg =
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000366 N_("Scroll down one line without scrolling the cursor");
David Lawrence Ramsey00d77982004-08-07 21:27:37 +0000367#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000368#ifndef DISABLE_JUSTIFY
369 const char *nano_parabegin_msg =
370 N_("Go to the beginning of the current paragraph");
371 const char *nano_paraend_msg =
372 N_("Go to the end of the current paragraph");
373#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000374#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000375 const char *nano_prevfile_msg =
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000376 N_("Switch to the previous file buffer");
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000377 const char *nano_nextfile_msg =
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000378 N_("Switch to the next file buffer");
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000379#endif
380 const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000381#ifndef NANO_TINY
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000382 const char *nano_cut_till_end_msg =
383 N_("Cut from the cursor position to the end of the file");
384#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000385#ifndef DISABLE_JUSTIFY
386 const char *nano_fulljustify_msg = N_("Justify the entire file");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000387#endif
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000388#ifndef NANO_TINY
David Lawrence Ramsey29fb9512005-11-16 07:35:01 +0000389 const char *nano_bracket_msg = N_("Find matching bracket");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000390#endif
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000391 const char *nano_firstline_msg =
392 N_("Go to the first line of the file");
393 const char *nano_lastline_msg =
394 N_("Go to the last line of the file");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000395#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000396 const char *nano_case_msg =
397 N_("Make the current search/replace case (in)sensitive");
398 const char *nano_reverse_msg =
399 N_("Make the current search/replace go backwards");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000400#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000401#ifdef HAVE_REGEX_H
402 const char *nano_regexp_msg = N_("Use regular expressions");
403#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000404#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000405 const char *nano_history_msg =
406 N_("Edit the previous search/replace strings");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000407#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000408#ifndef DISABLE_BROWSER
409 const char *nano_tofiles_msg = N_("Go to file browser");
410#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000411#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000412 const char *nano_dos_msg = N_("Write file out in DOS format");
413 const char *nano_mac_msg = N_("Write file out in Mac format");
414#endif
415 const char *nano_append_msg = N_("Append to the current file");
416 const char *nano_prepend_msg = N_("Prepend to the current file");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000417#ifndef NANO_TINY
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000418 const char *nano_backup_msg =
419 N_("Back up original file when saving");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000420 const char *nano_execute_msg = N_("Execute external command");
421#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000422#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000423 const char *nano_multibuffer_msg = N_("Insert into new buffer");
424#endif
425#ifndef DISABLE_BROWSER
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000426 const char *nano_exitbrowser_msg = N_("Exit from the file browser");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000427 const char *nano_firstfile_msg =
428 N_("Go to the first file in the list");
429 const char *nano_lastfile_msg =
430 N_("Go to the last file in the list");
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000431 const char *nano_gotodir_msg = N_("Go to directory");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000432#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000433#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000434
David Lawrence Ramsey8e4adcd2004-05-20 03:29:33 +0000435/* The following macro is to be used in calling sc_init_one(). The
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000436 * point is that sc_init_one() takes 10 arguments, unless DISABLE_HELP
437 * is defined, when the 4th one should not be there. */
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000438#ifndef DISABLE_HELP
David Lawrence Ramseyeb509222005-03-22 04:50:11 +0000439#define IFHELP(help, nextvar) help, nextvar
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000440#else
David Lawrence Ramseyeb509222005-03-22 04:50:11 +0000441#define IFHELP(help, nextvar) nextvar
Chris Allegrettadab017e2002-04-23 10:56:06 +0000442#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000443
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000444 free_shortcutage(&main_list);
445
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000446 sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000447 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
448 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000449#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000450 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000451#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000452 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000453#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000454 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000455
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000456 sc_init_one(&main_list, NANO_EXIT_KEY,
Chris Allegretta355fbe52001-07-14 19:32:47 +0000457#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000458 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000459 openfile != NULL && openfile != openfile->next ? N_("Close") :
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000460#endif
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000461 exit_msg, IFHELP(nano_exit_msg, FALSE), NANO_NO_KEY),
462 NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000463
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000464 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000465 sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000466 IFHELP(nano_writeout_msg, FALSE), NANO_NO_KEY,
467 NANO_WRITEOUT_FKEY, NANO_NO_KEY, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000468
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000469 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000470 sc_init_one(&main_list, NANO_JUSTIFY_KEY, N_("Justify"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000471 IFHELP(nano_justify_msg, TRUE), NANO_NO_KEY, NANO_JUSTIFY_FKEY,
David Lawrence Ramsey1f479ee2006-03-29 19:58:49 +0000472 NANO_NO_KEY, NOVIEW,
David Lawrence Ramseya539fce2004-06-29 00:43:56 +0000473#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000474 do_justify_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000475#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000476 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000477#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000478 );
Chris Allegretta32da4562002-01-02 15:12:21 +0000479
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000480 /* We allow inserting files in view mode if multibuffers are
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000481 * available, so that we can view multiple files. If we're using
482 * restricted mode, inserting files is disabled, since it allows
483 * reading from or writing to files not specified on the command
484 * line. */
485
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000486 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000487 sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000488 IFHELP(nano_insert_msg, FALSE), NANO_NO_KEY,
489 NANO_INSERTFILE_FKEY, NANO_NO_KEY,
Chris Allegretta32da4562002-01-02 15:12:21 +0000490#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000491 VIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000492#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000493 NOVIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000494#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000495 , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000496
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000497 sc_init_one(&main_list, NANO_WHEREIS_KEY, whereis_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000498 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY, NANO_WHEREIS_FKEY,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000499 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000500
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000501 sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000502 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
503 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000504
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000505 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000506 IFHELP(nano_nextpage_msg, TRUE), NANO_NO_KEY,
507 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000508
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000509 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000510 sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000511 IFHELP(nano_cut_msg, FALSE), NANO_NO_KEY, NANO_CUT_FKEY,
512 NANO_NO_KEY, NOVIEW, do_cut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000513
Chris Allegretta07798352000-11-27 22:58:23 +0000514 if (unjustify)
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000515 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000516 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000517 IFHELP(NULL, FALSE), NANO_NO_KEY, NANO_UNJUSTIFY_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000518 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta07798352000-11-27 22:58:23 +0000519 else
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000520 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000521 sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000522 IFHELP(nano_uncut_msg, FALSE), NANO_NO_KEY,
523 NANO_UNCUT_FKEY, NANO_NO_KEY, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000524
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000525 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000526 sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000527 IFHELP(nano_cursorpos_msg, FALSE), NANO_NO_KEY,
528 NANO_CURSORPOS_FKEY, NANO_NO_KEY, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000529
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000530 /* If we're using restricted mode, spell checking is disabled
531 * because it allows reading from or writing to files not specified
532 * on the command line. */
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000533 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000534 sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000535 IFHELP(nano_spell_msg, TRUE), NANO_NO_KEY, NANO_SPELL_FKEY,
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000536 NANO_NO_KEY, NOVIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000537#ifndef DISABLE_SPELLER
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000538 !ISSET(RESTRICTED) ? do_spell :
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000539#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000540 nano_disabled_msg);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000541
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000542#ifndef NANO_TINY
543 sc_init_one(&main_list, NANO_NO_KEY, whereis_next_msg,
544 IFHELP(nano_whereis_next_msg, FALSE), NANO_WHEREIS_NEXT_KEY,
545 NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
546#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000547
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000548 sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000549 IFHELP(nano_replace_msg, FALSE), NANO_ALT_REPLACE_KEY,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000550 NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000551
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000552#ifndef NANO_TINY
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000553 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000554 sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000555 IFHELP(nano_mark_msg, FALSE), NANO_MARK_ALTKEY, NANO_MARK_FKEY,
David Lawrence Ramseya049c832005-06-12 23:53:28 +0000556 NANO_NO_KEY, VIEW, do_mark);
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000557#endif
558
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000559#ifndef NANO_TINY
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000560 sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
561 IFHELP(nano_cut_till_end_msg, TRUE), NANO_CUTTILLEND_ALTKEY,
562 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
563#endif
564
565 sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
566 IFHELP(nano_forward_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
567 NANO_NO_KEY, VIEW, do_right);
568
569 sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
570 IFHELP(nano_back_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
571 NANO_NO_KEY, VIEW, do_left);
572
573#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000574 sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000575 IFHELP(nano_nextword_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000576 NANO_NO_KEY, VIEW, do_next_word_void);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000577
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000578 sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000579 IFHELP(nano_prevword_msg, FALSE), NANO_PREVWORD_KEY,
580 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_prev_word_void);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000581#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000582
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000583 sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
584 IFHELP(nano_prevline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
585 NANO_NO_KEY, VIEW, do_up);
586
587 sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"),
588 IFHELP(nano_nextline_msg, TRUE), NANO_NO_KEY, NANO_NO_KEY,
589 NANO_NO_KEY, VIEW, do_down);
590
591 sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
592 IFHELP(nano_home_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
593 NANO_NO_KEY, VIEW, do_home);
594
595 sc_init_one(&main_list, NANO_END_KEY, N_("End"),
596 IFHELP(nano_end_msg, FALSE), NANO_NO_KEY), NANO_NO_KEY,
597 NANO_NO_KEY, VIEW, do_end);
598
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000599#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000600 sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000601 IFHELP(nano_parabegin_msg, FALSE), NANO_PARABEGIN_ALTKEY,
602 NANO_NO_KEY, NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000603
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000604 sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000605 IFHELP(nano_paraend_msg, FALSE), NANO_PARAEND_ALTKEY,
606 NANO_NO_KEY, NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000607#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000608
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000609 sc_init_one(&main_list, NANO_NO_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000610 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
611 NANO_NO_KEY, NANO_FIRSTLINE_ALTKEY2, VIEW, do_first_line);
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000612
613 sc_init_one(&main_list, NANO_NO_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000614 IFHELP(nano_lastline_msg, TRUE), NANO_LASTLINE_ALTKEY,
615 NANO_NO_KEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
616
617#ifndef NANO_TINY
618 sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
619 IFHELP(nano_bracket_msg, FALSE), NANO_BRACKET_KEY, NANO_NO_KEY,
620 NANO_NO_KEY, VIEW, do_find_bracket);
621#endif
622
623 sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
624 IFHELP(nano_gotoline_msg, FALSE), NANO_GOTOLINE_ALTKEY,
625 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW,
626 do_gotolinecolumn_void);
627
628#ifndef NANO_TINY
629 sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Up"),
630 IFHELP(nano_scrollup_msg, FALSE), NANO_SCROLLUP_KEY,
631 NANO_NO_KEY, NANO_SCROLLUP_ALTKEY, VIEW, do_scroll_up);
632
633 sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Down"),
634 IFHELP(nano_scrolldown_msg, TRUE), NANO_SCROLLDOWN_KEY,
635 NANO_NO_KEY, NANO_SCROLLDOWN_ALTKEY, VIEW, do_scroll_down);
636#endif
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000637
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000638#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000639 sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000640 IFHELP(nano_prevfile_msg, FALSE), NANO_PREVFILE_KEY,
641 NANO_NO_KEY, NANO_PREVFILE_ALTKEY, VIEW,
642 switch_to_prev_buffer_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000643
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000644 sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000645 IFHELP(nano_nextfile_msg, TRUE), NANO_NEXTFILE_KEY, NANO_NO_KEY,
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000646 NANO_NEXTFILE_ALTKEY, VIEW, switch_to_next_buffer_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000647#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000648
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000649 sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000650 IFHELP(nano_verbatim_msg, FALSE), NANO_VERBATIM_KEY,
651 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_verbatim_input);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000652
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000653 sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"),
654 IFHELP(nano_tab_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
655 NANO_NO_KEY, NOVIEW, do_tab);
656
657 sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"),
658 IFHELP(nano_enter_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
659 NANO_NO_KEY, NOVIEW, do_enter);
660
661 sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
662 IFHELP(nano_delete_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
663 NANO_NO_KEY, NOVIEW, do_delete);
664
665 sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace"),
666 IFHELP(nano_backspace_msg, TRUE), NANO_NO_KEY, NANO_NO_KEY,
667 NANO_NO_KEY, NOVIEW, do_backspace);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000668
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000669#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000670 sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000671 IFHELP(nano_fulljustify_msg, FALSE), NANO_FULLJUSTIFY_ALTKEY,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000672 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000673#endif
674
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000675#ifndef NANO_TINY
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000676 sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
677 IFHELP(nano_wordcount_msg, FALSE), NANO_WORDCOUNT_KEY,
678 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_wordlinechar_count);
679#endif
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000680
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000681 sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg,
682 IFHELP(nano_refresh_msg, TRUE), NANO_NO_KEY, NANO_NO_KEY,
683 NANO_NO_KEY, VIEW, total_refresh);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000684
Chris Allegrettadab017e2002-04-23 10:56:06 +0000685 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000686
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000687 sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000688 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
689 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000690#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000691 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000692#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000693 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000694#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000695 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000696
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000697 sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000698 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
699 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000700
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000701 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000702 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000703 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
704 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000705
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000706 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000707 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000708 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000709
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000710 sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000711 IFHELP(nano_replace_msg, FALSE), NANO_NO_KEY, NANO_REPLACE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000712 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000713
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000714 sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000715 IFHELP(nano_gotoline_msg, FALSE), NANO_NO_KEY,
716 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000717
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000718#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000719 sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000720 IFHELP(nano_parabegin_msg, FALSE), NANO_PARABEGIN_ALTKEY,
721 NANO_NO_KEY, NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000722
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000723 sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000724 IFHELP(nano_paraend_msg, FALSE), NANO_PARAEND_ALTKEY,
725 NANO_NO_KEY, NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000726#endif
727
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000728#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000729 sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000730 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000731 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000732
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000733 sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000734 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
735 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000736#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000737
Chris Allegretta658399a2001-06-14 02:54:22 +0000738#ifdef HAVE_REGEX_H
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000739 sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000740 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000741 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000742#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000743
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000744#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000745 sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000746 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
747 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000748
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000749 sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000750 IFHELP(nano_cut_till_end_msg, FALSE), NANO_CUTTILLEND_ALTKEY,
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000751 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000752#endif
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000753
754#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000755 sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000756 IFHELP(nano_fulljustify_msg, FALSE), NANO_FULLJUSTIFY_ALTKEY,
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000757 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
758#endif
Chris Allegretta5f36c372001-07-16 00:48:53 +0000759
Chris Allegrettadab017e2002-04-23 10:56:06 +0000760 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000761
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000762 sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000763 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
764 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000765#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000766 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000767#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000768 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000769#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000770 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000771
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000772 sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000773 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
774 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000775
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000776 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000777 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000778 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
779 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000780
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000781 sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000782 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000783 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000784
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000785 /* TRANSLATORS: Try to keep this at most 12 characters. */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000786 sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000787 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY),
788 NANO_REPLACE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000789
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000790 sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000791 IFHELP(nano_gotoline_msg, FALSE), NANO_NO_KEY,
792 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000793
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000794#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000795 sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000796 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000797 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000798
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000799 sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000800 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
801 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000802#endif
Chris Allegretta105da332000-10-31 05:10:10 +0000803
Chris Allegretta658399a2001-06-14 02:54:22 +0000804#ifdef HAVE_REGEX_H
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000805 sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000806 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000807 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000808#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000809
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000810#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000811 sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000812 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
813 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000814#endif
Chris Allegretta5f36c372001-07-16 00:48:53 +0000815
Chris Allegrettadab017e2002-04-23 10:56:06 +0000816 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000817
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000818 sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000819 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
820 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000821#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000822 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000823#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000824 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000825#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000826 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000827
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000828 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000829 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
830 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta105da332000-10-31 05:10:10 +0000831
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000832 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000833 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000834 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
835 do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000836
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000837 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000838 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000839 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000840
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000841#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000842 sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000843 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
844 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5beed502003-01-05 20:41:21 +0000845#endif
846
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000847 free_shortcutage(&gotoline_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000848
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000849 sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000850 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
851 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000852#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000853 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000854#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000855 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000856#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000857 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000858
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000859 sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000860 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
861 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000862
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000863 sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000864 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000865 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
866 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000867
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000868 sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000869 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000870 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000871
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000872 sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000873 N_("Go To Text"), IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000874 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000875
Chris Allegrettadab017e2002-04-23 10:56:06 +0000876 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000877
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000878 sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000879 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
880 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000881#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000882 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000883#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000884 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000885#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000886 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000887
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000888 sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000889 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
890 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000891
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000892#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000893 /* If we're using restricted mode, the file browser is disabled.
894 * It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000895
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000896 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000897 sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000898 IFHELP(nano_tofiles_msg, FALSE), NANO_NO_KEY,
899 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000900#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000901
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000902#ifndef NANO_TINY
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000903 /* If we're using restricted mode, the DOS format, Mac format,
904 * append, prepend, and backup toggles are disabled. The first and
905 * second are useless since inserting files is disabled, the third
906 * and fourth are disabled because they allow writing to files not
907 * specified on the command line, and the fifth is useless since
908 * backups are disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000909
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000910 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000911 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000912 sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000913 IFHELP(nano_dos_msg, FALSE), TOGGLE_DOS_KEY,
914 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000915
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000916 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000917 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000918 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000919 IFHELP(nano_mac_msg, FALSE), TOGGLE_MAC_KEY,
920 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000921#endif
922
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000923 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000924 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000925 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000926 IFHELP(nano_append_msg, FALSE), NANO_APPEND_KEY,
927 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000928
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000929 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000930 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000931 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000932 IFHELP(nano_prepend_msg, FALSE), NANO_PREPEND_KEY,
933 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000934
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000935#ifndef NANO_TINY
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000936 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000937 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000938 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000939 IFHELP(nano_backup_msg, FALSE), TOGGLE_BACKUP_KEY,
940 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000941#endif
942
Chris Allegrettadab017e2002-04-23 10:56:06 +0000943 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000944
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000945 sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000946 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
947 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000948#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000949 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000950#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000951 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000952#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000953 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000954
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000955 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000956 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
957 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000958
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000959#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000960 /* If we're using restricted mode, the file browser is disabled.
961 * It's useless since inserting files is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000962 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000963 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000964 IFHELP(nano_tofiles_msg, FALSE), NANO_NO_KEY,
965 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000966#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000967
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000968#ifndef NANO_TINY
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000969 /* If we're using restricted mode, command execution is disabled.
970 * It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000971
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000972 if (!ISSET(RESTRICTED))
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000973 sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000974 /* TRANSLATORS: Try to keep this at most 22 characters. */
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000975 N_("Execute Command"), IFHELP(nano_execute_msg, FALSE),
976 NANO_NO_KEY, NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000977
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000978#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000979 /* If we're using restricted mode, the multibuffer toggle is
980 * disabled. It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000981
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000982 if (!ISSET(RESTRICTED))
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000983 sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000984 IFHELP(nano_multibuffer_msg, FALSE),
985 TOGGLE_MULTIBUFFER_KEY, NANO_NO_KEY, NANO_NO_KEY,
986 NOVIEW, NULL);
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000987#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000988#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000989
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000990#ifndef NANO_TINY
Chris Allegrettadab017e2002-04-23 10:56:06 +0000991 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000992
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000993 sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000994 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
995 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000996#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000997 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000998#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000999 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001000#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001001 );
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001002
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001003 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001004 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1005 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +00001006
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001007 sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001008 IFHELP(nano_insert_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001009 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001010
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +00001011#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +00001012 sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001013 IFHELP(nano_multibuffer_msg, FALSE), TOGGLE_MULTIBUFFER_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001014 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001015#endif
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +00001016#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00001017
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001018#ifndef DISABLE_HELP
1019 free_shortcutage(&help_list);
1020
1021 sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001022 IFHELP(nano_refresh_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1023 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001024
1025 sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001026 IFHELP(nano_exit_msg, FALSE), NANO_NO_KEY, NANO_EXIT_FKEY,
1027 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001028
1029 sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001030 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
1031 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001032
1033 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001034 IFHELP(nano_nextpage_msg, FALSE), NANO_NO_KEY,
1035 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001036
1037 sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001038 IFHELP(nano_prevline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001039 NANO_NO_KEY, VIEW, NULL);
1040
1041 sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001042 IFHELP(nano_nextline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001043 NANO_NO_KEY, VIEW, NULL);
1044#endif
1045
1046#ifndef DISABLE_SPELLER
1047 free_shortcutage(&spell_list);
1048
1049 sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001050 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1051 NANO_NO_KEY, VIEW,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001052#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001053 do_help_void
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001054#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001055 nano_disabled_msg
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001056#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001057 );
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001058
1059 sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001060 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1061 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001062#endif
1063
Rocco Corsiaf5c3022001-01-12 07:51:05 +00001064#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +00001065 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001066
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001067 sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001068 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1069 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +00001070
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +00001071 sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001072 IFHELP(nano_exitbrowser_msg, FALSE), NANO_NO_KEY,
1073 NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +00001074
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001075 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001076 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
1077 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001078
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001079 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001080 IFHELP(nano_nextpage_msg, FALSE), NANO_NO_KEY,
1081 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001082
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001083 sc_init_one(&browser_list, NANO_WHEREIS_KEY, whereis_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001084 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1085 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001086
1087 sc_init_one(&browser_list, NANO_NO_KEY, whereis_next_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001088 IFHELP(nano_whereis_next_msg, FALSE), NANO_WHEREIS_NEXT_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001089 NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, NULL);
1090
David Lawrence Ramseycde90392006-04-09 18:27:42 +00001091 /* TRANSLATORS: Try to keep this at most 22 characters. */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001092 sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001093 IFHELP(nano_gotodir_msg, FALSE), NANO_GOTOLINE_ALTKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001094 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Rocco Corsi12f294c2001-04-14 06:50:24 +00001095
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001096 free_shortcutage(&whereis_file_list);
1097
1098 sc_init_one(&whereis_file_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001099 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1100 NANO_NO_KEY, VIEW,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001101#ifndef DISABLE_HELP
1102 do_browser_help
1103#else
1104 nano_disabled_msg
1105#endif
1106 );
1107
1108 sc_init_one(&whereis_file_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001109 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1110 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001111
1112 sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001113 IFHELP(nano_firstfile_msg, FALSE), NANO_FIRSTFILE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +00001114 NANO_FIRSTFILE_FKEY, NANO_FIRSTFILE_ALTKEY2, VIEW,
1115 do_first_file);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001116
1117 sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001118 IFHELP(nano_lastfile_msg, FALSE), NANO_LASTFILE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +00001119 NANO_LASTFILE_FKEY, NANO_LASTFILE_ALTKEY2, VIEW, do_last_file);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001120
1121#ifndef NANO_SMALL
1122 sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001123 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001124 NANO_NO_KEY, VIEW, NULL);
1125
1126 sc_init_one(&whereis_file_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001127 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
1128 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001129#endif
1130
1131#ifdef HAVE_REGEX_H
1132 sc_init_one(&whereis_file_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001133 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001134 NANO_NO_KEY, VIEW, NULL);
1135#endif
1136
1137#ifndef NANO_SMALL
1138 sc_init_one(&whereis_file_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001139 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1140 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001141#endif
1142
Chris Allegrettadab017e2002-04-23 10:56:06 +00001143 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001144
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001145 sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001146 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1147 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001148#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001149 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001150#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001151 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001152#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001153 );
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001154
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001155 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001156 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1157 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001158#endif
1159
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001160 currshortcut = main_list;
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001161
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001162#ifndef NANO_TINY
Chris Allegrettadab017e2002-04-23 10:56:06 +00001163 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001164#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +00001165}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001166
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001167/* Free the given shortcut. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001168void free_shortcutage(shortcut **shortcutage)
1169{
1170 assert(shortcutage != NULL);
David Lawrence Ramsey193b0e52005-06-06 18:41:17 +00001171
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001172 while (*shortcutage != NULL) {
1173 shortcut *ps = *shortcutage;
1174 *shortcutage = (*shortcutage)->next;
1175 free(ps);
1176 }
1177}
1178
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001179#ifndef NANO_TINY
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001180/* Add a new toggle to the end of the global toggle list. */
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001181void toggle_init_one(int val, const char *desc, bool blank_after, long
1182 flag)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001183{
1184 toggle *u;
1185
1186 if (toggles == NULL) {
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001187 toggles = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001188 u = toggles;
1189 } else {
1190 for (u = toggles; u->next != NULL; u = u->next)
1191 ;
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001192 u->next = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001193 u = u->next;
1194 }
1195
1196 u->val = val;
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001197 u->desc = (desc == NULL) ? "" : _(desc);
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001198 u->blank_after = blank_after;
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001199 u->flag = flag;
1200 u->next = NULL;
1201}
1202
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001203/* Initialize the global toggle list. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001204void toggle_init(void)
1205{
1206 /* There is no need to reinitialize the toggles. They can't
1207 * change. */
1208 if (toggles != NULL)
1209 return;
1210
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001211 toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), FALSE, NO_HELP);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001212
David Lawrence Ramsey8ff785c2006-04-19 23:13:44 +00001213 toggle_init_one(TOGGLE_CONST_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001214 N_("Constant cursor position display"), FALSE, CONST_UPDATE);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001215
1216 toggle_init_one(TOGGLE_MORESPACE_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001217 N_("Use of more space for editing"), FALSE, MORE_SPACE);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001218
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001219 toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001220 SMOOTH_SCROLL);
1221
1222#ifdef ENABLE_NANORC
1223 toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001224 FALSE, WHITESPACE_DISPLAY);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001225#endif
1226
1227#ifdef ENABLE_COLOR
1228 toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001229 TRUE, NO_COLOR_SYNTAX);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001230#endif
1231
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001232 toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001233 SMART_HOME);
1234
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001235 toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001236 AUTOINDENT);
1237
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001238 toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), FALSE,
1239 CUT_TO_END);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001240
1241#ifndef DISABLE_WRAPPING
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001242 toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001243 NO_WRAP);
1244#endif
1245
1246 toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001247 N_("Conversion of typed tabs to spaces"), TRUE, TABS_TO_SPACES);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001248
1249 /* If we're using restricted mode, the backup toggle is disabled.
1250 * It's useless since backups are disabled. */
1251 if (!ISSET(RESTRICTED))
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001252 toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001253 BACKUP_FILE);
1254
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001255#ifdef ENABLE_MULTIBUFFER
1256 /* If we're using restricted mode, the multibuffer toggle is
1257 * disabled. It's useless since inserting files is disabled. */
1258 if (!ISSET(RESTRICTED))
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +00001259 toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001260 N_("Multiple file buffers"), FALSE, MULTIBUFFER);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001261#endif
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001262
David Lawrence Ramsey6397b592006-04-20 22:36:10 +00001263#ifndef DISABLE_MOUSE
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001264 toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), FALSE,
1265 USE_MOUSE);
David Lawrence Ramsey6397b592006-04-20 22:36:10 +00001266#endif
1267
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001268 /* If we're using restricted mode, the DOS/Mac conversion toggle is
1269 * disabled. It's useless since inserting files is disabled. */
1270 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001271 toggle_init_one(TOGGLE_NOCONVERT_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001272 N_("No conversion from DOS/Mac format"), FALSE,
1273 NO_CONVERT);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001274
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001275 /* If we're using restricted mode, the suspend toggle is disabled.
1276 * It's useless since suspending is disabled. */
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001277 if (!ISSET(RESTRICTED))
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001278 toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), FALSE,
1279 SUSPEND);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001280}
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001281#endif /* !NANO_TINY */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001282
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001283#ifdef DEBUG
1284/* This function is used to gracefully return all the memory we've used.
1285 * It should be called just before calling exit(). Practically, the
Chris Allegretta6232d662002-05-12 19:52:15 +00001286 * only effect is to cause a segmentation fault if the various data
1287 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +00001288 * function unless debugging is turned on. */
Chris Allegretta6df90f52002-07-19 01:08:59 +00001289void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001290{
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001291 delwin(topwin);
1292 delwin(edit);
1293 delwin(bottomwin);
1294
Chris Allegretta7662c862003-01-13 01:35:15 +00001295#ifndef DISABLE_JUSTIFY
1296 if (quotestr != NULL)
1297 free(quotestr);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +00001298#ifdef HAVE_REGEX_H
1299 regfree(&quotereg);
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001300 if (quoteerr != NULL)
1301 free(quoteerr);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +00001302#endif
Chris Allegretta7662c862003-01-13 01:35:15 +00001303#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001304#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +00001305 if (backup_dir != NULL)
1306 free(backup_dir);
1307#endif
Chris Allegretta2598c662002-03-28 01:59:34 +00001308#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001309 if (operating_dir != NULL)
1310 free(operating_dir);
1311 if (full_operating_dir != NULL)
1312 free(full_operating_dir);
1313#endif
1314 if (last_search != NULL)
1315 free(last_search);
1316 if (last_replace != NULL)
1317 free(last_replace);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001318#ifndef DISABLE_SPELLER
1319 if (alt_speller != NULL)
1320 free(alt_speller);
1321#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001322 if (answer != NULL)
1323 free(answer);
1324 if (cutbuffer != NULL)
Chris Allegretta7662c862003-01-13 01:35:15 +00001325 free_filestruct(cutbuffer);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +00001326#ifndef DISABLE_JUSTIFY
1327 if (jusbuffer != NULL)
1328 free_filestruct(jusbuffer);
1329#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001330 free_shortcutage(&main_list);
1331 free_shortcutage(&whereis_list);
1332 free_shortcutage(&replace_list);
1333 free_shortcutage(&replace_list_2);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001334 free_shortcutage(&gotoline_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001335 free_shortcutage(&writefile_list);
1336 free_shortcutage(&insertfile_list);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001337#ifndef NANO_TINY
1338 free_shortcutage(&extcmd_list);
1339#endif
Chris Allegretta7662c862003-01-13 01:35:15 +00001340#ifndef DISABLE_HELP
Chris Allegretta6df90f52002-07-19 01:08:59 +00001341 free_shortcutage(&help_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001342#endif
1343#ifndef DISABLE_SPELLER
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001344 free_shortcutage(&spell_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001345#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001346#ifndef DISABLE_BROWSER
1347 free_shortcutage(&browser_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001348 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001349#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001350#ifndef NANO_TINY
David Lawrence Ramsey40e4acf2005-05-26 06:09:07 +00001351 /* Free the memory associated with each toggle. */
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001352 while (toggles != NULL) {
1353 toggle *t = toggles;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001354
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001355 toggles = toggles->next;
1356 free(t);
1357 }
1358#endif
David Lawrence Ramsey5d8d0b12005-05-26 05:53:29 +00001359 /* Free the memory associated with each open file buffer. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +00001360 if (openfile != NULL)
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +00001361 free_openfilestruct(openfile);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001362#ifdef ENABLE_COLOR
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001363 if (syntaxstr != NULL)
1364 free(syntaxstr);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001365 while (syntaxes != NULL) {
1366 syntaxtype *bill = syntaxes;
1367
1368 free(syntaxes->desc);
1369 while (syntaxes->extensions != NULL) {
1370 exttype *bob = syntaxes->extensions;
1371
1372 syntaxes->extensions = bob->next;
David Lawrence Ramsey2385c1a2005-07-29 21:42:08 +00001373 free(bob->ext_regex);
David Lawrence Ramsey7fc0ada2005-08-29 18:52:06 +00001374 if (bob->ext != NULL) {
1375 regfree(bob->ext);
1376 free(bob->ext);
1377 }
Chris Allegretta6df90f52002-07-19 01:08:59 +00001378 free(bob);
1379 }
1380 while (syntaxes->color != NULL) {
1381 colortype *bob = syntaxes->color;
1382
1383 syntaxes->color = bob->next;
David Lawrence Ramsey2385c1a2005-07-29 21:42:08 +00001384 free(bob->start_regex);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001385 if (bob->start != NULL) {
1386 regfree(bob->start);
1387 free(bob->start);
1388 }
David Lawrence Ramseyd2361f02005-07-14 18:33:51 +00001389 if (bob->end_regex != NULL)
1390 free(bob->end_regex);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001391 if (bob->end != NULL) {
Chris Allegrettace452fb2003-02-03 02:56:44 +00001392 regfree(bob->end);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001393 free(bob->end);
1394 }
Chris Allegretta6df90f52002-07-19 01:08:59 +00001395 free(bob);
1396 }
1397 syntaxes = syntaxes->next;
1398 free(bill);
1399 }
1400#endif /* ENABLE_COLOR */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001401#ifndef NANO_TINY
David Lawrence Ramsey40e4acf2005-05-26 06:09:07 +00001402 /* Free the search and replace history lists. */
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001403 if (searchage != NULL)
1404 free_filestruct(searchage);
1405 if (replaceage != NULL)
1406 free_filestruct(replaceage);
Chris Allegretta5beed502003-01-05 20:41:21 +00001407#endif
David Lawrence Ramseya27bd652004-08-17 05:23:38 +00001408#ifdef ENABLE_NANORC
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001409 if (homedir != NULL)
1410 free(homedir);
David Lawrence Ramseya27bd652004-08-17 05:23:38 +00001411#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001412}
Chris Allegretta6232d662002-05-12 19:52:15 +00001413#endif /* DEBUG */