blob: 8af2b724a922372060d8a4184dc6ff58e308606b [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
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000026/* Global variables. */
27#ifndef NANO_TINY
David Lawrence Ramsey1c5af642006-05-10 15:15:06 +000028sigjmp_buf jump_buf;
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000029 /* Used to return to main() or the unjustify routine in
30 * do_justify() after a SIGWINCH. */
David Lawrence Ramsey1c5af642006-05-10 15:15:06 +000031bool jump_buf_main = FALSE;
32 /* Have we set jump_buf so that we return to main() after a
33 * SIGWINCH? */
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000034#endif
35
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000036#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000037ssize_t fill = 0;
38 /* The column where we will wrap lines. */
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000039ssize_t wrap_at = -CHARS_FROM_EOL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000040 /* The position where we will wrap lines. fill is equal to this
41 * if it's greater than zero, and equal to (COLS + this) if it
42 * isn't. */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000043#endif
44
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000045char *last_search = NULL;
46 /* The last string we searched for. */
47char *last_replace = NULL;
48 /* The last replacement string we searched for. */
Chris Allegretta6df90f52002-07-19 01:08:59 +000049
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000050long flags = 0;
51 /* Our flag containing the states of all global options. */
52WINDOW *topwin;
53 /* The top portion of the window, where we display the version
54 * number of nano, the name of the current file, and whether the
55 * current file has been modified. */
56WINDOW *edit;
57 /* The middle portion of the window, i.e, the edit window, where
58 * we display the current file we're editing. */
59WINDOW *bottomwin;
60 /* The bottom portion of the window, where we display statusbar
61 * messages, the statusbar prompt, and a list of shortcuts. */
62int editwinrows = 0;
63 /* How many rows does the edit window take up? */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000064
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000065filestruct *cutbuffer = NULL;
66 /* The buffer where we store cut text. */
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000067#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000068filestruct *jusbuffer = NULL;
69 /* The buffer where we store unjustified text. */
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000070#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000071partition *filepart = NULL;
72 /* The partition where we store a portion of the current
73 * file. */
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +000074openfilestruct *openfile = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000075 /* The list of all open file buffers. */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000076
David Lawrence Ramseyd89617f2006-01-06 21:51:10 +000077#ifndef NANO_TINY
78char *matchbrackets = NULL;
79 /* The opening and closing brackets that can be found by bracket
80 * searches. */
81#endif
82
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000083#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000084char *whitespace = NULL;
85 /* The characters used when displaying the first characters of
86 * tabs and spaces. */
87int whitespace_len[2];
88 /* The length of these characters. */
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000089#endif
90
Chris Allegrettae4f940d2002-03-03 22:36:36 +000091#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000092char *punct = NULL;
93 /* The closing punctuation that can end sentences. */
94char *brackets = NULL;
95 /* The closing brackets that can follow closing punctuation and
96 * can end sentences. */
97char *quotestr = NULL;
98 /* The quoting string. The default value is set in main(). */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000099#ifdef HAVE_REGEX_H
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000100regex_t quotereg;
101 /* The compiled regular expression from the quoting string. */
102int quoterc;
103 /* Whether it actually compiled. */
104char *quoteerr = NULL;
105 /* The error message, if it didn't. */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000106#else
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000107size_t quotelen;
108 /* The length of the quoting string in bytes. */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000109#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000110#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +0000111
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000112char *answer = NULL;
113 /* The answer string used in the statusbar prompt. */
114
115ssize_t tabsize = -1;
116 /* The width of a tab in spaces. The default value is set in
117 * main(). */
118
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000119#ifndef NANO_TINY
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000120char *backup_dir = NULL;
121 /* The directory where we store backup files. */
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000122#endif
Chris Allegrettae1f14522001-09-19 03:19:43 +0000123#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000124char *operating_dir = NULL;
125 /* The relative path to the operating directory, which we can't
126 * move outside of. */
127char *full_operating_dir = NULL;
128 /* The full path to it. */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000129#endif
130
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000131#ifndef DISABLE_SPELLER
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000132char *alt_speller = NULL;
133 /* The command to use for the alternate spell checker. */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000134#endif
135
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000136shortcut *main_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000137 /* The main shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000138shortcut *whereis_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000139 /* The "Search" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000140shortcut *replace_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000141 /* The "Search (to replace)" shortcut list. */
142shortcut *replace_list_2 = NULL;
143 /* The "Replace with" shortcut list. */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000144shortcut *gotoline_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000145 /* The "Enter line number, column number" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000146shortcut *writefile_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000147 /* The "File Name to Write" shortcut list. */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000148shortcut *insertfile_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000149 /* The "File to insert" shortcut list. */
150#ifndef NANO_TINY
151shortcut *extcmd_list = NULL;
152 /* The "Command to execute" shortcut list. */
153#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000154#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000155shortcut *help_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000156 /* The help text shortcut list. */
Chris Allegretta7662c862003-01-13 01:35:15 +0000157#endif
158#ifndef DISABLE_SPELLER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000159shortcut *spell_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000160 /* The internal spell checker shortcut list. */
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000161#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000162#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000163shortcut *browser_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000164 /* The file browser shortcut list. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000165shortcut *whereis_file_list = NULL;
166 /* The file browser "Search" shortcut list. */
Chris Allegretta201f1d92003-02-05 02:51:19 +0000167shortcut *gotodir_list = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000168 /* The "Go To Directory" shortcut list. */
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000169#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000170
Chris Allegretta8ce24132001-04-30 11:28:46 +0000171#ifdef ENABLE_COLOR
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000172syntaxtype *syntaxes = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000173 /* The global list of color syntaxes. */
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000174char *syntaxstr = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000175 /* The color syntax name specified on the command line. */
Chris Allegretta8ce24132001-04-30 11:28:46 +0000176#endif
177
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000178const shortcut *currshortcut;
179 /* The current shortcut list we're using. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000180#ifndef NANO_TINY
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000181toggle *toggles = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000182 /* The global toggle list. */
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000183#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000184
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000185#ifndef NANO_TINY
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000186filestruct *search_history = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000187 /* The search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000188filestruct *searchage = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000189 /* The top of the search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000190filestruct *searchbot = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000191 /* The bottom of the search string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000192filestruct *replace_history = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000193 /* The replace string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000194filestruct *replaceage = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000195 /* The top of the replace string history list. */
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000196filestruct *replacebot = NULL;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000197 /* The bottom of the replace string history list. */
Chris Allegretta5beed502003-01-05 20:41:21 +0000198#endif
199
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +0000200/* Regular expressions. */
Chris Allegretta805c26d2000-09-06 13:39:17 +0000201#ifdef HAVE_REGEX_H
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000202regex_t search_regexp;
203 /* The compiled regular expression to use in searches. */
204regmatch_t regmatches[10];
205 /* The match positions for parenthetical subexpressions, 10
206 * maximum, used in regular expression searches. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000207#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000208
David Lawrence Ramsey4d72de72006-04-12 15:27:40 +0000209int reverse_attr = A_REVERSE;
210 /* The curses attribute we use for reverse video. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000211bool curses_ended = FALSE;
212 /* Whether endwin() has ended curses mode and statusbar()
213 * should hence write to stderr instead of displaying on the
214 * statusbar. */
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000215
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000216char *homedir = NULL;
217 /* The user's home directory, from $HOME or
218 * /etc/passwd. */
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000219
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000220/* Return the number of entries in the shortcut list s. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000221size_t length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000222{
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000223 size_t i = 0;
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000224
Chris Allegrettadab017e2002-04-23 10:56:06 +0000225 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000226 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000227 return i;
228}
229
David Lawrence Ramseye6757b92006-04-19 13:36:56 +0000230/* Add a new shortcut to the end of the shortcut list. */
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000231void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000232#ifndef DISABLE_HELP
Chris Allegrettaf717f982003-02-13 22:25:01 +0000233 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000234#endif
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000235 bool blank_after, int metaval, int funcval, int miscval, bool
236 view, void (*func)(void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000237{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000238 shortcut *s;
239
240 if (*shortcutage == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000241 *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000242 s = *shortcutage;
243 } else {
244 for (s = *shortcutage; s->next != NULL; s = s->next)
245 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000246 s->next = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000247 s = s->next;
248 }
249
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000250 s->ctrlval = ctrlval;
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000251 s->desc = (desc == NULL) ? "" : _(desc);
Chris Allegrettadab017e2002-04-23 10:56:06 +0000252#ifndef DISABLE_HELP
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000253 s->help = (help == NULL) ? "" : _(help);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000254#endif
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000255 s->blank_after = blank_after;
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000256 s->metaval = metaval;
257 s->funcval = funcval;
258 s->miscval = miscval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000259 s->viewok = view;
260 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000261 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000262}
263
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000264/* Initialize all shortcut lists. If unjustify is TRUE, replace the
265 * Uncut shortcut in the main shortcut list with UnJustify. */
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000266void shortcut_init(bool unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000267{
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000268 /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */
David Lawrence Ramsey12c08dd2006-03-25 15:56:40 +0000269 const char *cancel_msg = N_("Cancel");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000270 const char *get_help_msg = N_("Get Help");
271 const char *exit_msg = N_("Exit");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000272 const char *whereis_msg = N_("Where Is");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000273 const char *prev_page_msg = N_("Prev Page");
274 const char *next_page_msg = N_("Next Page");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000275 const char *go_to_line_msg = N_("Go To Line");
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000276 /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */
David Lawrence Ramsey12c08dd2006-03-25 15:56:40 +0000277 const char *replace_msg = N_("Replace");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000278#ifndef NANO_TINY
David Lawrence Ramsey0ec909c2006-05-06 15:07:26 +0000279 /* TRANSLATORS: Try to keep this at most 12 characters. */
280 const char *whereis_next_msg = N_("WhereIs Next");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000281#endif
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000282 /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000283 const char *first_line_msg = N_("First Line");
284 const char *last_line_msg = N_("Last Line");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000285#ifndef NANO_TINY
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000286 const char *cut_till_end_msg = N_("CutTillEnd");
287#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000288#ifndef DISABLE_JUSTIFY
289 const char *beg_of_par_msg = N_("Beg of Par");
290 const char *end_of_par_msg = N_("End of Par");
291 const char *fulljstify_msg = N_("FullJstify");
292#endif
David Lawrence Ramsey81378762006-04-24 20:53:43 +0000293 const char *refresh_msg = N_("Refresh");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000294#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000295 const char *case_sens_msg = N_("Case Sens");
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000296 const char *backwards_msg = N_("Backwards");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000297#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000298#ifdef HAVE_REGEX_H
299 const char *regexp_msg = N_("Regexp");
300#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000301#ifndef NANO_TINY
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000302 /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000303 const char *history_msg = N_("History");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000304#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaf318aa2006-04-12 12:54:23 +0000305 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000306 const char *new_buffer_msg = N_("New Buffer");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000307#endif
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000308#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000309#ifndef DISABLE_BROWSER
David Lawrence Ramsey602199d2006-05-06 15:31:32 +0000310 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000311 const char *to_files_msg = N_("To Files");
David Lawrence Ramsey602199d2006-05-06 15:31:32 +0000312 /* TRANSLATORS: Try to keep this and following strings at most 12 characters. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000313 const char *first_file_msg = N_("First File");
David Lawrence Ramsey602199d2006-05-06 15:31:32 +0000314 /* TRANSLATORS: Try to keep this and previous strings at most 12 characters. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000315 const char *last_file_msg = N_("Last File");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000316#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000317#ifndef DISABLE_HELP
David Lawrence Ramsey804e1072006-03-29 19:43:32 +0000318 const char *nano_cancel_msg = N_("Cancel the current function");
David Lawrence Ramsey57c9afb2006-04-14 20:21:45 +0000319 const char *nano_help_msg = N_("Display this help text");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000320 const char *nano_exit_msg =
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000321#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey95f7a742005-06-16 03:11:39 +0000322 N_("Close the current file buffer/Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000323#else
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000324 N_("Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000325#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000326 ;
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000327 const char *nano_writeout_msg =
328 N_("Write the current file to disk");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000329 const char *nano_justify_msg = N_("Justify the current paragraph");
330 const char *nano_insert_msg =
331 N_("Insert another file into the current one");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000332 const char *nano_whereis_msg =
333 N_("Search for text within the editor");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000334 const char *nano_prevpage_msg = N_("Move to the previous screen");
335 const char *nano_nextpage_msg = N_("Move to the next screen");
336 const char *nano_cut_msg =
337 N_("Cut the current line and store it in the cutbuffer");
338 const char *nano_uncut_msg =
339 N_("Uncut from the cutbuffer into the current line");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000340 const char *nano_cursorpos_msg =
David Lawrence Ramseyf50bd4b2006-04-14 20:15:44 +0000341 N_("Display the position of the cursor");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000342 const char *nano_spell_msg =
343 N_("Invoke the spell checker, if available");
David Lawrence Ramsey16349c92005-07-11 20:50:43 +0000344 const char *nano_gotoline_msg = N_("Go to line and column number");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000345 const char *nano_replace_msg = N_("Replace text within the editor");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000346#ifndef NANO_TINY
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000347 const char *nano_mark_msg = N_("Mark text at the cursor position");
348 const char *nano_whereis_next_msg = N_("Repeat last search");
David Lawrence Ramseycf1879b2006-04-27 23:39:49 +0000349 const char *nano_copy_msg =
350 N_("Copy the current line and store it in the cutbuffer");
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000351 const char *nano_indentmarked_msg = N_("Indent marked text");
352 const char *nano_unindentmarked_msg = N_("Unindent marked text");
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000353#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000354 const char *nano_forward_msg = N_("Move forward one character");
355 const char *nano_back_msg = N_("Move back one character");
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000356#ifndef NANO_TINY
357 const char *nano_nextword_msg = N_("Move forward one word");
358 const char *nano_prevword_msg = N_("Move backward one word");
359#endif
360 const char *nano_prevline_msg = N_("Move to the previous line");
361 const char *nano_nextline_msg = N_("Move to the next line");
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000362 const char *nano_home_msg =
363 N_("Move to the beginning of the current line");
364 const char *nano_end_msg =
365 N_("Move to the end of the current line");
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000366#ifndef DISABLE_JUSTIFY
367 const char *nano_parabegin_msg =
David Lawrence Ramsey40e05722006-04-23 19:21:12 +0000368 N_("Move to the beginning of the current paragraph");
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000369 const char *nano_paraend_msg =
David Lawrence Ramsey40e05722006-04-23 19:21:12 +0000370 N_("Move to the end of the current paragraph");
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000371#endif
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000372 const char *nano_firstline_msg =
373 N_("Move to the first line of the file");
374 const char *nano_lastline_msg =
375 N_("Move to the last line of the file");
376#ifndef NANO_TINY
377 const char *nano_bracket_msg = N_("Move to the matching bracket");
378 const char *nano_scrollup_msg =
379 N_("Scroll up one line without scrolling the cursor");
380 const char *nano_scrolldown_msg =
381 N_("Scroll down one line without scrolling the cursor");
382#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000383#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000384 const char *nano_prevfile_msg =
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000385 N_("Switch to the previous file buffer");
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000386 const char *nano_nextfile_msg =
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000387 N_("Switch to the next file buffer");
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000388#endif
David Lawrence Ramsey40e05722006-04-23 19:21:12 +0000389 const char *nano_verbatim_msg =
David Lawrence Ramsey939d4232006-04-24 21:00:17 +0000390 N_("Insert the next keystroke verbatim");
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000391 const char *nano_tab_msg =
David Lawrence Ramseybf784202006-04-29 13:59:04 +0000392 N_("Insert a tab at the cursor position");
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000393 const char *nano_enter_msg =
David Lawrence Ramseycf1879b2006-04-27 23:39:49 +0000394 N_("Insert a newline at the cursor position");
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000395 const char *nano_delete_msg =
396 N_("Delete the character under the cursor");
397 const char *nano_backspace_msg =
398 N_("Delete the character to the left of the cursor");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000399#ifndef NANO_TINY
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000400 const char *nano_cut_till_end_msg =
401 N_("Cut from the cursor position to the end of the file");
402#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000403#ifndef DISABLE_JUSTIFY
404 const char *nano_fulljustify_msg = N_("Justify the entire file");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000405#endif
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000406#ifndef NANO_TINY
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000407 const char *nano_wordcount_msg =
408 N_("Count the number of words, lines, and characters");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000409#endif
David Lawrence Ramsey854a44a2006-04-24 21:14:55 +0000410 const char *nano_refresh_msg =
411 N_("Refresh (redraw) the current screen");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000412#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000413 const char *nano_case_msg =
414 N_("Make the current search/replace case (in)sensitive");
415 const char *nano_reverse_msg =
416 N_("Make the current search/replace go backwards");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000417#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000418#ifdef HAVE_REGEX_H
419 const char *nano_regexp_msg = N_("Use regular expressions");
420#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000421#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000422 const char *nano_history_msg =
423 N_("Edit the previous search/replace strings");
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000424#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000425#ifndef DISABLE_BROWSER
426 const char *nano_tofiles_msg = N_("Go to file browser");
427#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000428#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000429 const char *nano_dos_msg = N_("Write file out in DOS format");
430 const char *nano_mac_msg = N_("Write file out in Mac format");
431#endif
432 const char *nano_append_msg = N_("Append to the current file");
433 const char *nano_prepend_msg = N_("Prepend to the current file");
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000434#ifndef NANO_TINY
David Lawrence Ramsey9b108c22005-06-06 18:38:16 +0000435 const char *nano_backup_msg =
436 N_("Back up original file when saving");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000437 const char *nano_execute_msg = N_("Execute external command");
438#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000439#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000440 const char *nano_multibuffer_msg = N_("Insert into new buffer");
441#endif
442#ifndef DISABLE_BROWSER
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000443 const char *nano_exitbrowser_msg = N_("Exit from the file browser");
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000444 const char *nano_firstfile_msg =
445 N_("Go to the first file in the list");
446 const char *nano_lastfile_msg =
447 N_("Go to the last file in the list");
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000448 const char *nano_gotodir_msg = N_("Go to directory");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000449#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000450#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000451
David Lawrence Ramsey8e4adcd2004-05-20 03:29:33 +0000452/* The following macro is to be used in calling sc_init_one(). The
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000453 * point is that sc_init_one() takes 10 arguments, unless DISABLE_HELP
454 * is defined, when the 4th one should not be there. */
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000455#ifndef DISABLE_HELP
David Lawrence Ramseyeb509222005-03-22 04:50:11 +0000456#define IFHELP(help, nextvar) help, nextvar
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000457#else
David Lawrence Ramseyeb509222005-03-22 04:50:11 +0000458#define IFHELP(help, nextvar) nextvar
Chris Allegrettadab017e2002-04-23 10:56:06 +0000459#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000460
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000461 free_shortcutage(&main_list);
462
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000463 sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000464 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
465 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000466#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000467 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000468#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000469 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000470#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000471 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000472
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000473 sc_init_one(&main_list, NANO_EXIT_KEY,
Chris Allegretta355fbe52001-07-14 19:32:47 +0000474#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000475 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000476 openfile != NULL && openfile != openfile->next ? N_("Close") :
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000477#endif
David Lawrence Ramseybdf84dd2006-04-22 19:52:27 +0000478 exit_msg, IFHELP(nano_exit_msg, FALSE), NANO_NO_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000479 NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000480
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000481 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000482 sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000483 IFHELP(nano_writeout_msg, FALSE), NANO_NO_KEY,
484 NANO_WRITEOUT_FKEY, NANO_NO_KEY, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000485
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_JUSTIFY_KEY, N_("Justify"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000488 IFHELP(nano_justify_msg, TRUE), NANO_NO_KEY, NANO_JUSTIFY_FKEY,
David Lawrence Ramsey1f479ee2006-03-29 19:58:49 +0000489 NANO_NO_KEY, NOVIEW,
David Lawrence Ramseya539fce2004-06-29 00:43:56 +0000490#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000491 do_justify_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000492#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000493 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000494#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000495 );
Chris Allegretta32da4562002-01-02 15:12:21 +0000496
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000497 /* We allow inserting files in view mode if multibuffers are
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000498 * available, so that we can view multiple files. If we're using
499 * restricted mode, inserting files is disabled, since it allows
500 * reading from or writing to files not specified on the command
501 * line. */
502
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000503 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000504 sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000505 IFHELP(nano_insert_msg, FALSE), NANO_NO_KEY,
506 NANO_INSERTFILE_FKEY, NANO_NO_KEY,
Chris Allegretta32da4562002-01-02 15:12:21 +0000507#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000508 VIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000509#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000510 NOVIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000511#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000512 , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000513
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000514 sc_init_one(&main_list, NANO_WHEREIS_KEY, whereis_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000515 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY, NANO_WHEREIS_FKEY,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000516 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000517
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000518 sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000519 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
520 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000521
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000522 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000523 IFHELP(nano_nextpage_msg, TRUE), NANO_NO_KEY,
524 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000525
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000526 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000527 sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000528 IFHELP(nano_cut_msg, FALSE), NANO_NO_KEY, NANO_CUT_FKEY,
David Lawrence Ramseyc87e0c02006-04-25 02:23:28 +0000529 NANO_NO_KEY, NOVIEW, do_cut_text_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000530
Chris Allegretta07798352000-11-27 22:58:23 +0000531 if (unjustify)
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000532 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000533 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000534 IFHELP(NULL, FALSE), NANO_NO_KEY, NANO_UNJUSTIFY_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000535 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta07798352000-11-27 22:58:23 +0000536 else
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000537 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey0ec909c2006-05-06 15:07:26 +0000538 sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Text"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000539 IFHELP(nano_uncut_msg, FALSE), NANO_NO_KEY,
540 NANO_UNCUT_FKEY, NANO_NO_KEY, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000541
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000542 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000543 sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000544 IFHELP(nano_cursorpos_msg, FALSE), NANO_NO_KEY,
545 NANO_CURSORPOS_FKEY, NANO_NO_KEY, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000546
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000547 /* If we're using restricted mode, spell checking is disabled
548 * because it allows reading from or writing to files not specified
549 * on the command line. */
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000550 /* TRANSLATORS: Try to keep this at most 10 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000551 sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000552 IFHELP(nano_spell_msg, TRUE), NANO_NO_KEY, NANO_SPELL_FKEY,
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000553 NANO_NO_KEY, NOVIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000554#ifndef DISABLE_SPELLER
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000555 !ISSET(RESTRICTED) ? do_spell :
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000556#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000557 nano_disabled_msg);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000558
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +0000559 sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
560 IFHELP(nano_gotoline_msg, FALSE), NANO_GOTOLINE_ALTKEY,
561 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW,
562 do_gotolinecolumn_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000563
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000564 sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000565 IFHELP(nano_replace_msg, FALSE), NANO_ALT_REPLACE_KEY,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000566 NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000567
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000568#ifndef NANO_TINY
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000569 sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000570 IFHELP(nano_mark_msg, FALSE), NANO_MARK_ALTKEY, NANO_MARK_FKEY,
David Lawrence Ramseya049c832005-06-12 23:53:28 +0000571 NANO_NO_KEY, VIEW, do_mark);
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000572
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +0000573 sc_init_one(&main_list, NANO_NO_KEY, whereis_next_msg,
574 IFHELP(nano_whereis_next_msg, TRUE), NANO_WHEREIS_NEXT_KEY,
575 NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
David Lawrence Ramseycf1879b2006-04-27 23:39:49 +0000576
577 sc_init_one(&main_list, NANO_NO_KEY, N_("Copy Text"),
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000578 IFHELP(nano_copy_msg, FALSE), NANO_COPY_KEY, NANO_NO_KEY,
David Lawrence Ramseycf1879b2006-04-27 23:39:49 +0000579 NANO_COPY_ALTKEY, NOVIEW, do_copy_text);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000580
581 sc_init_one(&main_list, NANO_NO_KEY, N_("Indent Text"),
582 IFHELP(nano_indentmarked_msg, FALSE), NANO_INDENTMARKED_KEY,
David Lawrence Ramseyf5d6d992006-05-12 12:37:53 +0000583 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_indent_marked_void);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000584
585 sc_init_one(&main_list, NANO_NO_KEY, N_("Unindent Text"),
586 IFHELP(nano_unindentmarked_msg, TRUE), NANO_UNINDENTMARKED_KEY,
David Lawrence Ramseyf5d6d992006-05-12 12:37:53 +0000587 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_unindent_marked_void);
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000588#endif
589
590 sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
591 IFHELP(nano_forward_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
592 NANO_NO_KEY, VIEW, do_right);
593
594 sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
595 IFHELP(nano_back_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
596 NANO_NO_KEY, VIEW, do_left);
597
598#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000599 sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000600 IFHELP(nano_nextword_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000601 NANO_NO_KEY, VIEW, do_next_word_void);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000602
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000603 sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000604 IFHELP(nano_prevword_msg, FALSE), NANO_PREVWORD_KEY,
605 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_prev_word_void);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000606#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000607
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000608 sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
609 IFHELP(nano_prevline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
610 NANO_NO_KEY, VIEW, do_up);
611
612 sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"),
613 IFHELP(nano_nextline_msg, TRUE), NANO_NO_KEY, NANO_NO_KEY,
614 NANO_NO_KEY, VIEW, do_down);
615
616 sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
617 IFHELP(nano_home_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
618 NANO_NO_KEY, VIEW, do_home);
619
620 sc_init_one(&main_list, NANO_END_KEY, N_("End"),
David Lawrence Ramseybdf84dd2006-04-22 19:52:27 +0000621 IFHELP(nano_end_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000622 NANO_NO_KEY, VIEW, do_end);
623
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000624#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000625 sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000626 IFHELP(nano_parabegin_msg, FALSE), NANO_PARABEGIN_ALTKEY,
627 NANO_NO_KEY, NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000628
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000629 sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000630 IFHELP(nano_paraend_msg, FALSE), NANO_PARAEND_ALTKEY,
631 NANO_NO_KEY, NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000632#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000633
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000634 sc_init_one(&main_list, NANO_NO_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000635 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
636 NANO_NO_KEY, NANO_FIRSTLINE_ALTKEY2, VIEW, do_first_line);
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000637
638 sc_init_one(&main_list, NANO_NO_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000639 IFHELP(nano_lastline_msg, TRUE), NANO_LASTLINE_ALTKEY,
640 NANO_NO_KEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
641
642#ifndef NANO_TINY
David Lawrence Ramseyf5d6d992006-05-12 12:37:53 +0000643 sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
644 IFHELP(nano_bracket_msg, FALSE), NANO_BRACKET_KEY, NANO_NO_KEY,
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000645 NANO_NO_KEY, VIEW, do_find_bracket);
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000646
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000647 sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Up"),
648 IFHELP(nano_scrollup_msg, FALSE), NANO_SCROLLUP_KEY,
649 NANO_NO_KEY, NANO_SCROLLUP_ALTKEY, VIEW, do_scroll_up);
650
651 sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Down"),
652 IFHELP(nano_scrolldown_msg, TRUE), NANO_SCROLLDOWN_KEY,
653 NANO_NO_KEY, NANO_SCROLLDOWN_ALTKEY, VIEW, do_scroll_down);
654#endif
David Lawrence Ramseydf453652006-04-21 02:05:09 +0000655
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000656#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000657 sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000658 IFHELP(nano_prevfile_msg, FALSE), NANO_PREVFILE_KEY,
659 NANO_NO_KEY, NANO_PREVFILE_ALTKEY, VIEW,
660 switch_to_prev_buffer_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000661
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000662 sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000663 IFHELP(nano_nextfile_msg, TRUE), NANO_NEXTFILE_KEY, NANO_NO_KEY,
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000664 NANO_NEXTFILE_ALTKEY, VIEW, switch_to_next_buffer_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000665#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000666
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000667 sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000668 IFHELP(nano_verbatim_msg, FALSE), NANO_VERBATIM_KEY,
669 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_verbatim_input);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000670
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000671 sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"),
672 IFHELP(nano_tab_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
673 NANO_NO_KEY, NOVIEW, do_tab);
674
675 sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"),
676 IFHELP(nano_enter_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
677 NANO_NO_KEY, NOVIEW, do_enter);
678
679 sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
680 IFHELP(nano_delete_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
681 NANO_NO_KEY, NOVIEW, do_delete);
682
David Lawrence Ramseybf487982006-04-24 20:50:52 +0000683 sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace")
684#ifndef NANO_TINY
685 , IFHELP(nano_backspace_msg, FALSE)
686#else
687 , IFHELP(nano_backspace_msg, TRUE)
688#endif
689 , NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000690 NANO_NO_KEY, NOVIEW, do_backspace);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000691
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +0000692#ifndef NANO_TINY
693 sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
694 IFHELP(nano_cut_till_end_msg, TRUE), NANO_CUTTILLEND_ALTKEY,
695 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
696#endif
697
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000698#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000699 sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000700 IFHELP(nano_fulljustify_msg, FALSE), NANO_FULLJUSTIFY_ALTKEY,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000701 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000702#endif
703
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000704#ifndef NANO_TINY
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000705 sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"),
706 IFHELP(nano_wordcount_msg, FALSE), NANO_WORDCOUNT_KEY,
707 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_wordlinechar_count);
708#endif
David Lawrence Ramseyefb4b0a2006-04-19 14:09:01 +0000709
David Lawrence Ramsey97415df2006-04-22 20:03:05 +0000710 sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg
David Lawrence Ramsey03252d42006-04-22 20:00:23 +0000711#ifndef NANO_TINY
David Lawrence Ramsey5a2dbe22006-04-23 14:53:26 +0000712 , IFHELP(nano_refresh_msg, TRUE)
David Lawrence Ramsey03252d42006-04-22 20:00:23 +0000713#else
David Lawrence Ramsey5a2dbe22006-04-23 14:53:26 +0000714 , IFHELP(nano_refresh_msg, FALSE)
David Lawrence Ramsey03252d42006-04-22 20:00:23 +0000715#endif
716 , NANO_NO_KEY, NANO_NO_KEY, NANO_NO_KEY, VIEW, total_refresh);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000717
Chris Allegrettadab017e2002-04-23 10:56:06 +0000718 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000719
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000720 sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000721 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
722 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000723#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000724 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000725#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000726 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000727#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000728 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000729
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000730 sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000731 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
732 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000733
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000734 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000735 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000736 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
737 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000738
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000739 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000740 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000741 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000742
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000743 sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000744 IFHELP(nano_replace_msg, FALSE), NANO_NO_KEY, NANO_REPLACE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000745 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000746
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000747 sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000748 IFHELP(nano_gotoline_msg, FALSE), NANO_NO_KEY,
749 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000750
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000751#ifndef DISABLE_JUSTIFY
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000752 sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000753 IFHELP(nano_parabegin_msg, FALSE), NANO_PARABEGIN_ALTKEY,
754 NANO_NO_KEY, NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000755
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000756 sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000757 IFHELP(nano_paraend_msg, FALSE), NANO_PARAEND_ALTKEY,
758 NANO_NO_KEY, NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000759#endif
760
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000761#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000762 sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000763 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000764 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000765
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000766 sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000767 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
768 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000769#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000770
Chris Allegretta658399a2001-06-14 02:54:22 +0000771#ifdef HAVE_REGEX_H
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000772 sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000773 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000774 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000775#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000776
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000777#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000778 sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000779 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
780 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000781
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000782 sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000783 IFHELP(nano_cut_till_end_msg, FALSE), NANO_CUTTILLEND_ALTKEY,
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000784 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000785#endif
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000786
787#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000788 sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000789 IFHELP(nano_fulljustify_msg, FALSE), NANO_FULLJUSTIFY_ALTKEY,
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000790 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
791#endif
Chris Allegretta5f36c372001-07-16 00:48:53 +0000792
Chris Allegrettadab017e2002-04-23 10:56:06 +0000793 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000794
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000795 sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000796 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
797 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000798#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000799 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000800#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000801 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000802#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000803 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000804
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000805 sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000806 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
807 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000808
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000809 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000810 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000811 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
812 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000813
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000814 sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000815 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000816 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000817
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000818 /* TRANSLATORS: Try to keep this at most 12 characters. */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000819 sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
David Lawrence Ramseybdf84dd2006-04-22 19:52:27 +0000820 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY, NANO_REPLACE_FKEY,
821 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000822
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000823 sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000824 IFHELP(nano_gotoline_msg, FALSE), NANO_NO_KEY,
825 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000826
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000827#ifndef NANO_TINY
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000828 sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000829 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000830 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000831
David Lawrence Ramseyf3ecffd2005-06-16 18:48:30 +0000832 sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000833 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
834 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000835#endif
Chris Allegretta105da332000-10-31 05:10:10 +0000836
Chris Allegretta658399a2001-06-14 02:54:22 +0000837#ifdef HAVE_REGEX_H
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000838 sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000839 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000840 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000841#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000842
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000843#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000844 sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000845 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
846 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseyc10d8ff2005-06-03 20:51:39 +0000847#endif
Chris Allegretta5f36c372001-07-16 00:48:53 +0000848
Chris Allegrettadab017e2002-04-23 10:56:06 +0000849 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000850
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000851 sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000852 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
853 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000854#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000855 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000856#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000857 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000858#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000859 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000860
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000861 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000862 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
863 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta105da332000-10-31 05:10:10 +0000864
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000865 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000866 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000867 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
868 do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000869
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000870 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000871 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000872 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000873
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000874#ifndef NANO_TINY
David Lawrence Ramsey5e73eec2005-05-03 20:57:13 +0000875 sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000876 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
877 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5beed502003-01-05 20:41:21 +0000878#endif
879
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000880 free_shortcutage(&gotoline_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000881
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000882 sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000883 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
884 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000885#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000886 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000887#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000888 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000889#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000890 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000891
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000892 sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000893 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
894 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000895
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000896 sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000897 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000898 NANO_FIRSTLINE_FKEY, NANO_FIRSTLINE_ALTKEY2, VIEW,
899 do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000900
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000901 sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000902 IFHELP(nano_lastline_msg, FALSE), NANO_LASTLINE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +0000903 NANO_LASTLINE_FKEY, NANO_LASTLINE_ALTKEY2, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000904
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000905 sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000906 N_("Go To Text"), IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000907 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000908
Chris Allegrettadab017e2002-04-23 10:56:06 +0000909 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000910
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000911 sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000912 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
913 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000914#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000915 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000916#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000917 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000918#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000919 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000920
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000921 sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000922 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
923 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000924
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000925#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000926 /* If we're using restricted mode, the file browser is disabled.
927 * It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000928
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000929 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000930 sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000931 IFHELP(nano_tofiles_msg, FALSE), NANO_NO_KEY,
932 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000933#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000934
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000935#ifndef NANO_TINY
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000936 /* If we're using restricted mode, the DOS format, Mac format,
937 * append, prepend, and backup toggles are disabled. The first and
938 * second are useless since inserting files is disabled, the third
939 * and fourth are disabled because they allow writing to files not
940 * specified on the command line, and the fifth is useless since
941 * backups are disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000942
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000943 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000944 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000945 sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000946 IFHELP(nano_dos_msg, FALSE), TOGGLE_DOS_KEY,
947 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000948
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000949 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000950 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000951 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000952 IFHELP(nano_mac_msg, FALSE), TOGGLE_MAC_KEY,
953 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000954#endif
955
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000956 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000957 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000958 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000959 IFHELP(nano_append_msg, FALSE), NANO_APPEND_KEY,
960 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000961
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000962 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000963 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000964 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000965 IFHELP(nano_prepend_msg, FALSE), NANO_PREPEND_KEY,
966 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000967
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000968#ifndef NANO_TINY
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000969 if (!ISSET(RESTRICTED))
David Lawrence Ramseycde90392006-04-09 18:27:42 +0000970 /* TRANSLATORS: Try to keep this at most 16 characters. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000971 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000972 IFHELP(nano_backup_msg, FALSE), TOGGLE_BACKUP_KEY,
973 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000974#endif
975
Chris Allegrettadab017e2002-04-23 10:56:06 +0000976 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000977
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000978 sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000979 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
980 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000981#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000982 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000983#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000984 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000985#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +0000986 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000987
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000988 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000989 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
990 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000991
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000992#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000993 /* If we're using restricted mode, the file browser is disabled.
994 * It's useless since inserting files is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000995 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000996 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +0000997 IFHELP(nano_tofiles_msg, FALSE), NANO_NO_KEY,
998 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000999#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +00001000
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001001#ifndef NANO_TINY
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +00001002 /* If we're using restricted mode, command execution is disabled.
1003 * It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001004
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001005 if (!ISSET(RESTRICTED))
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +00001006 sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
David Lawrence Ramseycde90392006-04-09 18:27:42 +00001007 /* TRANSLATORS: Try to keep this at most 22 characters. */
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001008 N_("Execute Command"), IFHELP(nano_execute_msg, FALSE),
1009 NANO_NO_KEY, NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramseya593f532003-11-28 19:47:42 +00001010
Chris Allegrettaf7c68112002-09-03 22:58:40 +00001011#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +00001012 /* If we're using restricted mode, the multibuffer toggle is
1013 * disabled. It's useless since inserting files is disabled. */
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001014
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001015 if (!ISSET(RESTRICTED))
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +00001016 sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001017 IFHELP(nano_multibuffer_msg, FALSE),
1018 TOGGLE_MULTIBUFFER_KEY, NANO_NO_KEY, NANO_NO_KEY,
1019 NOVIEW, NULL);
Chris Allegrettaf7c68112002-09-03 22:58:40 +00001020#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +00001021#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +00001022
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001023#ifndef NANO_TINY
Chris Allegrettadab017e2002-04-23 10:56:06 +00001024 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +00001025
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001026 sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001027 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1028 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001029#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001030 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001031#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001032 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001033#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001034 );
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001035
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001036 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001037 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1038 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +00001039
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001040 sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001041 IFHELP(nano_insert_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001042 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001043
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +00001044#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +00001045 sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001046 IFHELP(nano_multibuffer_msg, FALSE), TOGGLE_MULTIBUFFER_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001047 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001048#endif
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +00001049#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00001050
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001051#ifndef DISABLE_HELP
1052 free_shortcutage(&help_list);
1053
1054 sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001055 IFHELP(nano_refresh_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1056 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001057
1058 sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001059 IFHELP(nano_exit_msg, FALSE), NANO_NO_KEY, NANO_EXIT_FKEY,
1060 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001061
1062 sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001063 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
1064 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001065
1066 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001067 IFHELP(nano_nextpage_msg, FALSE), NANO_NO_KEY,
1068 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001069
1070 sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001071 IFHELP(nano_prevline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001072 NANO_NO_KEY, VIEW, NULL);
1073
1074 sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001075 IFHELP(nano_nextline_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001076 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6e7d24d2006-05-06 02:26:18 +00001077
1078 sc_init_one(&help_list, NANO_NO_KEY, first_line_msg,
1079 IFHELP(nano_firstline_msg, FALSE), NANO_FIRSTLINE_ALTKEY,
1080 NANO_NO_KEY, NANO_FIRSTLINE_ALTKEY2, VIEW, NULL);
1081
1082 sc_init_one(&help_list, NANO_NO_KEY, last_line_msg,
1083 IFHELP(nano_lastline_msg, TRUE), NANO_LASTLINE_ALTKEY,
1084 NANO_NO_KEY, NANO_LASTLINE_ALTKEY2, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001085#endif
1086
1087#ifndef DISABLE_SPELLER
1088 free_shortcutage(&spell_list);
1089
1090 sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001091 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1092 NANO_NO_KEY, VIEW,
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001093#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001094 do_help_void
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001095#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001096 nano_disabled_msg
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001097#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001098 );
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001099
1100 sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001101 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1102 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001103#endif
1104
Rocco Corsiaf5c3022001-01-12 07:51:05 +00001105#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +00001106 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001107
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001108 sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001109 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1110 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +00001111
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +00001112 sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001113 IFHELP(nano_exitbrowser_msg, FALSE), NANO_NO_KEY,
1114 NANO_EXIT_FKEY, NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +00001115
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001116 sc_init_one(&browser_list, NANO_WHEREIS_KEY, whereis_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001117 IFHELP(nano_whereis_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1118 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001119
1120 sc_init_one(&browser_list, NANO_NO_KEY, whereis_next_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001121 IFHELP(nano_whereis_next_msg, FALSE), NANO_WHEREIS_NEXT_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001122 NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, NULL);
1123
David Lawrence Ramsey0ec909c2006-05-06 15:07:26 +00001124 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
1125 IFHELP(nano_prevpage_msg, FALSE), NANO_NO_KEY,
1126 NANO_PREVPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
1127
1128 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
1129 IFHELP(nano_nextpage_msg, FALSE), NANO_NO_KEY,
1130 NANO_NEXTPAGE_FKEY, NANO_NO_KEY, VIEW, NULL);
1131
1132 sc_init_one(&browser_list, NANO_NO_KEY, first_file_msg,
1133 IFHELP(nano_firstfile_msg, FALSE), NANO_FIRSTFILE_ALTKEY,
1134 NANO_NO_KEY, NANO_FIRSTFILE_ALTKEY2, VIEW, NULL);
1135
1136 sc_init_one(&browser_list, NANO_NO_KEY, last_file_msg,
1137 IFHELP(nano_lastfile_msg, FALSE), NANO_LASTFILE_ALTKEY,
1138 NANO_NO_KEY, NANO_LASTFILE_ALTKEY2, VIEW, NULL);
1139
David Lawrence Ramsey602199d2006-05-06 15:31:32 +00001140 /* TRANSLATORS: Try to keep this at most 12 characters. */
David Lawrence Ramsey0ec909c2006-05-06 15:07:26 +00001141 sc_init_one(&browser_list, NANO_GOTODIR_KEY, N_("Go To Dir"),
1142 IFHELP(nano_gotodir_msg, FALSE), NANO_GOTODIR_ALTKEY,
1143 NANO_GOTODIR_FKEY, NANO_NO_KEY, VIEW, NULL);
Rocco Corsi12f294c2001-04-14 06:50:24 +00001144
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001145 free_shortcutage(&whereis_file_list);
1146
1147 sc_init_one(&whereis_file_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001148 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1149 NANO_NO_KEY, VIEW,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001150#ifndef DISABLE_HELP
1151 do_browser_help
1152#else
1153 nano_disabled_msg
1154#endif
1155 );
1156
1157 sc_init_one(&whereis_file_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001158 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1159 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001160
1161 sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001162 IFHELP(nano_firstfile_msg, FALSE), NANO_FIRSTFILE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +00001163 NANO_FIRSTFILE_FKEY, NANO_FIRSTFILE_ALTKEY2, VIEW,
1164 do_first_file);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001165
1166 sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001167 IFHELP(nano_lastfile_msg, FALSE), NANO_LASTFILE_ALTKEY,
David Lawrence Ramsey5f0a58b2006-04-21 02:24:34 +00001168 NANO_LASTFILE_FKEY, NANO_LASTFILE_ALTKEY2, VIEW, do_last_file);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001169
1170#ifndef NANO_SMALL
1171 sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001172 IFHELP(nano_case_msg, FALSE), TOGGLE_CASE_KEY, NANO_NO_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001173 NANO_NO_KEY, VIEW, NULL);
1174
1175 sc_init_one(&whereis_file_list, NANO_NO_KEY, backwards_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001176 IFHELP(nano_reverse_msg, FALSE), TOGGLE_BACKWARDS_KEY,
1177 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001178#endif
1179
1180#ifdef HAVE_REGEX_H
1181 sc_init_one(&whereis_file_list, NANO_NO_KEY, regexp_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001182 IFHELP(nano_regexp_msg, FALSE), NANO_REGEXP_KEY, NANO_NO_KEY,
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001183 NANO_NO_KEY, VIEW, NULL);
1184#endif
1185
1186#ifndef NANO_SMALL
1187 sc_init_one(&whereis_file_list, NANO_PREVLINE_KEY, history_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001188 IFHELP(nano_history_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1189 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001190#endif
1191
Chris Allegrettadab017e2002-04-23 10:56:06 +00001192 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001193
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001194 sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001195 IFHELP(nano_help_msg, FALSE), NANO_NO_KEY, NANO_HELP_FKEY,
1196 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001197#ifndef DISABLE_HELP
David Lawrence Ramseye38b8082006-03-30 07:03:04 +00001198 do_help_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001199#else
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001200 nano_disabled_msg
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001201#endif
David Lawrence Ramsey017dde22006-03-24 05:28:03 +00001202 );
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001203
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001204 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001205 IFHELP(nano_cancel_msg, FALSE), NANO_NO_KEY, NANO_NO_KEY,
1206 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001207#endif
1208
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001209 currshortcut = main_list;
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001210
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001211#ifndef NANO_TINY
Chris Allegrettadab017e2002-04-23 10:56:06 +00001212 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001213#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +00001214}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001215
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001216/* Free the given shortcut. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001217void free_shortcutage(shortcut **shortcutage)
1218{
1219 assert(shortcutage != NULL);
David Lawrence Ramsey193b0e52005-06-06 18:41:17 +00001220
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001221 while (*shortcutage != NULL) {
1222 shortcut *ps = *shortcutage;
1223 *shortcutage = (*shortcutage)->next;
1224 free(ps);
1225 }
1226}
1227
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001228#ifndef NANO_TINY
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001229/* Add a new toggle to the end of the global toggle list. */
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001230void toggle_init_one(int val, const char *desc, bool blank_after, long
1231 flag)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001232{
1233 toggle *u;
1234
1235 if (toggles == NULL) {
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001236 toggles = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001237 u = toggles;
1238 } else {
1239 for (u = toggles; u->next != NULL; u = u->next)
1240 ;
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001241 u->next = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001242 u = u->next;
1243 }
1244
1245 u->val = val;
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001246 u->desc = (desc == NULL) ? "" : _(desc);
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001247 u->blank_after = blank_after;
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001248 u->flag = flag;
1249 u->next = NULL;
1250}
1251
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001252/* Initialize the global toggle list. */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001253void toggle_init(void)
1254{
1255 /* There is no need to reinitialize the toggles. They can't
1256 * change. */
1257 if (toggles != NULL)
1258 return;
1259
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001260 toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), FALSE, NO_HELP);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001261
David Lawrence Ramsey8ff785c2006-04-19 23:13:44 +00001262 toggle_init_one(TOGGLE_CONST_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001263 N_("Constant cursor position display"), FALSE, CONST_UPDATE);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001264
1265 toggle_init_one(TOGGLE_MORESPACE_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001266 N_("Use of more space for editing"), FALSE, MORE_SPACE);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001267
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +00001268 toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"),
1269#ifdef ENABLE_NANORC
1270 FALSE
1271#else
1272 TRUE
1273#endif
1274 , SMOOTH_SCROLL);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001275
1276#ifdef ENABLE_NANORC
1277 toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +00001278#ifdef ENABLE_COLOR
1279 FALSE
1280#else
1281 TRUE
1282#endif
1283 , WHITESPACE_DISPLAY);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001284#endif
1285
1286#ifdef ENABLE_COLOR
1287 toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001288 TRUE, NO_COLOR_SYNTAX);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001289#endif
1290
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001291 toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001292 SMART_HOME);
1293
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001294 toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001295 AUTOINDENT);
1296
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001297 toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), FALSE,
1298 CUT_TO_END);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001299
1300#ifndef DISABLE_WRAPPING
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001301 toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001302 NO_WRAP);
1303#endif
1304
1305 toggle_init_one(TOGGLE_TABSTOSPACES_KEY,
David Lawrence Ramsey2ca23562006-04-23 19:15:15 +00001306 N_("Conversion of typed tabs to spaces"),
1307#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_MOUSE)
1308 !ISSET(RESTRICTED) ? TRUE : FALSE
1309#else
1310 FALSE
1311#endif
1312 , TABS_TO_SPACES);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001313
1314 /* If we're using restricted mode, the backup toggle is disabled.
1315 * It's useless since backups are disabled. */
1316 if (!ISSET(RESTRICTED))
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001317 toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), FALSE,
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001318 BACKUP_FILE);
1319
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001320#ifdef ENABLE_MULTIBUFFER
1321 /* If we're using restricted mode, the multibuffer toggle is
1322 * disabled. It's useless since inserting files is disabled. */
1323 if (!ISSET(RESTRICTED))
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +00001324 toggle_init_one(TOGGLE_MULTIBUFFER_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001325 N_("Multiple file buffers"), FALSE, MULTIBUFFER);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001326#endif
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001327
David Lawrence Ramsey6397b592006-04-20 22:36:10 +00001328#ifndef DISABLE_MOUSE
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001329 toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), FALSE,
1330 USE_MOUSE);
David Lawrence Ramsey6397b592006-04-20 22:36:10 +00001331#endif
1332
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001333 /* If we're using restricted mode, the DOS/Mac conversion toggle is
1334 * disabled. It's useless since inserting files is disabled. */
1335 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001336 toggle_init_one(TOGGLE_NOCONVERT_KEY,
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001337 N_("No conversion from DOS/Mac format"), FALSE,
1338 NO_CONVERT);
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001339
David Lawrence Ramseye313f5b2006-04-20 22:29:02 +00001340 /* If we're using restricted mode, the suspend toggle is disabled.
1341 * It's useless since suspending is disabled. */
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001342 if (!ISSET(RESTRICTED))
David Lawrence Ramsey1df3e2d2006-04-22 19:45:26 +00001343 toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), FALSE,
1344 SUSPEND);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001345}
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001346#endif /* !NANO_TINY */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001347
David Lawrence Ramseye6757b92006-04-19 13:36:56 +00001348#ifdef DEBUG
1349/* This function is used to gracefully return all the memory we've used.
1350 * It should be called just before calling exit(). Practically, the
Chris Allegretta6232d662002-05-12 19:52:15 +00001351 * only effect is to cause a segmentation fault if the various data
1352 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +00001353 * function unless debugging is turned on. */
Chris Allegretta6df90f52002-07-19 01:08:59 +00001354void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001355{
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001356 delwin(topwin);
1357 delwin(edit);
1358 delwin(bottomwin);
1359
Chris Allegretta7662c862003-01-13 01:35:15 +00001360#ifndef DISABLE_JUSTIFY
1361 if (quotestr != NULL)
1362 free(quotestr);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +00001363#ifdef HAVE_REGEX_H
1364 regfree(&quotereg);
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001365 if (quoteerr != NULL)
1366 free(quoteerr);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +00001367#endif
Chris Allegretta7662c862003-01-13 01:35:15 +00001368#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001369#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +00001370 if (backup_dir != NULL)
1371 free(backup_dir);
1372#endif
Chris Allegretta2598c662002-03-28 01:59:34 +00001373#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001374 if (operating_dir != NULL)
1375 free(operating_dir);
1376 if (full_operating_dir != NULL)
1377 free(full_operating_dir);
1378#endif
1379 if (last_search != NULL)
1380 free(last_search);
1381 if (last_replace != NULL)
1382 free(last_replace);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001383#ifndef DISABLE_SPELLER
1384 if (alt_speller != NULL)
1385 free(alt_speller);
1386#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001387 if (answer != NULL)
1388 free(answer);
1389 if (cutbuffer != NULL)
Chris Allegretta7662c862003-01-13 01:35:15 +00001390 free_filestruct(cutbuffer);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +00001391#ifndef DISABLE_JUSTIFY
1392 if (jusbuffer != NULL)
1393 free_filestruct(jusbuffer);
1394#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001395 free_shortcutage(&main_list);
1396 free_shortcutage(&whereis_list);
1397 free_shortcutage(&replace_list);
1398 free_shortcutage(&replace_list_2);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001399 free_shortcutage(&gotoline_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001400 free_shortcutage(&writefile_list);
1401 free_shortcutage(&insertfile_list);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +00001402#ifndef NANO_TINY
1403 free_shortcutage(&extcmd_list);
1404#endif
Chris Allegretta7662c862003-01-13 01:35:15 +00001405#ifndef DISABLE_HELP
Chris Allegretta6df90f52002-07-19 01:08:59 +00001406 free_shortcutage(&help_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001407#endif
1408#ifndef DISABLE_SPELLER
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001409 free_shortcutage(&spell_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001410#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001411#ifndef DISABLE_BROWSER
1412 free_shortcutage(&browser_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001413 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001414#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001415#ifndef NANO_TINY
David Lawrence Ramsey40e4acf2005-05-26 06:09:07 +00001416 /* Free the memory associated with each toggle. */
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001417 while (toggles != NULL) {
1418 toggle *t = toggles;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001419
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001420 toggles = toggles->next;
1421 free(t);
1422 }
1423#endif
David Lawrence Ramsey5d8d0b12005-05-26 05:53:29 +00001424 /* Free the memory associated with each open file buffer. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +00001425 if (openfile != NULL)
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +00001426 free_openfilestruct(openfile);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001427#ifdef ENABLE_COLOR
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001428 if (syntaxstr != NULL)
1429 free(syntaxstr);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001430 while (syntaxes != NULL) {
1431 syntaxtype *bill = syntaxes;
1432
1433 free(syntaxes->desc);
1434 while (syntaxes->extensions != NULL) {
1435 exttype *bob = syntaxes->extensions;
1436
1437 syntaxes->extensions = bob->next;
David Lawrence Ramsey2385c1a2005-07-29 21:42:08 +00001438 free(bob->ext_regex);
David Lawrence Ramsey7fc0ada2005-08-29 18:52:06 +00001439 if (bob->ext != NULL) {
1440 regfree(bob->ext);
1441 free(bob->ext);
1442 }
Chris Allegretta6df90f52002-07-19 01:08:59 +00001443 free(bob);
1444 }
1445 while (syntaxes->color != NULL) {
1446 colortype *bob = syntaxes->color;
1447
1448 syntaxes->color = bob->next;
David Lawrence Ramsey2385c1a2005-07-29 21:42:08 +00001449 free(bob->start_regex);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001450 if (bob->start != NULL) {
1451 regfree(bob->start);
1452 free(bob->start);
1453 }
David Lawrence Ramseyd2361f02005-07-14 18:33:51 +00001454 if (bob->end_regex != NULL)
1455 free(bob->end_regex);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001456 if (bob->end != NULL) {
Chris Allegrettace452fb2003-02-03 02:56:44 +00001457 regfree(bob->end);
David Lawrence Ramseydb958022005-07-13 20:18:46 +00001458 free(bob->end);
1459 }
Chris Allegretta6df90f52002-07-19 01:08:59 +00001460 free(bob);
1461 }
1462 syntaxes = syntaxes->next;
1463 free(bill);
1464 }
1465#endif /* ENABLE_COLOR */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +00001466#ifndef NANO_TINY
David Lawrence Ramsey40e4acf2005-05-26 06:09:07 +00001467 /* Free the search and replace history lists. */
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001468 if (searchage != NULL)
1469 free_filestruct(searchage);
1470 if (replaceage != NULL)
1471 free_filestruct(replaceage);
Chris Allegretta5beed502003-01-05 20:41:21 +00001472#endif
David Lawrence Ramseya27bd652004-08-17 05:23:38 +00001473#ifdef ENABLE_NANORC
David Lawrence Ramsey31b159c2005-05-26 05:17:13 +00001474 if (homedir != NULL)
1475 free(homedir);
David Lawrence Ramseya27bd652004-08-17 05:23:38 +00001476#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001477}
Chris Allegretta6232d662002-05-12 19:52:15 +00001478#endif /* DEBUG */