Chris Allegretta | 11b0011 | 2000-08-06 21:13:45 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 2 | /************************************************************************** |
| 3 | * global.c * |
| 4 | * * |
David Lawrence Ramsey | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 Chris Allegretta * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 6 | * 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 Allegretta | 3a24f3f | 2001-10-24 11:33:54 +0000 | [diff] [blame] | 8 | * the Free Software Foundation; either version 2, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 9 | * 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 Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 22 | #include "config.h" |
Chris Allegretta | 6efda54 | 2001-04-28 18:03:52 +0000 | [diff] [blame] | 23 | |
Chris Allegretta | 1dd0bc9 | 2002-10-13 18:43:45 +0000 | [diff] [blame] | 24 | #include <stdlib.h> |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 25 | #include <assert.h> |
Chris Allegretta | 6efda54 | 2001-04-28 18:03:52 +0000 | [diff] [blame] | 26 | #include <sys/stat.h> |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 27 | #include "proto.h" |
David Lawrence Ramsey | f21cd10 | 2002-06-13 00:40:19 +0000 | [diff] [blame] | 28 | #include "nano.h" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 29 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 30 | /* Global variables */ |
Chris Allegretta | 48b0670 | 2002-02-22 04:30:50 +0000 | [diff] [blame] | 31 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 32 | #ifndef DISABLE_WRAPJUSTIFY |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 33 | /* wrap_at might be set in rcfile.c or nano.c */ |
| 34 | int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 35 | #endif |
| 36 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 37 | char *last_search = NULL; /* Last string we searched for */ |
| 38 | char *last_replace = NULL; /* Last replacement string */ |
| 39 | int search_last_line; /* Is this the last search line? */ |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 40 | int search_offscreen; /* Search lines not displayed */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 41 | |
Chris Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 42 | int flags = 0; /* Our new flag containing many options */ |
David Lawrence Ramsey | f21cd10 | 2002-06-13 00:40:19 +0000 | [diff] [blame] | 43 | WINDOW *edit; /* The file portion of the editor */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 44 | WINDOW *topwin; /* Top line of screen */ |
| 45 | WINDOW *bottomwin; /* Bottom buffer */ |
Chris Allegretta | 1a6e904 | 2000-12-14 13:56:28 +0000 | [diff] [blame] | 46 | char *filename = NULL; /* Name of the file */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 47 | |
| 48 | #ifndef NANO_SMALL |
| 49 | struct stat originalfilestat; /* Stat for the file as we loaded it */ |
| 50 | #endif |
| 51 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 52 | int editwinrows = 0; /* How many rows long is the edit |
| 53 | window? */ |
| 54 | filestruct *current; /* Current buffer pointer */ |
| 55 | int current_x = 0, current_y = 0; /* Current position of X and Y in |
| 56 | the editor - relative to edit |
| 57 | window (0,0) */ |
| 58 | filestruct *fileage = NULL; /* Our file buffer */ |
| 59 | filestruct *edittop = NULL; /* Pointer to the top of the edit |
| 60 | buffer with respect to the |
| 61 | file struct */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 62 | filestruct *filebot = NULL; /* Last node in the file struct */ |
| 63 | filestruct *cutbuffer = NULL; /* A place to store cut text */ |
| 64 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 65 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 66 | openfilestruct *open_files = NULL; /* The list of open files */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 67 | #endif |
| 68 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 69 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 2c62b07 | 2004-05-29 16:38:57 +0000 | [diff] [blame^] | 70 | char *punct = NULL; /* Closing punctuation that can end |
| 71 | sentences. */ |
| 72 | char *brackets = NULL; /* Closing brackets that can follow |
| 73 | closing punctuation and can end |
| 74 | sentences. */ |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 75 | char *quotestr = NULL; /* Quote string. The default value is |
| 76 | set in main(). */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 77 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 78 | |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 79 | #ifndef NANO_SMALL |
| 80 | char *backup_dir = NULL; /* Backup directory. */ |
David Lawrence Ramsey | 483ea32 | 2004-05-29 16:25:30 +0000 | [diff] [blame] | 81 | #ifdef ENABLE_NANORC |
| 82 | char *whitespace = NULL; /* Characters used when displaying |
| 83 | the first characters of tabs and |
| 84 | spaces. */ |
| 85 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 86 | #endif |
| 87 | |
Chris Allegretta | 65f075d | 2003-02-13 03:03:49 +0000 | [diff] [blame] | 88 | int resetstatuspos; /* Hack for resetting the status bar |
| 89 | cursor position */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 90 | char *answer = NULL; /* Answer str to many questions */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 91 | int totlines = 0; /* Total number of lines in the file */ |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 92 | long totsize = 0; /* Total number of bytes in the file */ |
Chris Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 93 | int placewewant = 0; /* The column we'd like the cursor |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 94 | to jump to when we go to the |
| 95 | next or previous line */ |
| 96 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 97 | int tabsize = -1; /* Our internal tabsize variable. The |
| 98 | default value 8 is set in main(). */ |
Chris Allegretta | 6d690a3 | 2000-08-03 22:51:21 +0000 | [diff] [blame] | 99 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 100 | char *hblank = NULL; /* A horizontal blank line */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 101 | #ifndef DISABLE_HELP |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 102 | char *help_text; /* The text in the help window */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 103 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 104 | |
| 105 | /* More stuff for the marker select */ |
| 106 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 107 | #ifndef NANO_SMALL |
David Lawrence Ramsey | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 108 | filestruct *mark_beginbuf; /* The begin marker buffer */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 109 | int mark_beginx; /* X value in the string to start */ |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 110 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 111 | |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 112 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 113 | char *operating_dir = NULL; /* Operating directory, which we can't */ |
| 114 | char *full_operating_dir = NULL;/* go higher than */ |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 115 | #endif |
| 116 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 117 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 7c27be4 | 2002-05-05 23:03:54 +0000 | [diff] [blame] | 118 | char *alt_speller = NULL; /* Alternative spell command */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 119 | #endif |
| 120 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 121 | shortcut *main_list = NULL; |
| 122 | shortcut *whereis_list = NULL; |
| 123 | shortcut *replace_list = NULL; |
Chris Allegretta | 48b0670 | 2002-02-22 04:30:50 +0000 | [diff] [blame] | 124 | shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 125 | shortcut *goto_list = NULL; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 126 | shortcut *writefile_list = NULL; |
| 127 | shortcut *insertfile_list = NULL; |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 128 | #ifndef DISABLE_HELP |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 129 | shortcut *help_list = NULL; |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 130 | #endif |
| 131 | #ifndef DISABLE_SPELLER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 132 | shortcut *spell_list = NULL; |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 133 | #endif |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 134 | #ifndef NANO_SMALL |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 135 | shortcut *extcmd_list = NULL; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 136 | #endif |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 137 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 138 | shortcut *browser_list = NULL; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 139 | shortcut *gotodir_list = NULL; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 140 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 141 | |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 142 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 143 | const colortype *colorstrings = NULL; |
| 144 | syntaxtype *syntaxes = NULL; |
| 145 | char *syntaxstr = NULL; |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 146 | #endif |
| 147 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 148 | #if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 149 | const shortcut *currshortcut; /* Current shortcut list we're using */ |
Chris Allegretta | 6fe6149 | 2001-05-21 12:56:25 +0000 | [diff] [blame] | 150 | #endif |
Chris Allegretta | 6b58acd | 2001-04-12 03:01:53 +0000 | [diff] [blame] | 151 | |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 152 | #ifndef NANO_SMALL |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 153 | toggle *toggles = NULL; |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 154 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 155 | |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 156 | #ifndef NANO_SMALL |
| 157 | historyheadtype search_history; |
| 158 | historyheadtype replace_history; |
| 159 | #endif |
| 160 | |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 161 | /* Regular expressions */ |
| 162 | |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 163 | #ifdef HAVE_REGEX_H |
Chris Allegretta | bd9e7c3 | 2000-10-26 01:44:42 +0000 | [diff] [blame] | 164 | regex_t search_regexp; /* Global to store compiled search regexp */ |
| 165 | regmatch_t regmatches[10]; /* Match positions for parenthetical |
| 166 | subexpressions, max of 10 */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 167 | #endif |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 168 | |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 169 | int curses_ended = FALSE; /* Indicates to statusbar() to simply |
| 170 | * write to stderr, since endwin() has |
| 171 | * ended curses mode. */ |
| 172 | |
| 173 | |
David Lawrence Ramsey | 221ebcd | 2004-03-05 20:47:15 +0000 | [diff] [blame] | 174 | int length_of_list(const shortcut *s) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 175 | { |
| 176 | int i = 0; |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 177 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 178 | for (; s != NULL; s = s->next) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 179 | i++; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 180 | return i; |
| 181 | } |
| 182 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 183 | /* Initialize a struct *without* our lovely braces =( */ |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 184 | void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 185 | #ifndef DISABLE_HELP |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 186 | const char *help, |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 187 | #endif |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 188 | int metaval, int funcval, int miscval, int view, int |
| 189 | (*func)(void)) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 190 | { |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 191 | shortcut *s; |
| 192 | |
| 193 | if (*shortcutage == NULL) { |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 194 | *shortcutage = (shortcut *)nmalloc(sizeof(shortcut)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 195 | s = *shortcutage; |
| 196 | } else { |
| 197 | for (s = *shortcutage; s->next != NULL; s = s->next) |
| 198 | ; |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 199 | s->next = (shortcut *)nmalloc(sizeof(shortcut)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 200 | s = s->next; |
| 201 | } |
| 202 | |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 203 | s->ctrlval = ctrlval; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 204 | s->desc = desc; |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 205 | #ifndef DISABLE_HELP |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 206 | s->help = help; |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 207 | #endif |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 208 | s->metaval = metaval; |
| 209 | s->funcval = funcval; |
| 210 | s->miscval = miscval; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 211 | s->viewok = view; |
| 212 | s->func = func; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 213 | s->next = NULL; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 216 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 217 | /* Create one new toggle structure, at the end of the toggles |
| 218 | * linked list. */ |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 219 | void toggle_init_one(int val, const char *desc, int flag) |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 220 | { |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 221 | toggle *u; |
| 222 | |
| 223 | if (toggles == NULL) { |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 224 | toggles = (toggle *)nmalloc(sizeof(toggle)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 225 | u = toggles; |
| 226 | } else { |
| 227 | for (u = toggles; u->next != NULL; u = u->next) |
| 228 | ; |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 229 | u->next = (toggle *)nmalloc(sizeof(toggle)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 230 | u = u->next; |
| 231 | } |
| 232 | |
| 233 | u->val = val; |
| 234 | u->desc = desc; |
| 235 | u->flag = flag; |
| 236 | u->next = NULL; |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 237 | } |
| 238 | |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 239 | void toggle_init(void) |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 240 | { |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 241 | char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg, |
Chris Allegretta | 15c28f8 | 2003-01-05 21:47:06 +0000 | [diff] [blame] | 242 | *toggle_nohelp_msg, *toggle_cuttoend_msg, |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 243 | *toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg, |
David Lawrence Ramsey | c7acf69 | 2004-05-22 20:15:20 +0000 | [diff] [blame] | 244 | *toggle_backup_msg, *toggle_smooth_msg, *toggle_smarthome_msg; |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 245 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 246 | char *toggle_mouse_msg; |
| 247 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 248 | #ifndef DISABLE_WRAPPING |
| 249 | char *toggle_wrap_msg; |
| 250 | #endif |
David Lawrence Ramsey | 483ea32 | 2004-05-29 16:25:30 +0000 | [diff] [blame] | 251 | #ifdef ENABLE_COLOR |
| 252 | char *toggle_syntax_msg; |
| 253 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 254 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 255 | char *toggle_multibuffer_msg; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 256 | #endif |
David Lawrence Ramsey | 483ea32 | 2004-05-29 16:25:30 +0000 | [diff] [blame] | 257 | #ifdef ENABLE_NANORC |
| 258 | char *toggle_whitespace_msg; |
Chris Allegretta | 1dd0bc9 | 2002-10-13 18:43:45 +0000 | [diff] [blame] | 259 | #endif |
Chris Allegretta | 3e3ae94 | 2001-09-22 19:02:04 +0000 | [diff] [blame] | 260 | |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 261 | /* There is no need to reinitialize the toggles. They can't |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 262 | change. */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 263 | if (toggles != NULL) |
| 264 | return; |
| 265 | |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 266 | toggle_const_msg = _("Constant cursor position"); |
Chris Allegretta | f8163dc | 2000-09-03 01:06:40 +0000 | [diff] [blame] | 267 | toggle_autoindent_msg = _("Auto indent"); |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 268 | toggle_suspend_msg = _("Suspend"); |
Chris Allegretta | f0f63a8 | 2000-09-02 18:44:21 +0000 | [diff] [blame] | 269 | toggle_nohelp_msg = _("Help mode"); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 270 | #ifndef DISABLE_MOUSE |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 271 | toggle_mouse_msg = _("Mouse support"); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 272 | #endif |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 273 | toggle_cuttoend_msg = _("Cut to end"); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 274 | toggle_noconvert_msg = _("No conversion from DOS/Mac format"); |
Chris Allegretta | 7004c28 | 2001-09-22 00:42:10 +0000 | [diff] [blame] | 275 | toggle_dos_msg = _("Writing file in DOS format"); |
Chris Allegretta | 995177f | 2001-09-22 04:34:23 +0000 | [diff] [blame] | 276 | toggle_mac_msg = _("Writing file in Mac format"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 277 | toggle_backup_msg = _("Backing up file"); |
Chris Allegretta | 3e3ae94 | 2001-09-22 19:02:04 +0000 | [diff] [blame] | 278 | toggle_smooth_msg = _("Smooth scrolling"); |
David Lawrence Ramsey | c7acf69 | 2004-05-22 20:15:20 +0000 | [diff] [blame] | 279 | toggle_smarthome_msg = _("Smart home key"); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 280 | #ifndef DISABLE_WRAPPING |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 281 | toggle_wrap_msg = _("Auto line wrap"); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 282 | #endif |
David Lawrence Ramsey | bcebe32 | 2004-05-22 20:38:33 +0000 | [diff] [blame] | 283 | #ifdef ENABLE_COLOR |
| 284 | toggle_syntax_msg = _("Color syntax highlighting"); |
| 285 | #endif |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 286 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 287 | toggle_multibuffer_msg = _("Multiple file buffers"); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 288 | #endif |
David Lawrence Ramsey | 483ea32 | 2004-05-29 16:25:30 +0000 | [diff] [blame] | 289 | #ifdef ENABLE_NANORC |
| 290 | toggle_whitespace_msg = _("Whitespace display"); |
| 291 | #endif |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 292 | |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 293 | toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP); |
| 294 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 295 | /* If we're using restricted mode, the multibuffer toggle is |
| 296 | * disabled. It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 297 | if (!ISSET(RESTRICTED)) |
| 298 | toggle_init_one(TOGGLE_MULTIBUFFER_KEY, toggle_multibuffer_msg, MULTIBUFFER); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 299 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 300 | toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE); |
| 301 | toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 302 | #ifndef DISABLE_WRAPPING |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 303 | toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 304 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 305 | toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END); |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 306 | /* If we're using restricted mode, the suspend toggle is disabled. |
| 307 | * It's useless since suspending is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 308 | if (!ISSET(RESTRICTED)) |
| 309 | toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 310 | #ifndef DISABLE_MOUSE |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 311 | toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 312 | #endif |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 313 | /* 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 Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 317 | 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 Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 323 | toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL); |
David Lawrence Ramsey | c7acf69 | 2004-05-22 20:15:20 +0000 | [diff] [blame] | 324 | toggle_init_one(TOGGLE_SMARTHOME_KEY, toggle_smarthome_msg, SMART_HOME); |
Chris Allegretta | 1dd0bc9 | 2002-10-13 18:43:45 +0000 | [diff] [blame] | 325 | #ifdef ENABLE_COLOR |
| 326 | toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX); |
| 327 | #endif |
David Lawrence Ramsey | 483ea32 | 2004-05-29 16:25:30 +0000 | [diff] [blame] | 328 | #ifdef ENABLE_NANORC |
| 329 | toggle_init_one(TOGGLE_WHITESPACE_KEY, toggle_whitespace_msg, WHITESPACE_DISPLAY); |
| 330 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 331 | } |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 332 | |
| 333 | #ifdef DEBUG |
| 334 | /* Deallocate all of the toggles. */ |
| 335 | void 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 Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 345 | #endif /* !NANO_SMALL */ |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 346 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 347 | /* Deallocate the given shortcut. */ |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 348 | void free_shortcutage(shortcut **shortcutage) |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 349 | { |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 350 | assert(shortcutage != NULL); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 351 | while (*shortcutage != NULL) { |
| 352 | shortcut *ps = *shortcutage; |
| 353 | *shortcutage = (*shortcutage)->next; |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 354 | free(ps); |
| 355 | } |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 356 | } |
| 357 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 358 | void shortcut_init(int unjustify) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 359 | { |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 360 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 361 | 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 Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 368 | "", *nano_spell_msg = "", *nano_prevline_msg = |
| 369 | "", *nano_nextline_msg = "", *nano_forward_msg = |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 370 | "", *nano_back_msg = "", *nano_home_msg = |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 371 | "", *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 Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 375 | "", *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 Ramsey | 0aa2264 | 2004-05-28 14:42:50 +0000 | [diff] [blame] | 384 | "", *nano_paraend_msg = "", *nano_fulljustify_msg = ""; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 385 | |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 386 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 387 | const char *nano_openprev_msg = "", *nano_opennext_msg = |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 388 | "", *nano_multibuffer_msg = ""; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 389 | #endif |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 390 | #ifdef HAVE_REGEX_H |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 391 | const char *nano_regexp_msg = "", *nano_bracket_msg = ""; |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 392 | #endif |
Chris Allegretta | 6636dc3 | 2001-01-05 05:41:07 +0000 | [diff] [blame] | 393 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 394 | nano_help_msg = _("Invoke the help menu"); |
| 395 | nano_writeout_msg = _("Write the current file to disk"); |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 396 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | aaad3af | 2003-08-31 16:44:10 +0000 | [diff] [blame] | 397 | nano_exit_msg = _("Close current file buffer/Exit from nano"); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 398 | #else |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 399 | nano_exit_msg = _("Exit from nano"); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 400 | #endif |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 401 | nano_goto_msg = _("Go to a specific line number"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 402 | nano_justify_msg = _("Justify the current paragraph"); |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 403 | nano_unjustify_msg = _("Unjustify after a justify"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 404 | 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 Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 407 | nano_whereis_next_msg = _("Repeat last search"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 408 | 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 Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 412 | nano_cursorpos_msg = _("Show the position of the cursor"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 413 | nano_spell_msg = _("Invoke the spell checker, if available"); |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 414 | nano_prevline_msg = _("Move to the previous line"); |
| 415 | nano_nextline_msg = _("Move to the next line"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 416 | 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 Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 429 | 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 Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 433 | nano_case_msg = |
| 434 | _("Make the current search or replace case (in)sensitive"); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 435 | nano_tofiles_msg = _("Go to file browser"); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 436 | nano_execute_msg = _("Execute external command"); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 437 | nano_gotodir_msg = _("Go to directory"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 438 | nano_cancel_msg = _("Cancel the current function"); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 439 | nano_append_msg = _("Append to the current file"); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 440 | nano_prepend_msg = _("Prepend to the current file"); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 441 | nano_reverse_msg = _("Search backwards"); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 442 | nano_dos_msg = _("Write file out in DOS format"); |
| 443 | nano_mac_msg = _("Write file out in Mac format"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 444 | nano_backup_msg = _("Back up original file when saving"); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 445 | nano_editstr_msg = _("Edit the previous search/replace strings"); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 446 | 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 Ramsey | 0aa2264 | 2004-05-28 14:42:50 +0000 | [diff] [blame] | 448 | nano_fulljustify_msg = _("Justify the entire file"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 449 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 450 | nano_regexp_msg = _("Use regular expressions"); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 451 | nano_bracket_msg = _("Find other bracket"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 452 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 453 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | aaad3af | 2003-08-31 16:44:10 +0000 | [diff] [blame] | 454 | nano_openprev_msg = _("Switch to previous file buffer"); |
| 455 | nano_opennext_msg = _("Switch to next file buffer"); |
David Lawrence Ramsey | cb7ee0e | 2003-08-31 17:08:59 +0000 | [diff] [blame] | 456 | nano_multibuffer_msg = _("Toggle insert into new file buffer"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 457 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 458 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 459 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 460 | free_shortcutage(&main_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 461 | |
David Lawrence Ramsey | 8e4adcd | 2004-05-20 03:29:33 +0000 | [diff] [blame] | 462 | /* 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 Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 465 | #ifndef DISABLE_HELP |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 466 | # define IFHELP(help, nextvar) help, nextvar |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 467 | #else |
| 468 | # define IFHELP(help, nextvar) nextvar |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 469 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 470 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 471 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 472 | sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 473 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 474 | NANO_NO_KEY, VIEW, |
| 475 | #ifndef DISABLE_HELP |
| 476 | do_help |
| 477 | #else |
| 478 | nano_disabled_msg |
| 479 | #endif |
| 480 | ); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 481 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 482 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 483 | if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL)) |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 484 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 485 | sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 486 | IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, |
| 487 | NANO_NO_KEY, VIEW, do_exit); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 488 | else |
| 489 | #endif |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 490 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 491 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 492 | sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 493 | IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, |
| 494 | NANO_NO_KEY, VIEW, do_exit); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 495 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 496 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 497 | sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 498 | IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY, |
| 499 | NANO_NO_KEY, NOVIEW, do_writeout_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 500 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 501 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | 15c28f8 | 2003-01-05 21:47:06 +0000 | [diff] [blame] | 502 | sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 503 | IFHELP(nano_justify_msg, NANO_NO_KEY), |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 504 | NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW, |
| 505 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 8d3e7f3 | 2004-05-13 17:28:03 +0000 | [diff] [blame] | 506 | do_justify_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 507 | #else |
| 508 | nano_disabled_msg |
| 509 | #endif |
| 510 | ); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 511 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 512 | /* 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 Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 517 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 518 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 519 | IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY, |
| 520 | NANO_NO_KEY, |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 521 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 522 | VIEW |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 523 | #else |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 524 | NOVIEW |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 525 | #endif |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 526 | , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 527 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 528 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 529 | sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 530 | IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY, |
| 531 | NANO_NO_KEY, VIEW, do_search); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 532 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 533 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 534 | sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 535 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
| 536 | NANO_NO_KEY, VIEW, do_page_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 537 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 538 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 539 | sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 540 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
| 541 | NANO_NO_KEY, VIEW, do_page_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 542 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 543 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 544 | sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 545 | IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY, |
| 546 | NANO_NO_KEY, NOVIEW, do_cut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 547 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 548 | if (unjustify) |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 549 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 550 | sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"), |
David Lawrence Ramsey | c91696e | 2004-01-29 04:16:23 +0000 | [diff] [blame] | 551 | IFHELP(nano_unjustify_msg, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY, |
David Lawrence Ramsey | ba7b168 | 2004-02-29 20:07:14 +0000 | [diff] [blame] | 552 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 553 | else |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 554 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 555 | sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 556 | IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY, |
| 557 | NANO_NO_KEY, NOVIEW, do_uncut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 558 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 559 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 560 | sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 561 | IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY, |
| 562 | NANO_NO_KEY, VIEW, do_cursorpos_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 563 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 564 | /* 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 Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 567 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 568 | sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 569 | IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 570 | NANO_NO_KEY, NOVIEW, |
| 571 | #ifndef DISABLE_SPELLER |
| 572 | !ISSET(RESTRICTED) ? do_spell : |
| 573 | #endif |
| 574 | nano_disabled_msg); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 575 | |
| 576 | sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 577 | IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, |
| 578 | NANO_NO_KEY, VIEW, do_gotoline_void); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 579 | |
| 580 | sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 581 | IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY, |
| 582 | NANO_NO_KEY, NOVIEW, do_replace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 583 | |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 584 | sc_init_one(&main_list, NANO_PREVLINE_KEY, _("Prev Line"), |
| 585 | IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 586 | NANO_NO_KEY, VIEW, do_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 587 | |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 588 | sc_init_one(&main_list, NANO_NEXTLINE_KEY, _("Next Line"), |
| 589 | IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 590 | NANO_NO_KEY, VIEW, do_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 591 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 592 | sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 593 | IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 2ed225f | 2004-05-28 20:44:09 +0000 | [diff] [blame] | 594 | NANO_NO_KEY, VIEW, do_right_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 595 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 596 | sc_init_one(&main_list, NANO_BACK_KEY, _("Back"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 597 | IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 2ed225f | 2004-05-28 20:44:09 +0000 | [diff] [blame] | 598 | NANO_NO_KEY, VIEW, do_left_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 599 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 600 | sc_init_one(&main_list, NANO_HOME_KEY, _("Home"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 601 | IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 602 | NANO_NO_KEY, VIEW, do_home); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 603 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 604 | sc_init_one(&main_list, NANO_END_KEY, _("End"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 605 | IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 606 | NANO_NO_KEY, VIEW, do_end); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 607 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 608 | sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 609 | IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 610 | NANO_NO_KEY, VIEW, total_refresh); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 611 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 612 | sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 613 | IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY), |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 614 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, |
| 615 | #ifndef NANO_SMALL |
| 616 | do_mark |
| 617 | #else |
| 618 | nano_disabled_msg |
| 619 | #endif |
| 620 | ); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 621 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 622 | sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 623 | IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 624 | NANO_NO_KEY, NOVIEW, do_delete); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 625 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 626 | sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 627 | IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 628 | NANO_NO_KEY, NOVIEW, do_backspace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 629 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 630 | sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 631 | IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 632 | NANO_NO_KEY, NOVIEW, do_tab); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 633 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 634 | sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 635 | IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 636 | NANO_NO_KEY, NOVIEW, do_enter); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 637 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 638 | #ifndef NANO_SMALL |
| 639 | sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 640 | IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 641 | NANO_NO_KEY, VIEW, do_next_word); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 642 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 643 | 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 Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 646 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 647 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 648 | sc_init_one(&main_list, NANO_NO_KEY, _("Verbatim Input"), |
| 649 | IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 00c2054 | 2004-02-01 06:27:59 +0000 | [diff] [blame] | 650 | NANO_NO_KEY, NOVIEW, do_verbatim_input); |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 651 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 652 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 653 | 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 Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 656 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 657 | 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 Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 660 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 661 | |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 662 | #ifndef NANO_SMALL |
| 663 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 664 | 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 Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 667 | #endif |
| 668 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 669 | sc_init_one(&main_list, NANO_NO_KEY, _("Where Is Next"), |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 670 | IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 671 | NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 672 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 673 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 674 | free_shortcutage(&whereis_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 675 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 676 | sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 677 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 678 | NANO_NO_KEY, VIEW, |
| 679 | #ifndef DISABLE_HELP |
| 680 | do_help |
| 681 | #else |
| 682 | nano_disabled_msg |
| 683 | #endif |
| 684 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 685 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 686 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 687 | sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 688 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 689 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 690 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 691 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 692 | sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"), |
David Lawrence Ramsey | d7f5ad9 | 2004-03-04 19:30:53 +0000 | [diff] [blame] | 693 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 694 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 695 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 696 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 697 | sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"), |
David Lawrence Ramsey | d7f5ad9 | 2004-03-04 19:30:53 +0000 | [diff] [blame] | 698 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 699 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 700 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 701 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 702 | sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 703 | IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, |
| 704 | NANO_NO_KEY, VIEW, do_replace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 705 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 706 | /* Translators: try to keep this string under 10 characters long */ |
Chris Allegretta | d865da1 | 2002-07-29 23:46:38 +0000 | [diff] [blame] | 707 | sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 708 | IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, |
| 709 | NANO_NO_KEY, VIEW, do_gotoline_void); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 710 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 711 | #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 Ramsey | dc10ecb | 2004-03-15 20:03:01 +0000 | [diff] [blame] | 714 | IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 715 | NANO_NO_KEY, VIEW, do_para_begin); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 716 | |
| 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 Ramsey | dc10ecb | 2004-03-15 20:03:01 +0000 | [diff] [blame] | 719 | IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 720 | NANO_NO_KEY, VIEW, do_para_end); |
David Lawrence Ramsey | 8d3e7f3 | 2004-05-13 17:28:03 +0000 | [diff] [blame] | 721 | |
| 722 | /* Translators: try to keep this string under 10 characters long */ |
| 723 | sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, _("FullJstify"), |
David Lawrence Ramsey | 0aa2264 | 2004-05-28 14:42:50 +0000 | [diff] [blame] | 724 | IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 725 | NANO_NO_KEY, NOVIEW, do_full_justify); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 726 | #endif |
| 727 | |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 728 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 729 | /* Translators: try to keep this string under 10 characters long */ |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 730 | 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 Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 733 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 734 | /* Translators: try to keep this string under 10 characters long */ |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 735 | 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 Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 738 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 739 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 740 | /* Translators: try to keep this string under 10 characters long */ |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 741 | 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 Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 744 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 745 | |
| 746 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 747 | /* Translators: try to keep this string under 10 characters long */ |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 748 | 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 Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 751 | #endif |
| 752 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 753 | #endif /* !NANO_SMALL */ |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 754 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 755 | free_shortcutage(&replace_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 756 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 757 | sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 758 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 759 | NANO_NO_KEY, VIEW, |
| 760 | #ifndef DISABLE_HELP |
| 761 | do_help |
| 762 | #else |
| 763 | nano_disabled_msg |
| 764 | #endif |
| 765 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 766 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 767 | sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 768 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 769 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 770 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 771 | sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 772 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 773 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 774 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 775 | sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 776 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 777 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 778 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 779 | /* Translators: try to keep this string under 12 characters long */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 780 | sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 781 | IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, |
| 782 | NANO_NO_KEY, VIEW, do_search); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 783 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 784 | sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 785 | IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY, |
| 786 | NANO_NO_KEY, VIEW, do_gotoline_void); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 787 | |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 788 | #ifndef NANO_SMALL |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 789 | 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 Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 792 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 793 | 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 Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 796 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 797 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 798 | 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 Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 801 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 802 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 803 | sc_init_one(&replace_list, NANO_HISTORY_KEY, _("History"), |
| 804 | IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 805 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 806 | #endif /* !NANO_SMALL */ |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 807 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 808 | free_shortcutage(&replace_list_2); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 809 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 810 | sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 811 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 812 | NANO_NO_KEY, VIEW, |
| 813 | #ifndef DISABLE_HELP |
| 814 | do_help |
| 815 | #else |
| 816 | nano_disabled_msg |
| 817 | #endif |
| 818 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 819 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 820 | sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 821 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 822 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 823 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 824 | sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 825 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 826 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 827 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 828 | sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 829 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 830 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 831 | |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 832 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 833 | sc_init_one(&replace_list_2, NANO_HISTORY_KEY, _("History"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 834 | IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | c2c5a51 | 2004-01-23 19:26:17 +0000 | [diff] [blame] | 835 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 836 | #endif |
| 837 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 838 | free_shortcutage(&goto_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 839 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 840 | sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 841 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 842 | NANO_NO_KEY, VIEW, |
| 843 | #ifndef DISABLE_HELP |
| 844 | do_help |
| 845 | #else |
| 846 | nano_disabled_msg |
| 847 | #endif |
| 848 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 849 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 850 | sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 851 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 852 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 853 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 854 | sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 855 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 856 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 857 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 858 | sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 859 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 860 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 861 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 862 | #ifndef DISABLE_HELP |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 863 | free_shortcutage(&help_list); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 864 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 865 | sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 866 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
| 867 | NANO_NO_KEY, VIEW, do_page_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 868 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 869 | sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 870 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
| 871 | NANO_NO_KEY, VIEW, do_page_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 872 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 873 | sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 874 | IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, |
| 875 | NANO_NO_KEY, VIEW, do_exit); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 876 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 877 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 878 | free_shortcutage(&writefile_list); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 879 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 880 | sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 881 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 882 | NANO_NO_KEY, VIEW, |
| 883 | #ifndef DISABLE_HELP |
| 884 | do_help |
| 885 | #else |
| 886 | nano_disabled_msg |
| 887 | #endif |
| 888 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 889 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 890 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 891 | /* If we're using restricted mode, the file browser is disabled. |
| 892 | * It's useless since inserting files is disabled. */ |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 893 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 894 | if (!ISSET(RESTRICTED)) |
| 895 | sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 896 | IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 897 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 898 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 899 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 900 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 901 | /* 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 Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 907 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 908 | if (!ISSET(RESTRICTED)) |
| 909 | sc_init_one(&writefile_list, NANO_NO_KEY, _("DOS Format"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 910 | IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY, |
| 911 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 912 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 913 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 914 | if (!ISSET(RESTRICTED)) |
| 915 | sc_init_one(&writefile_list, NANO_NO_KEY, _("Mac Format"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 916 | IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY, |
| 917 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 918 | #endif |
| 919 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 920 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 921 | if (!ISSET(RESTRICTED)) |
| 922 | sc_init_one(&writefile_list, NANO_NO_KEY, _("Append"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 923 | IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY, |
| 924 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 925 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 926 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 927 | if (!ISSET(RESTRICTED)) |
| 928 | sc_init_one(&writefile_list, NANO_NO_KEY, _("Prepend"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 929 | IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY, |
| 930 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 931 | |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 932 | #ifndef NANO_SMALL |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 933 | /* Translators: try to keep this string under 16 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 934 | if (!ISSET(RESTRICTED)) |
| 935 | sc_init_one(&writefile_list, NANO_NO_KEY, _("Backup File"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 936 | IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY, |
| 937 | NANO_NO_KEY, NOVIEW, 0); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 938 | #endif |
| 939 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 940 | sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 941 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 942 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 943 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 944 | free_shortcutage(&insertfile_list); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 945 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 946 | sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 947 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 948 | NANO_NO_KEY, VIEW, |
| 949 | #ifndef DISABLE_HELP |
| 950 | do_help |
| 951 | #else |
| 952 | nano_disabled_msg |
| 953 | #endif |
| 954 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 955 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 956 | sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 957 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 958 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 959 | |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 960 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 961 | /* If we're using restricted mode, the file browser is disabled. |
| 962 | * It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 963 | if (!ISSET(RESTRICTED)) |
| 964 | sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 965 | IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 966 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 967 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 968 | |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 969 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 970 | /* If we're using restricted mode, command execution is disabled. |
| 971 | * It's useless since inserting files is disabled. */ |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 972 | /* Translators: try to keep this string under 22 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 973 | if (!ISSET(RESTRICTED)) |
| 974 | sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 975 | IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 976 | NANO_NO_KEY, NOVIEW, 0); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 977 | |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 978 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 979 | /* If we're using restricted mode, the multibuffer toggle is |
| 980 | * disabled. It's useless since inserting files is disabled. */ |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 981 | /* Translators: try to keep this string under 22 characters long */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 982 | if (!ISSET(RESTRICTED)) |
| 983 | sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 984 | IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY, |
| 985 | NANO_NO_KEY, NOVIEW, 0); |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 986 | #endif |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 987 | #endif |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 988 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 989 | #ifndef DISABLE_SPELLER |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 990 | free_shortcutage(&spell_list); |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 991 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 992 | sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 993 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 994 | NANO_NO_KEY, VIEW, |
| 995 | #ifndef DISABLE_HELP |
| 996 | do_help |
| 997 | #else |
| 998 | nano_disabled_msg |
| 999 | #endif |
| 1000 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1001 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1002 | sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1003 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1004 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1005 | #endif |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 1006 | |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 1007 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1008 | free_shortcutage(&extcmd_list); |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 1009 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 1010 | sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1011 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1012 | NANO_NO_KEY, VIEW, |
| 1013 | #ifndef DISABLE_HELP |
| 1014 | do_help |
| 1015 | #else |
| 1016 | nano_disabled_msg |
| 1017 | #endif |
| 1018 | ); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 1019 | |
| 1020 | sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1021 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1022 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 1023 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 1024 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 1025 | #ifndef DISABLE_BROWSER |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1026 | free_shortcutage(&browser_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1027 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 1028 | sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1029 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1030 | NANO_NO_KEY, VIEW, |
| 1031 | #ifndef DISABLE_HELP |
| 1032 | do_help |
| 1033 | #else |
| 1034 | nano_disabled_msg |
| 1035 | #endif |
| 1036 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1037 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 1038 | sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1039 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1040 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1041 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1042 | sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1043 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
| 1044 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1045 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1046 | sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1047 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
| 1048 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1049 | |
Jordi Mallach | f9390af | 2003-08-05 19:31:12 +0000 | [diff] [blame] | 1050 | /* Translators: try to keep this string under 22 characters long */ |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 1051 | sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1052 | IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY, |
| 1053 | NANO_NO_KEY, VIEW, 0); |
Rocco Corsi | 12f294c | 2001-04-14 06:50:24 +0000 | [diff] [blame] | 1054 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1055 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1056 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 1057 | sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1058 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1059 | NANO_NO_KEY, VIEW, |
| 1060 | #ifndef DISABLE_HELP |
| 1061 | do_help |
| 1062 | #else |
| 1063 | nano_disabled_msg |
| 1064 | #endif |
| 1065 | ); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1066 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1067 | sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 1068 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1069 | NANO_NO_KEY, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1070 | #endif |
| 1071 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 1072 | #if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1073 | currshortcut = main_list; |
| 1074 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1075 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1076 | toggle_init(); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1077 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1078 | } |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1079 | |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1080 | /* 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 Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1083 | * function unless debugging is turned on. */ |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1084 | #ifdef DEBUG |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1085 | /* added by SPK for memory cleanup, gracefully return our malloc()s */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1086 | void thanks_for_all_the_fish(void) |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1087 | { |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1088 | #ifndef DISABLE_JUSTIFY |
| 1089 | if (quotestr != NULL) |
| 1090 | free(quotestr); |
| 1091 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 1092 | #ifndef NANO_SMALL |
| 1093 | if (backup_dir != NULL) |
| 1094 | free(backup_dir); |
| 1095 | #endif |
Chris Allegretta | 2598c66 | 2002-03-28 01:59:34 +0000 | [diff] [blame] | 1096 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1097 | 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 Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 1112 | #ifndef DISABLE_HELP |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1113 | if (help_text != NULL) |
| 1114 | free(help_text); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 1115 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1116 | if (filename != NULL) |
| 1117 | free(filename); |
| 1118 | if (answer != NULL) |
| 1119 | free(answer); |
| 1120 | if (cutbuffer != NULL) |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1121 | free_filestruct(cutbuffer); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1122 | |
| 1123 | free_shortcutage(&main_list); |
| 1124 | free_shortcutage(&whereis_list); |
| 1125 | free_shortcutage(&replace_list); |
| 1126 | free_shortcutage(&replace_list_2); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1127 | free_shortcutage(&goto_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1128 | free_shortcutage(&writefile_list); |
| 1129 | free_shortcutage(&insertfile_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1130 | #ifndef DISABLE_HELP |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1131 | free_shortcutage(&help_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1132 | #endif |
| 1133 | #ifndef DISABLE_SPELLER |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1134 | free_shortcutage(&spell_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1135 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1136 | #ifndef NANO_SMALL |
| 1137 | free_shortcutage(&extcmd_list); |
| 1138 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1139 | #ifndef DISABLE_BROWSER |
| 1140 | free_shortcutage(&browser_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1141 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1142 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1143 | |
| 1144 | #ifndef NANO_SMALL |
| 1145 | free_toggles(); |
| 1146 | #endif |
| 1147 | |
| 1148 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 1149 | if (open_files != NULL) { |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1150 | /* We free the memory associated with each open file. */ |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1151 | while (open_files->prev != NULL) |
| 1152 | open_files = open_files->prev; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1153 | free_openfilestruct(open_files); |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1154 | } |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 1155 | #else |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1156 | free_filestruct(fileage); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 1157 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1158 | |
| 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 Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1169 | regfree(&bob->val); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1170 | free(bob); |
| 1171 | } |
| 1172 | while (syntaxes->color != NULL) { |
| 1173 | colortype *bob = syntaxes->color; |
| 1174 | |
| 1175 | syntaxes->color = bob->next; |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1176 | regfree(&bob->start); |
| 1177 | if (bob->end != NULL) |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1178 | regfree(bob->end); |
| 1179 | free(bob->end); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1180 | free(bob); |
| 1181 | } |
| 1182 | syntaxes = syntaxes->next; |
| 1183 | free(bill); |
| 1184 | } |
| 1185 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 1186 | #ifndef NANO_SMALL |
| 1187 | /* free history lists */ |
| 1188 | free_history(&search_history); |
| 1189 | free_history(&replace_history); |
| 1190 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1191 | } |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1192 | #endif /* DEBUG */ |