blob: 9b0334b55fe5aa715f806584a19df5dc29537fcb [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 Ramseyf28f50e2004-01-09 23:04:55 +00005 * Copyright (C) 1999-2004 Chris Allegretta *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00006 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
Chris Allegretta3a24f3f2001-10-24 11:33:54 +00008 * the Free Software Foundation; either version 2, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00009 * any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
19 * *
20 **************************************************************************/
21
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000022#include "config.h"
Chris Allegretta6efda542001-04-28 18:03:52 +000023
Chris Allegretta1dd0bc92002-10-13 18:43:45 +000024#include <stdlib.h>
Chris Allegrettadab017e2002-04-23 10:56:06 +000025#include <assert.h>
Chris Allegretta6efda542001-04-28 18:03:52 +000026#include <sys/stat.h>
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000027#include "proto.h"
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000028#include "nano.h"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000029
Chris Allegretta7662c862003-01-13 01:35:15 +000030/* Global variables */
Chris Allegretta48b06702002-02-22 04:30:50 +000031
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000032#ifndef DISABLE_WRAPJUSTIFY
Chris Allegretta6df90f52002-07-19 01:08:59 +000033/* wrap_at might be set in rcfile.c or nano.c */
34int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000035#endif
36
Chris Allegretta6df90f52002-07-19 01:08:59 +000037char *last_search = NULL; /* Last string we searched for */
38char *last_replace = NULL; /* Last replacement string */
39int search_last_line; /* Is this the last search line? */
Chris Allegretta7662c862003-01-13 01:35:15 +000040int search_offscreen; /* Search lines not displayed */
Chris Allegretta6df90f52002-07-19 01:08:59 +000041
Chris Allegretta88520c92001-05-05 17:45:54 +000042int flags = 0; /* Our new flag containing many options */
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000043WINDOW *edit; /* The file portion of the editor */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000044WINDOW *topwin; /* Top line of screen */
45WINDOW *bottomwin; /* Bottom buffer */
Chris Allegretta1a6e9042000-12-14 13:56:28 +000046char *filename = NULL; /* Name of the file */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000047
48#ifndef NANO_SMALL
49struct stat originalfilestat; /* Stat for the file as we loaded it */
50#endif
51
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000052int editwinrows = 0; /* How many rows long is the edit
53 window? */
54filestruct *current; /* Current buffer pointer */
55int current_x = 0, current_y = 0; /* Current position of X and Y in
56 the editor - relative to edit
57 window (0,0) */
58filestruct *fileage = NULL; /* Our file buffer */
59filestruct *edittop = NULL; /* Pointer to the top of the edit
60 buffer with respect to the
61 file struct */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000062filestruct *filebot = NULL; /* Last node in the file struct */
63filestruct *cutbuffer = NULL; /* A place to store cut text */
64
Chris Allegretta355fbe52001-07-14 19:32:47 +000065#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +000066openfilestruct *open_files = NULL; /* The list of open files */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000067#endif
68
Chris Allegrettae4f940d2002-03-03 22:36:36 +000069#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000070char *punct = NULL; /* Closing punctuation that can end
71 sentences. */
72char *brackets = NULL; /* Closing brackets that can follow
73 closing punctuation and can end
74 sentences. */
Chris Allegretta7662c862003-01-13 01:35:15 +000075char *quotestr = NULL; /* Quote string. The default value is
76 set in main(). */
Chris Allegretta6df90f52002-07-19 01:08:59 +000077#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000078
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000079#ifndef NANO_SMALL
80char *backup_dir = NULL; /* Backup directory. */
David Lawrence Ramsey483ea322004-05-29 16:25:30 +000081#ifdef ENABLE_NANORC
82char *whitespace = NULL; /* Characters used when displaying
83 the first characters of tabs and
84 spaces. */
85#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000086#endif
87
Chris Allegretta65f075d2003-02-13 03:03:49 +000088int resetstatuspos; /* Hack for resetting the status bar
89 cursor position */
Chris Allegretta6df90f52002-07-19 01:08:59 +000090char *answer = NULL; /* Answer str to many questions */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000091int totlines = 0; /* Total number of lines in the file */
Chris Allegrettab3655b42001-10-22 03:15:31 +000092long totsize = 0; /* Total number of bytes in the file */
Chris Allegretta88520c92001-05-05 17:45:54 +000093int placewewant = 0; /* The column we'd like the cursor
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000094 to jump to when we go to the
95 next or previous line */
96
Chris Allegretta7662c862003-01-13 01:35:15 +000097int tabsize = -1; /* Our internal tabsize variable. The
98 default value 8 is set in main(). */
Chris Allegretta6d690a32000-08-03 22:51:21 +000099
Chris Allegretta7662c862003-01-13 01:35:15 +0000100char *hblank = NULL; /* A horizontal blank line */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000101#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000102char *help_text; /* The text in the help window */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000103#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000104
105/* More stuff for the marker select */
106
Chris Allegretta7662c862003-01-13 01:35:15 +0000107#ifndef NANO_SMALL
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +0000108filestruct *mark_beginbuf; /* The begin marker buffer */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000109int mark_beginx; /* X value in the string to start */
Chris Allegretta7662c862003-01-13 01:35:15 +0000110#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000111
Chris Allegrettae1f14522001-09-19 03:19:43 +0000112#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000113char *operating_dir = NULL; /* Operating directory, which we can't */
114char *full_operating_dir = NULL;/* go higher than */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000115#endif
116
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000117#ifndef DISABLE_SPELLER
Chris Allegretta7c27be42002-05-05 23:03:54 +0000118char *alt_speller = NULL; /* Alternative spell command */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000119#endif
120
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000121shortcut *main_list = NULL;
122shortcut *whereis_list = NULL;
123shortcut *replace_list = NULL;
Chris Allegretta48b06702002-02-22 04:30:50 +0000124shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000125shortcut *goto_list = NULL;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000126shortcut *writefile_list = NULL;
127shortcut *insertfile_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000128#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000129shortcut *help_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000130#endif
131#ifndef DISABLE_SPELLER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000132shortcut *spell_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000133#endif
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000134#ifndef NANO_SMALL
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000135shortcut *extcmd_list = NULL;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000136#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000137#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000138shortcut *browser_list = NULL;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000139shortcut *gotodir_list = NULL;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000140#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000141
Chris Allegretta8ce24132001-04-30 11:28:46 +0000142#ifdef ENABLE_COLOR
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000143const colortype *colorstrings = NULL;
144syntaxtype *syntaxes = NULL;
145char *syntaxstr = NULL;
Chris Allegretta8ce24132001-04-30 11:28:46 +0000146#endif
147
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000148#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
Chris Allegretta6df90f52002-07-19 01:08:59 +0000149const shortcut *currshortcut; /* Current shortcut list we're using */
Chris Allegretta6fe61492001-05-21 12:56:25 +0000150#endif
Chris Allegretta6b58acd2001-04-12 03:01:53 +0000151
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000152#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000153toggle *toggles = NULL;
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000154#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000155
Chris Allegretta5beed502003-01-05 20:41:21 +0000156#ifndef NANO_SMALL
157historyheadtype search_history;
158historyheadtype replace_history;
159#endif
160
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000161/* Regular expressions */
162
Chris Allegretta805c26d2000-09-06 13:39:17 +0000163#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000164regex_t search_regexp; /* Global to store compiled search regexp */
165regmatch_t regmatches[10]; /* Match positions for parenthetical
166 subexpressions, max of 10 */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000167#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000168
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000169int curses_ended = FALSE; /* Indicates to statusbar() to simply
170 * write to stderr, since endwin() has
171 * ended curses mode. */
172
173
David Lawrence Ramsey221ebcd2004-03-05 20:47:15 +0000174int length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000175{
176 int i = 0;
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000177
Chris Allegrettadab017e2002-04-23 10:56:06 +0000178 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000179 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000180 return i;
181}
182
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000183/* Initialize a struct *without* our lovely braces =( */
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000184void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000185#ifndef DISABLE_HELP
Chris Allegrettaf717f982003-02-13 22:25:01 +0000186 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000187#endif
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000188 int metaval, int funcval, int miscval, int view, int
189 (*func)(void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000190{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000191 shortcut *s;
192
193 if (*shortcutage == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000194 *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000195 s = *shortcutage;
196 } else {
197 for (s = *shortcutage; s->next != NULL; s = s->next)
198 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000199 s->next = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000200 s = s->next;
201 }
202
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000203 s->ctrlval = ctrlval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000204 s->desc = desc;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000205#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000206 s->help = help;
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000207#endif
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000208 s->metaval = metaval;
209 s->funcval = funcval;
210 s->miscval = miscval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000211 s->viewok = view;
212 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000213 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000214}
215
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000216#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000217/* Create one new toggle structure, at the end of the toggles
218 * linked list. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000219void toggle_init_one(int val, const char *desc, int flag)
Chris Allegretta756f2202000-09-01 13:32:47 +0000220{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000221 toggle *u;
222
223 if (toggles == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000224 toggles = (toggle *)nmalloc(sizeof(toggle));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000225 u = toggles;
226 } else {
227 for (u = toggles; u->next != NULL; u = u->next)
228 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000229 u->next = (toggle *)nmalloc(sizeof(toggle));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000230 u = u->next;
231 }
232
233 u->val = val;
234 u->desc = desc;
235 u->flag = flag;
236 u->next = NULL;
Chris Allegretta756f2202000-09-01 13:32:47 +0000237}
238
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000239void toggle_init(void)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000240{
Chris Allegretta756f2202000-09-01 13:32:47 +0000241 char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
Chris Allegretta15c28f82003-01-05 21:47:06 +0000242 *toggle_nohelp_msg, *toggle_cuttoend_msg,
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000243 *toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
David Lawrence Ramseyc7acf692004-05-22 20:15:20 +0000244 *toggle_backup_msg, *toggle_smooth_msg, *toggle_smarthome_msg;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000245#ifndef DISABLE_MOUSE
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000246 char *toggle_mouse_msg;
247#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000248#ifndef DISABLE_WRAPPING
249 char *toggle_wrap_msg;
250#endif
David Lawrence Ramsey483ea322004-05-29 16:25:30 +0000251#ifdef ENABLE_COLOR
252 char *toggle_syntax_msg;
253#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000254#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000255 char *toggle_multibuffer_msg;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000256#endif
David Lawrence Ramsey483ea322004-05-29 16:25:30 +0000257#ifdef ENABLE_NANORC
258 char *toggle_whitespace_msg;
Chris Allegretta1dd0bc92002-10-13 18:43:45 +0000259#endif
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000260
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000261 /* There is no need to reinitialize the toggles. They can't
Chris Allegretta7662c862003-01-13 01:35:15 +0000262 change. */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000263 if (toggles != NULL)
264 return;
265
Chris Allegretta756f2202000-09-01 13:32:47 +0000266 toggle_const_msg = _("Constant cursor position");
Chris Allegrettaf8163dc2000-09-03 01:06:40 +0000267 toggle_autoindent_msg = _("Auto indent");
Chris Allegretta756f2202000-09-01 13:32:47 +0000268 toggle_suspend_msg = _("Suspend");
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000269 toggle_nohelp_msg = _("Help mode");
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000270#ifndef DISABLE_MOUSE
Chris Allegretta756f2202000-09-01 13:32:47 +0000271 toggle_mouse_msg = _("Mouse support");
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000272#endif
Chris Allegretta756f2202000-09-01 13:32:47 +0000273 toggle_cuttoend_msg = _("Cut to end");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000274 toggle_noconvert_msg = _("No conversion from DOS/Mac format");
Chris Allegretta7004c282001-09-22 00:42:10 +0000275 toggle_dos_msg = _("Writing file in DOS format");
Chris Allegretta995177f2001-09-22 04:34:23 +0000276 toggle_mac_msg = _("Writing file in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000277 toggle_backup_msg = _("Backing up file");
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000278 toggle_smooth_msg = _("Smooth scrolling");
David Lawrence Ramseyc7acf692004-05-22 20:15:20 +0000279 toggle_smarthome_msg = _("Smart home key");
Chris Allegretta6df90f52002-07-19 01:08:59 +0000280#ifndef DISABLE_WRAPPING
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000281 toggle_wrap_msg = _("Auto line wrap");
Chris Allegretta6df90f52002-07-19 01:08:59 +0000282#endif
David Lawrence Ramseybcebe322004-05-22 20:38:33 +0000283#ifdef ENABLE_COLOR
284 toggle_syntax_msg = _("Color syntax highlighting");
285#endif
Chris Allegretta355fbe52001-07-14 19:32:47 +0000286#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000287 toggle_multibuffer_msg = _("Multiple file buffers");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000288#endif
David Lawrence Ramsey483ea322004-05-29 16:25:30 +0000289#ifdef ENABLE_NANORC
290 toggle_whitespace_msg = _("Whitespace display");
291#endif
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000292
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000293 toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
294#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000295 /* If we're using restricted mode, the multibuffer toggle is
296 * disabled. It's useless since inserting files is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000297 if (!ISSET(RESTRICTED))
298 toggle_init_one(TOGGLE_MULTIBUFFER_KEY, toggle_multibuffer_msg, MULTIBUFFER);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000299#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000300 toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
301 toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000302#ifndef DISABLE_WRAPPING
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000303 toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000304#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000305 toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000306 /* If we're using restricted mode, the suspend toggle is disabled.
307 * It's useless since suspending is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000308 if (!ISSET(RESTRICTED))
309 toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000310#ifndef DISABLE_MOUSE
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000311 toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000312#endif
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000313 /* If we're using restricted mode, the no-conversion, DOS format,
314 * Mac format, and backup toggles are disabled. The first, second,
315 * and third are useless since inserting files is disabled, and the
316 * fourth is useless since backups are disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000317 if (!ISSET(RESTRICTED)) {
318 toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
319 toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
320 toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
321 toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
322 }
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000323 toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
David Lawrence Ramseyc7acf692004-05-22 20:15:20 +0000324 toggle_init_one(TOGGLE_SMARTHOME_KEY, toggle_smarthome_msg, SMART_HOME);
Chris Allegretta1dd0bc92002-10-13 18:43:45 +0000325#ifdef ENABLE_COLOR
326 toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX);
327#endif
David Lawrence Ramsey483ea322004-05-29 16:25:30 +0000328#ifdef ENABLE_NANORC
329 toggle_init_one(TOGGLE_WHITESPACE_KEY, toggle_whitespace_msg, WHITESPACE_DISPLAY);
330#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000331}
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000332
333#ifdef DEBUG
334/* Deallocate all of the toggles. */
335void free_toggles(void)
336{
337 while (toggles != NULL) {
338 toggle *pt = toggles; /* Think "previous toggle" */
339
340 toggles = toggles->next;
341 free(pt);
342 }
343}
344#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000345#endif /* !NANO_SMALL */
Chris Allegrettadab017e2002-04-23 10:56:06 +0000346
Chris Allegrettadab017e2002-04-23 10:56:06 +0000347/* Deallocate the given shortcut. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000348void free_shortcutage(shortcut **shortcutage)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000349{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000350 assert(shortcutage != NULL);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000351 while (*shortcutage != NULL) {
352 shortcut *ps = *shortcutage;
353 *shortcutage = (*shortcutage)->next;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000354 free(ps);
355 }
Chris Allegretta756f2202000-09-01 13:32:47 +0000356}
357
Chris Allegretta07798352000-11-27 22:58:23 +0000358void shortcut_init(int unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000359{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000360#ifndef DISABLE_HELP
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000361 const char *nano_help_msg = "", *nano_writeout_msg =
362 "", *nano_exit_msg = "", *nano_goto_msg =
363 "", *nano_justify_msg = "", *nano_replace_msg =
364 "", *nano_insert_msg = "", *nano_whereis_msg =
365 "", *nano_whereis_next_msg = "", *nano_prevpage_msg =
366 "", *nano_nextpage_msg = "", *nano_cut_msg =
367 "", *nano_uncut_msg = "", *nano_cursorpos_msg =
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000368 "", *nano_spell_msg = "", *nano_prevline_msg =
369 "", *nano_nextline_msg = "", *nano_forward_msg =
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000370 "", *nano_back_msg = "", *nano_home_msg =
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000371 "", *nano_end_msg = "", *nano_firstline_msg =
372 "", *nano_lastline_msg = "", *nano_refresh_msg =
373 "", *nano_mark_msg = "", *nano_delete_msg =
374 "", *nano_backspace_msg = "", *nano_tab_msg =
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000375 "", *nano_enter_msg = "", *nano_prevword_msg =
376 "", *nano_nextword_msg = "", *nano_verbatim_msg =
377 "", *nano_cancel_msg = "", *nano_unjustify_msg =
378 "", *nano_append_msg = "", *nano_prepend_msg =
379 "", *nano_tofiles_msg = "", *nano_gotodir_msg =
380 "", *nano_case_msg = "", *nano_reverse_msg =
381 "", *nano_execute_msg = "", *nano_dos_msg =
382 "", *nano_mac_msg = "", *nano_backup_msg =
383 "", *nano_editstr_msg = "", *nano_parabegin_msg =
David Lawrence Ramsey0aa22642004-05-28 14:42:50 +0000384 "", *nano_paraend_msg = "", *nano_fulljustify_msg = "";
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000385
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000386#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf717f982003-02-13 22:25:01 +0000387 const char *nano_openprev_msg = "", *nano_opennext_msg =
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000388 "", *nano_multibuffer_msg = "";
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000389#endif
Chris Allegretta2bef1822001-09-28 19:53:11 +0000390#ifdef HAVE_REGEX_H
Chris Allegrettaf717f982003-02-13 22:25:01 +0000391 const char *nano_regexp_msg = "", *nano_bracket_msg = "";
Chris Allegretta2bef1822001-09-28 19:53:11 +0000392#endif
Chris Allegretta6636dc32001-01-05 05:41:07 +0000393
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000394 nano_help_msg = _("Invoke the help menu");
395 nano_writeout_msg = _("Write the current file to disk");
Chris Allegretta355fbe52001-07-14 19:32:47 +0000396#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaaad3af2003-08-31 16:44:10 +0000397 nano_exit_msg = _("Close current file buffer/Exit from nano");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000398#else
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000399 nano_exit_msg = _("Exit from nano");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000400#endif
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000401 nano_goto_msg = _("Go to a specific line number");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000402 nano_justify_msg = _("Justify the current paragraph");
Chris Allegretta07798352000-11-27 22:58:23 +0000403 nano_unjustify_msg = _("Unjustify after a justify");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000404 nano_replace_msg = _("Replace text within the editor");
405 nano_insert_msg = _("Insert another file into the current one");
406 nano_whereis_msg = _("Search for text within the editor");
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000407 nano_whereis_next_msg = _("Repeat last search");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000408 nano_prevpage_msg = _("Move to the previous screen");
409 nano_nextpage_msg = _("Move to the next screen");
410 nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
411 nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
Chris Allegretta88520c92001-05-05 17:45:54 +0000412 nano_cursorpos_msg = _("Show the position of the cursor");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000413 nano_spell_msg = _("Invoke the spell checker, if available");
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000414 nano_prevline_msg = _("Move to the previous line");
415 nano_nextline_msg = _("Move to the next line");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000416 nano_forward_msg = _("Move forward one character");
417 nano_back_msg = _("Move back one character");
418 nano_home_msg = _("Move to the beginning of the current line");
419 nano_end_msg = _("Move to the end of the current line");
420 nano_firstline_msg = _("Go to the first line of the file");
421 nano_lastline_msg = _("Go to the last line of the file");
422 nano_refresh_msg = _("Refresh (redraw) the current screen");
423 nano_mark_msg = _("Mark text at the current cursor location");
424 nano_delete_msg = _("Delete the character under the cursor");
425 nano_backspace_msg =
426 _("Delete the character to the left of the cursor");
427 nano_tab_msg = _("Insert a tab character");
428 nano_enter_msg = _("Insert a carriage return at the cursor position");
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000429 nano_prevword_msg = _("Move backward one word");
430 nano_nextword_msg = _("Move forward one word");
431 nano_verbatim_msg = _("Insert character(s) verbatim");
432 nano_enter_msg = _("Insert a carriage return at the cursor position");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000433 nano_case_msg =
434 _("Make the current search or replace case (in)sensitive");
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000435 nano_tofiles_msg = _("Go to file browser");
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000436 nano_execute_msg = _("Execute external command");
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000437 nano_gotodir_msg = _("Go to directory");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000438 nano_cancel_msg = _("Cancel the current function");
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000439 nano_append_msg = _("Append to the current file");
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000440 nano_prepend_msg = _("Prepend to the current file");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000441 nano_reverse_msg = _("Search backwards");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000442 nano_dos_msg = _("Write file out in DOS format");
443 nano_mac_msg = _("Write file out in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000444 nano_backup_msg = _("Back up original file when saving");
Chris Allegretta5beed502003-01-05 20:41:21 +0000445 nano_editstr_msg = _("Edit the previous search/replace strings");
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000446 nano_parabegin_msg = _("Go to the beginning of the current paragraph");
447 nano_paraend_msg = _("Go to the end of the current paragraph");
David Lawrence Ramsey0aa22642004-05-28 14:42:50 +0000448 nano_fulljustify_msg = _("Justify the entire file");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000449#ifdef HAVE_REGEX_H
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000450 nano_regexp_msg = _("Use regular expressions");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000451 nano_bracket_msg = _("Find other bracket");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000452#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000453#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaaad3af2003-08-31 16:44:10 +0000454 nano_openprev_msg = _("Switch to previous file buffer");
455 nano_opennext_msg = _("Switch to next file buffer");
David Lawrence Ramseycb7ee0e2003-08-31 17:08:59 +0000456 nano_multibuffer_msg = _("Toggle insert into new file buffer");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000457#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000458#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000459
Chris Allegrettadab017e2002-04-23 10:56:06 +0000460 free_shortcutage(&main_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000461
David Lawrence Ramsey8e4adcd2004-05-20 03:29:33 +0000462/* The following macro is to be used in calling sc_init_one(). The
463 * point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
464 * defined, when the 4th one should not be there. */
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000465#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000466# define IFHELP(help, nextvar) help, nextvar
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000467#else
468# define IFHELP(help, nextvar) nextvar
Chris Allegrettadab017e2002-04-23 10:56:06 +0000469#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000470
Jordi Mallachf9390af2003-08-05 19:31:12 +0000471 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettadab017e2002-04-23 10:56:06 +0000472 sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000473 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000474 NANO_NO_KEY, VIEW,
475#ifndef DISABLE_HELP
476 do_help
477#else
478 nano_disabled_msg
479#endif
480 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000481
Chris Allegretta355fbe52001-07-14 19:32:47 +0000482#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000483 if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
Jordi Mallachf9390af2003-08-05 19:31:12 +0000484 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000485 sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000486 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
487 NANO_NO_KEY, VIEW, do_exit);
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000488 else
489#endif
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000490
Jordi Mallachf9390af2003-08-05 19:31:12 +0000491 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000492 sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000493 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
494 NANO_NO_KEY, VIEW, do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000495
Jordi Mallachf9390af2003-08-05 19:31:12 +0000496 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000497 sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000498 IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY,
499 NANO_NO_KEY, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000500
Jordi Mallachf9390af2003-08-05 19:31:12 +0000501 /* Translators: try to keep this string under 10 characters long */
Chris Allegretta15c28f82003-01-05 21:47:06 +0000502 sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000503 IFHELP(nano_justify_msg, NANO_NO_KEY),
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000504 NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW,
505#ifndef NANO_SMALL
David Lawrence Ramsey8d3e7f32004-05-13 17:28:03 +0000506 do_justify_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000507#else
508 nano_disabled_msg
509#endif
510 );
Chris Allegretta32da4562002-01-02 15:12:21 +0000511
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000512 /* We allow inserting files in view mode if multibuffers are
513 * available, so that we can view multiple files. */
514 /* If we're using restricted mode, inserting files is disabled since
515 * it allows reading from or writing to files not specified on the
516 * command line. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000517 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettad8451932003-03-11 03:50:40 +0000518 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000519 IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY,
520 NANO_NO_KEY,
Chris Allegretta32da4562002-01-02 15:12:21 +0000521#ifdef ENABLE_MULTIBUFFER
Chris Allegrettad8451932003-03-11 03:50:40 +0000522 VIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000523#else
Chris Allegrettad8451932003-03-11 03:50:40 +0000524 NOVIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000525#endif
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000526 , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000527
Jordi Mallachf9390af2003-08-05 19:31:12 +0000528 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000529 sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000530 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY,
531 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000532
Jordi Mallachf9390af2003-08-05 19:31:12 +0000533 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000534 sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000535 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
536 NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000537
Jordi Mallachf9390af2003-08-05 19:31:12 +0000538 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000539 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000540 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
541 NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000542
Jordi Mallachf9390af2003-08-05 19:31:12 +0000543 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000544 sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000545 IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY,
546 NANO_NO_KEY, NOVIEW, do_cut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000547
Chris Allegretta07798352000-11-27 22:58:23 +0000548 if (unjustify)
Jordi Mallachf9390af2003-08-05 19:31:12 +0000549 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000550 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
David Lawrence Ramseyc91696e2004-01-29 04:16:23 +0000551 IFHELP(nano_unjustify_msg, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
David Lawrence Ramseyba7b1682004-02-29 20:07:14 +0000552 NANO_NO_KEY, NOVIEW, 0);
Chris Allegretta07798352000-11-27 22:58:23 +0000553 else
Jordi Mallachf9390af2003-08-05 19:31:12 +0000554 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000555 sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000556 IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY,
557 NANO_NO_KEY, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000558
Jordi Mallachf9390af2003-08-05 19:31:12 +0000559 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000560 sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000561 IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY,
562 NANO_NO_KEY, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000563
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000564 /* If we're using restricted mode, spell checking is disabled
565 * because it allows reading from or writing to files not specified
566 * on the command line. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000567 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000568 sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000569 IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000570 NANO_NO_KEY, NOVIEW,
571#ifndef DISABLE_SPELLER
572 !ISSET(RESTRICTED) ? do_spell :
573#endif
574 nano_disabled_msg);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000575
576 sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000577 IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
578 NANO_NO_KEY, VIEW, do_gotoline_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000579
580 sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000581 IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
582 NANO_NO_KEY, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000583
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000584 sc_init_one(&main_list, NANO_PREVLINE_KEY, _("Prev Line"),
585 IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000586 NANO_NO_KEY, VIEW, do_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000587
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000588 sc_init_one(&main_list, NANO_NEXTLINE_KEY, _("Next Line"),
589 IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000590 NANO_NO_KEY, VIEW, do_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000591
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000592 sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000593 IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000594 NANO_NO_KEY, VIEW, do_right_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000595
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000596 sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000597 IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000598 NANO_NO_KEY, VIEW, do_left_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000599
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000600 sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000601 IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
602 NANO_NO_KEY, VIEW, do_home);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000603
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000604 sc_init_one(&main_list, NANO_END_KEY, _("End"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000605 IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
606 NANO_NO_KEY, VIEW, do_end);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000607
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000608 sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000609 IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
610 NANO_NO_KEY, VIEW, total_refresh);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000611
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000612 sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000613 IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000614 NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
615#ifndef NANO_SMALL
616 do_mark
617#else
618 nano_disabled_msg
619#endif
620 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000621
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000622 sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000623 IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
624 NANO_NO_KEY, NOVIEW, do_delete);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000625
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000626 sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000627 IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY,
628 NANO_NO_KEY, NOVIEW, do_backspace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000629
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000630 sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000631 IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY,
632 NANO_NO_KEY, NOVIEW, do_tab);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000633
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000634 sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000635 IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
636 NANO_NO_KEY, NOVIEW, do_enter);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000637
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000638#ifndef NANO_SMALL
639 sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000640 IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
641 NANO_NO_KEY, VIEW, do_next_word);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000642
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000643 sc_init_one(&main_list, NANO_NO_KEY, _("Prev Word"),
644 IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
645 NANO_NO_KEY, VIEW, do_prev_word);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000646#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000647
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000648 sc_init_one(&main_list, NANO_NO_KEY, _("Verbatim Input"),
649 IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
David Lawrence Ramsey00c20542004-02-01 06:27:59 +0000650 NANO_NO_KEY, NOVIEW, do_verbatim_input);
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000651
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000652#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000653 sc_init_one(&main_list, NANO_NO_KEY, _("Previous File"),
654 IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
655 NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000656
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000657 sc_init_one(&main_list, NANO_NO_KEY, _("Next File"),
658 IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
659 NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000660#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000661
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000662#ifndef NANO_SMALL
663#ifdef HAVE_REGEX_H
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000664 sc_init_one(&main_list, NANO_NO_KEY, _("Find Other Bracket"),
665 IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
666 NANO_NO_KEY, VIEW, do_find_bracket);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000667#endif
668
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000669 sc_init_one(&main_list, NANO_NO_KEY, _("Where Is Next"),
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000670 IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000671 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000672#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000673
Chris Allegrettadab017e2002-04-23 10:56:06 +0000674 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000675
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000676 sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000677 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000678 NANO_NO_KEY, VIEW,
679#ifndef DISABLE_HELP
680 do_help
681#else
682 nano_disabled_msg
683#endif
684 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000685
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000686 /* Translators: try to keep this string under 10 characters long */
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000687 sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000688 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
689 NANO_NO_KEY, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000690
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000691 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000692 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyd7f5ad92004-03-04 19:30:53 +0000693 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000694 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000695
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000696 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000697 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyd7f5ad92004-03-04 19:30:53 +0000698 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000699 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000700
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000701 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000702 sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000703 IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
704 NANO_NO_KEY, VIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000705
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000706 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettad865da12002-07-29 23:46:38 +0000707 sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000708 IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
709 NANO_NO_KEY, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000710
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000711#ifndef DISABLE_JUSTIFY
712 /* Translators: try to keep this string under 10 characters long */
713 sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, _("Beg of Par"),
David Lawrence Ramseydc10ecb2004-03-15 20:03:01 +0000714 IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000715 NANO_NO_KEY, VIEW, do_para_begin);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000716
717 /* Translators: try to keep this string under 10 characters long */
718 sc_init_one(&whereis_list, NANO_PARAEND_KEY, _("End of Par"),
David Lawrence Ramseydc10ecb2004-03-15 20:03:01 +0000719 IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000720 NANO_NO_KEY, VIEW, do_para_end);
David Lawrence Ramsey8d3e7f32004-05-13 17:28:03 +0000721
722 /* Translators: try to keep this string under 10 characters long */
723 sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, _("FullJstify"),
David Lawrence Ramsey0aa22642004-05-28 14:42:50 +0000724 IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
725 NANO_NO_KEY, NOVIEW, do_full_justify);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000726#endif
727
Chris Allegretta5f36c372001-07-16 00:48:53 +0000728#ifndef NANO_SMALL
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000729 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000730 sc_init_one(&whereis_list, NANO_NO_KEY, _("Case Sens"),
731 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
732 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000733
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000734 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000735 sc_init_one(&whereis_list, NANO_NO_KEY, _("Direction"),
736 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
737 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000738
Chris Allegretta658399a2001-06-14 02:54:22 +0000739#ifdef HAVE_REGEX_H
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000740 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000741 sc_init_one(&whereis_list, NANO_NO_KEY, _("Regexp"),
742 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
743 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000744#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000745
746#ifndef NANO_SMALL
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000747 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000748 sc_init_one(&whereis_list, NANO_HISTORY_KEY, _("History"),
749 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
750 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5beed502003-01-05 20:41:21 +0000751#endif
752
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000753#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000754
Chris Allegrettadab017e2002-04-23 10:56:06 +0000755 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000756
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000757 sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000758 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000759 NANO_NO_KEY, VIEW,
760#ifndef DISABLE_HELP
761 do_help
762#else
763 nano_disabled_msg
764#endif
765 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000766
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000767 sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000768 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
769 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000770
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000771 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000772 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
773 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000774
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000775 sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000776 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
777 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000778
Jordi Mallachf9390af2003-08-05 19:31:12 +0000779 /* Translators: try to keep this string under 12 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000780 sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000781 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
782 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000783
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000784 sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000785 IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
786 NANO_NO_KEY, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000787
Chris Allegretta5f36c372001-07-16 00:48:53 +0000788#ifndef NANO_SMALL
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000789 sc_init_one(&replace_list, NANO_NO_KEY, _("Case Sens"),
790 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
791 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000792
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000793 sc_init_one(&replace_list, NANO_NO_KEY, _("Direction"),
794 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
795 NANO_NO_KEY, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000796
Chris Allegretta658399a2001-06-14 02:54:22 +0000797#ifdef HAVE_REGEX_H
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000798 sc_init_one(&replace_list, NANO_NO_KEY, _("Regexp"),
799 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
800 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000801#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000802
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000803 sc_init_one(&replace_list, NANO_HISTORY_KEY, _("History"),
804 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000805 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000806#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000807
Chris Allegrettadab017e2002-04-23 10:56:06 +0000808 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000809
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000810 sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000811 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000812 NANO_NO_KEY, VIEW,
813#ifndef DISABLE_HELP
814 do_help
815#else
816 nano_disabled_msg
817#endif
818 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000819
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000820 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000821 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
822 NANO_NO_KEY, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000823
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000824 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000825 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
826 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000827
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000828 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000829 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
830 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000831
Chris Allegretta5beed502003-01-05 20:41:21 +0000832#ifndef NANO_SMALL
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000833 sc_init_one(&replace_list_2, NANO_HISTORY_KEY, _("History"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000834 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000835 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5beed502003-01-05 20:41:21 +0000836#endif
837
Chris Allegrettadab017e2002-04-23 10:56:06 +0000838 free_shortcutage(&goto_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000839
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000840 sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000841 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000842 NANO_NO_KEY, VIEW,
843#ifndef DISABLE_HELP
844 do_help
845#else
846 nano_disabled_msg
847#endif
848 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000849
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000850 sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000851 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
852 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000853
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000854 sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000855 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
856 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000857
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000858 sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000859 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
860 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000861
Chris Allegretta7662c862003-01-13 01:35:15 +0000862#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000863 free_shortcutage(&help_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000864
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000865 sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000866 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
867 NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000868
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000869 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000870 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
871 NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000872
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000873 sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000874 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
875 NANO_NO_KEY, VIEW, do_exit);
Chris Allegretta7662c862003-01-13 01:35:15 +0000876#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000877
Chris Allegrettadab017e2002-04-23 10:56:06 +0000878 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000879
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000880 sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000881 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000882 NANO_NO_KEY, VIEW,
883#ifndef DISABLE_HELP
884 do_help
885#else
886 nano_disabled_msg
887#endif
888 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000889
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000890#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000891 /* If we're using restricted mode, the file browser is disabled.
892 * It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000893 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000894 if (!ISSET(RESTRICTED))
895 sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000896 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
897 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000898#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000899
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000900#ifndef NANO_SMALL
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000901 /* If we're using restricted mode, the DOS format, Mac format,
902 * append, prepend, and backup toggles are disabled. The first and
903 * second are useless since inserting files is disabled, the third
904 * and fourth are disabled because they allow writing to files not
905 * specified on the command line, and the fifth is useless since
906 * backups are disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000907 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000908 if (!ISSET(RESTRICTED))
909 sc_init_one(&writefile_list, NANO_NO_KEY, _("DOS Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000910 IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
911 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000912
Jordi Mallachf9390af2003-08-05 19:31:12 +0000913 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000914 if (!ISSET(RESTRICTED))
915 sc_init_one(&writefile_list, NANO_NO_KEY, _("Mac Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000916 IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
917 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000918#endif
919
Jordi Mallachf9390af2003-08-05 19:31:12 +0000920 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000921 if (!ISSET(RESTRICTED))
922 sc_init_one(&writefile_list, NANO_NO_KEY, _("Append"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000923 IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
924 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000925
Jordi Mallachf9390af2003-08-05 19:31:12 +0000926 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000927 if (!ISSET(RESTRICTED))
928 sc_init_one(&writefile_list, NANO_NO_KEY, _("Prepend"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000929 IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
930 NANO_NO_KEY, NOVIEW, 0);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000931
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000932#ifndef NANO_SMALL
Jordi Mallachf9390af2003-08-05 19:31:12 +0000933 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000934 if (!ISSET(RESTRICTED))
935 sc_init_one(&writefile_list, NANO_NO_KEY, _("Backup File"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000936 IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
937 NANO_NO_KEY, NOVIEW, 0);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000938#endif
939
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000940 sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000941 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
942 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000943
Chris Allegrettadab017e2002-04-23 10:56:06 +0000944 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000945
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000946 sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000947 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000948 NANO_NO_KEY, VIEW,
949#ifndef DISABLE_HELP
950 do_help
951#else
952 nano_disabled_msg
953#endif
954 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000955
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000956 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000957 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
958 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000959
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000960#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000961 /* If we're using restricted mode, the file browser is disabled.
962 * It's useless since inserting files is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000963 if (!ISSET(RESTRICTED))
964 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000965 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
966 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000967#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000968
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000969#ifndef NANO_SMALL
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000970 /* If we're using restricted mode, command execution is disabled.
971 * It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000972 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000973 if (!ISSET(RESTRICTED))
974 sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000975 IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
976 NANO_NO_KEY, NOVIEW, 0);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000977
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000978#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000979 /* If we're using restricted mode, the multibuffer toggle is
980 * disabled. It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000981 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000982 if (!ISSET(RESTRICTED))
983 sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000984 IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
985 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000986#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000987#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000988
Chris Allegretta7662c862003-01-13 01:35:15 +0000989#ifndef DISABLE_SPELLER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000990 free_shortcutage(&spell_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000991
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000992 sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000993 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000994 NANO_NO_KEY, VIEW,
995#ifndef DISABLE_HELP
996 do_help
997#else
998 nano_disabled_msg
999#endif
1000 );
Chris Allegrettab3655b42001-10-22 03:15:31 +00001001
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001002 sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001003 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
1004 NANO_NO_KEY, VIEW, 0);
Chris Allegretta7662c862003-01-13 01:35:15 +00001005#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +00001006
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001007#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +00001008 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +00001009
Chris Allegretta6fe98d72002-05-16 23:30:14 +00001010 sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001011 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001012 NANO_NO_KEY, VIEW,
1013#ifndef DISABLE_HELP
1014 do_help
1015#else
1016 nano_disabled_msg
1017#endif
1018 );
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001019
1020 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001021 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
1022 NANO_NO_KEY, VIEW, 0);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +00001023#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00001024
Rocco Corsiaf5c3022001-01-12 07:51:05 +00001025#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +00001026 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001027
Chris Allegretta6fe98d72002-05-16 23:30:14 +00001028 sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001029 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001030 NANO_NO_KEY, VIEW,
1031#ifndef DISABLE_HELP
1032 do_help
1033#else
1034 nano_disabled_msg
1035#endif
1036 );
Chris Allegrettab3655b42001-10-22 03:15:31 +00001037
David Lawrence Ramseyc5967552002-06-21 03:20:06 +00001038 sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001039 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
1040 NANO_NO_KEY, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +00001041
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001042 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001043 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
1044 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001045
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001046 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001047 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
1048 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001049
Jordi Mallachf9390af2003-08-05 19:31:12 +00001050 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyc5967552002-06-21 03:20:06 +00001051 sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001052 IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
1053 NANO_NO_KEY, VIEW, 0);
Rocco Corsi12f294c2001-04-14 06:50:24 +00001054
Chris Allegrettadab017e2002-04-23 10:56:06 +00001055 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001056
Chris Allegretta6fe98d72002-05-16 23:30:14 +00001057 sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001058 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001059 NANO_NO_KEY, VIEW,
1060#ifndef DISABLE_HELP
1061 do_help
1062#else
1063 nano_disabled_msg
1064#endif
1065 );
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001066
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001067 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001068 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
1069 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001070#endif
1071
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +00001072#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001073 currshortcut = main_list;
1074#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001075#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +00001076 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001077#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +00001078}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001079
Chris Allegretta6232d662002-05-12 19:52:15 +00001080/* This function is called just before calling exit(). Practically, the
1081 * only effect is to cause a segmentation fault if the various data
1082 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +00001083 * function unless debugging is turned on. */
Chris Allegretta6232d662002-05-12 19:52:15 +00001084#ifdef DEBUG
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001085/* added by SPK for memory cleanup, gracefully return our malloc()s */
Chris Allegretta6df90f52002-07-19 01:08:59 +00001086void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001087{
Chris Allegretta7662c862003-01-13 01:35:15 +00001088#ifndef DISABLE_JUSTIFY
1089 if (quotestr != NULL)
1090 free(quotestr);
1091#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +00001092#ifndef NANO_SMALL
1093 if (backup_dir != NULL)
1094 free(backup_dir);
1095#endif
Chris Allegretta2598c662002-03-28 01:59:34 +00001096#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001097 if (operating_dir != NULL)
1098 free(operating_dir);
1099 if (full_operating_dir != NULL)
1100 free(full_operating_dir);
1101#endif
1102 if (last_search != NULL)
1103 free(last_search);
1104 if (last_replace != NULL)
1105 free(last_replace);
1106 if (hblank != NULL)
1107 free(hblank);
1108#ifndef DISABLE_SPELLER
1109 if (alt_speller != NULL)
1110 free(alt_speller);
1111#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001112#ifndef DISABLE_HELP
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001113 if (help_text != NULL)
1114 free(help_text);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001115#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001116 if (filename != NULL)
1117 free(filename);
1118 if (answer != NULL)
1119 free(answer);
1120 if (cutbuffer != NULL)
Chris Allegretta7662c862003-01-13 01:35:15 +00001121 free_filestruct(cutbuffer);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001122
1123 free_shortcutage(&main_list);
1124 free_shortcutage(&whereis_list);
1125 free_shortcutage(&replace_list);
1126 free_shortcutage(&replace_list_2);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001127 free_shortcutage(&goto_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001128 free_shortcutage(&writefile_list);
1129 free_shortcutage(&insertfile_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001130#ifndef DISABLE_HELP
Chris Allegretta6df90f52002-07-19 01:08:59 +00001131 free_shortcutage(&help_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001132#endif
1133#ifndef DISABLE_SPELLER
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001134 free_shortcutage(&spell_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001135#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001136#ifndef NANO_SMALL
1137 free_shortcutage(&extcmd_list);
1138#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001139#ifndef DISABLE_BROWSER
1140 free_shortcutage(&browser_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001141 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001142#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001143
1144#ifndef NANO_SMALL
1145 free_toggles();
1146#endif
1147
1148#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001149 if (open_files != NULL) {
Chris Allegretta6232d662002-05-12 19:52:15 +00001150 /* We free the memory associated with each open file. */
Chris Allegrettace452fb2003-02-03 02:56:44 +00001151 while (open_files->prev != NULL)
1152 open_files = open_files->prev;
Chris Allegretta6df90f52002-07-19 01:08:59 +00001153 free_openfilestruct(open_files);
Chris Allegrettace452fb2003-02-03 02:56:44 +00001154 }
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001155#else
Chris Allegrettace452fb2003-02-03 02:56:44 +00001156 free_filestruct(fileage);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001157#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001158
1159#ifdef ENABLE_COLOR
1160 free(syntaxstr);
1161 while (syntaxes != NULL) {
1162 syntaxtype *bill = syntaxes;
1163
1164 free(syntaxes->desc);
1165 while (syntaxes->extensions != NULL) {
1166 exttype *bob = syntaxes->extensions;
1167
1168 syntaxes->extensions = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001169 regfree(&bob->val);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001170 free(bob);
1171 }
1172 while (syntaxes->color != NULL) {
1173 colortype *bob = syntaxes->color;
1174
1175 syntaxes->color = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001176 regfree(&bob->start);
1177 if (bob->end != NULL)
Chris Allegrettace452fb2003-02-03 02:56:44 +00001178 regfree(bob->end);
1179 free(bob->end);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001180 free(bob);
1181 }
1182 syntaxes = syntaxes->next;
1183 free(bill);
1184 }
1185#endif /* ENABLE_COLOR */
Chris Allegretta5beed502003-01-05 20:41:21 +00001186#ifndef NANO_SMALL
1187 /* free history lists */
1188 free_history(&search_history);
1189 free_history(&replace_history);
1190#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001191}
Chris Allegretta6232d662002-05-12 19:52:15 +00001192#endif /* DEBUG */