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 | * * |
Jordi Mallach | 8ae5789 | 2002-01-04 17:57:40 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2002 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 | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 24 | #include <assert.h> |
Chris Allegretta | 6efda54 | 2001-04-28 18:03:52 +0000 | [diff] [blame] | 25 | #include <sys/stat.h> |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 26 | #include "proto.h" |
David Lawrence Ramsey | f21cd10 | 2002-06-13 00:40:19 +0000 | [diff] [blame] | 27 | #include "nano.h" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 28 | |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 29 | #ifdef ENABLE_NLS |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 30 | #include <libintl.h> |
| 31 | #define _(string) gettext(string) |
| 32 | #else |
| 33 | #define _(string) (string) |
| 34 | #endif |
| 35 | |
| 36 | /* |
| 37 | * Global variables |
| 38 | */ |
Chris Allegretta | 48b0670 | 2002-02-22 04:30:50 +0000 | [diff] [blame] | 39 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 40 | /* wrap_at might be set in rcfile.c or nano.c */ |
| 41 | int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */ |
| 42 | char *last_search = NULL; /* Last string we searched for */ |
| 43 | char *last_replace = NULL; /* Last replacement string */ |
| 44 | int search_last_line; /* Is this the last search line? */ |
| 45 | |
Chris Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 46 | int flags = 0; /* Our new flag containing many options */ |
David Lawrence Ramsey | f21cd10 | 2002-06-13 00:40:19 +0000 | [diff] [blame] | 47 | WINDOW *edit; /* The file portion of the editor */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 48 | WINDOW *topwin; /* Top line of screen */ |
| 49 | WINDOW *bottomwin; /* Bottom buffer */ |
Chris Allegretta | 1a6e904 | 2000-12-14 13:56:28 +0000 | [diff] [blame] | 50 | char *filename = NULL; /* Name of the file */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 51 | |
| 52 | #ifndef NANO_SMALL |
| 53 | struct stat originalfilestat; /* Stat for the file as we loaded it */ |
| 54 | #endif |
| 55 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 56 | int editwinrows = 0; /* How many rows long is the edit |
| 57 | window? */ |
| 58 | filestruct *current; /* Current buffer pointer */ |
| 59 | int current_x = 0, current_y = 0; /* Current position of X and Y in |
| 60 | the editor - relative to edit |
| 61 | window (0,0) */ |
| 62 | filestruct *fileage = NULL; /* Our file buffer */ |
| 63 | filestruct *edittop = NULL; /* Pointer to the top of the edit |
| 64 | buffer with respect to the |
| 65 | file struct */ |
| 66 | filestruct *editbot = NULL; /* Same for the bottom */ |
| 67 | filestruct *filebot = NULL; /* Last node in the file struct */ |
| 68 | filestruct *cutbuffer = NULL; /* A place to store cut text */ |
| 69 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 70 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 71 | openfilestruct *open_files = NULL; /* The list of open files */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 72 | #endif |
| 73 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 74 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 75 | #ifdef HAVE_REGEX_H |
| 76 | char *quotestr = "^([ \t]*[|>:}#])+"; |
| 77 | #else |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 78 | char *quotestr = "> "; /* Quote string */ |
| 79 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 80 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 81 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 82 | char *answer = NULL; /* Answer str to many questions */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 83 | int totlines = 0; /* Total number of lines in the file */ |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 84 | long totsize = 0; /* Total number of bytes in the file */ |
Chris Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 85 | int placewewant = 0; /* The column we'd like the cursor |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 86 | to jump to when we go to the |
| 87 | next or previous line */ |
| 88 | |
Chris Allegretta | 6d690a3 | 2000-08-03 22:51:21 +0000 | [diff] [blame] | 89 | int tabsize = 8; /* Our internal tabsize variable */ |
| 90 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 91 | char *hblank; /* A horizontal blank line */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 92 | #ifndef DISABLE_HELP |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 93 | char *help_text; /* The text in the help window */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 94 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 95 | |
| 96 | /* More stuff for the marker select */ |
| 97 | |
| 98 | filestruct *mark_beginbuf; /* the begin marker buffer */ |
| 99 | int mark_beginx; /* X value in the string to start */ |
| 100 | |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 101 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 102 | char *operating_dir = NULL; /* Operating directory, which we can't */ |
| 103 | char *full_operating_dir = NULL;/* go higher than */ |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 104 | #endif |
| 105 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 106 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 7c27be4 | 2002-05-05 23:03:54 +0000 | [diff] [blame] | 107 | char *alt_speller = NULL; /* Alternative spell command */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 108 | #endif |
| 109 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 110 | shortcut *main_list = NULL; |
| 111 | shortcut *whereis_list = NULL; |
| 112 | shortcut *replace_list = NULL; |
Chris Allegretta | 48b0670 | 2002-02-22 04:30:50 +0000 | [diff] [blame] | 113 | shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 114 | shortcut *goto_list = NULL; |
| 115 | shortcut *gotodir_list = NULL; |
| 116 | shortcut *writefile_list = NULL; |
| 117 | shortcut *insertfile_list = NULL; |
| 118 | shortcut *help_list = NULL; |
| 119 | shortcut *spell_list = NULL; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 120 | #ifndef NANO_SMALL |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 121 | shortcut *extcmd_list = NULL; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 122 | #endif |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 123 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 124 | shortcut *browser_list = NULL; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 125 | #endif |
| 126 | |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 127 | #ifdef ENABLE_COLOR |
Chris Allegretta | 08893e0 | 2001-11-29 02:42:27 +0000 | [diff] [blame] | 128 | colortype *colorstrings = NULL; |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 129 | syntaxtype *syntaxes = NULL; |
Chris Allegretta | 09900ff | 2002-05-04 04:23:30 +0000 | [diff] [blame] | 130 | char *syntaxstr = NULL; |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 131 | #endif |
| 132 | |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 133 | #if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP) |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 134 | const shortcut *currshortcut; /* Current shortcut list we're using */ |
Chris Allegretta | 6fe6149 | 2001-05-21 12:56:25 +0000 | [diff] [blame] | 135 | #endif |
Chris Allegretta | 6b58acd | 2001-04-12 03:01:53 +0000 | [diff] [blame] | 136 | |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 137 | #ifndef NANO_SMALL |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 138 | toggle *toggles = NULL; |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 139 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 140 | |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 141 | /* Regular expressions */ |
| 142 | |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 143 | #ifdef HAVE_REGEX_H |
Chris Allegretta | bd9e7c3 | 2000-10-26 01:44:42 +0000 | [diff] [blame] | 144 | regex_t search_regexp; /* Global to store compiled search regexp */ |
| 145 | regmatch_t regmatches[10]; /* Match positions for parenthetical |
| 146 | subexpressions, max of 10 */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 147 | #endif |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 148 | #ifdef ENABLE_COLOR |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 149 | regex_t color_regexp; /* Global to store compiled search regexp */ |
| 150 | regmatch_t colormatches[1]; /* Match positions for parenthetical */ |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 151 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 152 | regex_t syntaxfile_regexp; /* Global to store compiled search regexp */ |
| 153 | regmatch_t synfilematches[1]; /* Match positions for parenthetical */ |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 154 | #endif /* ENABLE_COLOR */ |
| 155 | |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 156 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 157 | int length_of_list(const shortcut *s) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 158 | { |
| 159 | int i = 0; |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 160 | for (; s != NULL; s = s->next) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 161 | i++; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 162 | return i; |
| 163 | } |
| 164 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 165 | /* Initialize a struct *without* our lovely braces =( */ |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 166 | void sc_init_one(shortcut **shortcutage, int key, const char *desc, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 167 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 168 | const char *help, |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 169 | #endif |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 170 | int alt, int misc1, int misc2, int view, int (*func) (void)) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 171 | { |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 172 | shortcut *s; |
| 173 | |
| 174 | if (*shortcutage == NULL) { |
| 175 | *shortcutage = nmalloc(sizeof(shortcut)); |
| 176 | s = *shortcutage; |
| 177 | } else { |
| 178 | for (s = *shortcutage; s->next != NULL; s = s->next) |
| 179 | ; |
| 180 | s->next = nmalloc(sizeof(shortcut)); |
| 181 | s = s->next; |
| 182 | } |
| 183 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 184 | s->val = key; |
| 185 | s->desc = desc; |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 186 | #ifndef DISABLE_HELP |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 187 | s->help = help; |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 188 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 189 | s->altval = alt; |
| 190 | s->misc1 = misc1; |
| 191 | s->misc2 = misc2; |
| 192 | s->viewok = view; |
| 193 | s->func = func; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 194 | s->next = NULL; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 195 | } |
| 196 | |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 197 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 198 | /* Create one new toggle structure, at the end of the toggles |
| 199 | * linked list. */ |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 200 | void toggle_init_one(int val, const char *desc, int flag) |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 201 | { |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 202 | toggle *u; |
| 203 | |
| 204 | if (toggles == NULL) { |
| 205 | toggles = nmalloc(sizeof(toggle)); |
| 206 | u = toggles; |
| 207 | } else { |
| 208 | for (u = toggles; u->next != NULL; u = u->next) |
| 209 | ; |
| 210 | u->next = nmalloc(sizeof(toggle)); |
| 211 | u = u->next; |
| 212 | } |
| 213 | |
| 214 | u->val = val; |
| 215 | u->desc = desc; |
| 216 | u->flag = flag; |
| 217 | u->next = NULL; |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 218 | } |
| 219 | |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 220 | void toggle_init(void) |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 221 | { |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 222 | char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg, |
| 223 | *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg, |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 224 | *toggle_cuttoend_msg, *toggle_noconvert_msg, *toggle_dos_msg, |
| 225 | *toggle_mac_msg, *toggle_backup_msg, *toggle_smooth_msg; |
| 226 | #ifndef DISABLE_WRAPPING |
| 227 | char *toggle_wrap_msg; |
| 228 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 229 | #ifdef ENABLE_MULTIBUFFER |
| 230 | char *toggle_load_msg; |
| 231 | #endif |
Chris Allegretta | 3e3ae94 | 2001-09-22 19:02:04 +0000 | [diff] [blame] | 232 | |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 233 | /* There is no need to reinitialize the toggles. They can't |
| 234 | change. In fact, reinitializing them causes a segfault in |
| 235 | nano.c:do_toggle() when it is called with the Pico-mode |
| 236 | toggle. */ |
| 237 | if (toggles != NULL) |
| 238 | return; |
| 239 | |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 240 | toggle_const_msg = _("Constant cursor position"); |
Chris Allegretta | f8163dc | 2000-09-03 01:06:40 +0000 | [diff] [blame] | 241 | toggle_autoindent_msg = _("Auto indent"); |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 242 | toggle_suspend_msg = _("Suspend"); |
Chris Allegretta | f0f63a8 | 2000-09-02 18:44:21 +0000 | [diff] [blame] | 243 | toggle_nohelp_msg = _("Help mode"); |
Chris Allegretta | bf9a8cc | 2000-11-17 01:37:39 +0000 | [diff] [blame] | 244 | toggle_picomode_msg = _("Pico mode"); |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 245 | toggle_mouse_msg = _("Mouse support"); |
| 246 | toggle_cuttoend_msg = _("Cut to end"); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 247 | toggle_noconvert_msg = _("No conversion from DOS/Mac format"); |
Chris Allegretta | 7004c28 | 2001-09-22 00:42:10 +0000 | [diff] [blame] | 248 | toggle_dos_msg = _("Writing file in DOS format"); |
Chris Allegretta | 995177f | 2001-09-22 04:34:23 +0000 | [diff] [blame] | 249 | toggle_mac_msg = _("Writing file in Mac format"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 250 | toggle_backup_msg = _("Backing up file"); |
Chris Allegretta | 3e3ae94 | 2001-09-22 19:02:04 +0000 | [diff] [blame] | 251 | toggle_smooth_msg = _("Smooth scrolling"); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 252 | #ifndef DISABLE_WRAPPING |
Chris Allegretta | f0f63a8 | 2000-09-02 18:44:21 +0000 | [diff] [blame] | 253 | toggle_wrap_msg = _("Auto wrap"); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 254 | #endif |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 255 | #ifdef ENABLE_MULTIBUFFER |
| 256 | toggle_load_msg = _("Multiple file buffers"); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 257 | #endif |
| 258 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 259 | toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE); |
| 260 | toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT); |
| 261 | toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND); |
| 262 | toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP); |
| 263 | toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 264 | #ifndef DISABLE_WRAPPING |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 265 | toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 266 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 267 | toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE); |
| 268 | toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 269 | #ifdef ENABLE_MULTIBUFFER |
| 270 | toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER); |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 271 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 272 | toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT); |
| 273 | toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE); |
| 274 | toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 275 | toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 276 | toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL); |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 277 | } |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame^] | 278 | |
| 279 | #ifdef DEBUG |
| 280 | /* Deallocate all of the toggles. */ |
| 281 | void free_toggles(void) |
| 282 | { |
| 283 | while (toggles != NULL) { |
| 284 | toggle *pt = toggles; /* Think "previous toggle" */ |
| 285 | |
| 286 | toggles = toggles->next; |
| 287 | free(pt); |
| 288 | } |
| 289 | } |
| 290 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 291 | #endif /* !NANO_SMALL */ |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 292 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 293 | /* Deallocate the given shortcut. */ |
David Lawrence Ramsey | 0341b58 | 2002-08-21 16:10:37 +0000 | [diff] [blame] | 294 | void free_shortcutage(shortcut **shortcutage) |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 295 | { |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 296 | assert(shortcutage != NULL); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 297 | while (*shortcutage != NULL) { |
| 298 | shortcut *ps = *shortcutage; |
| 299 | *shortcutage = (*shortcutage)->next; |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 300 | free(ps); |
| 301 | } |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 302 | } |
| 303 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 304 | void shortcut_init(int unjustify) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 305 | { |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 306 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 307 | char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = |
| 308 | "", *nano_goto_msg = "", *nano_justify_msg = |
| 309 | "", *nano_replace_msg = "", *nano_insert_msg = |
| 310 | "", *nano_whereis_msg = "", *nano_prevpage_msg = |
| 311 | "", *nano_nextpage_msg = "", *nano_cut_msg = |
| 312 | "", *nano_uncut_msg = "", *nano_cursorpos_msg = |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 313 | "", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg = |
| 314 | "", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg = |
| 315 | "", *nano_end_msg = "", *nano_firstline_msg = |
| 316 | "", *nano_lastline_msg = "", *nano_refresh_msg = |
| 317 | "", *nano_mark_msg = "", *nano_delete_msg = |
| 318 | "", *nano_backspace_msg = "", *nano_tab_msg = |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 319 | "", *nano_enter_msg = "", *nano_cancel_msg = |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 320 | "", *nano_unjustify_msg = "", *nano_append_msg = |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 321 | "", *nano_prepend_msg = "", *nano_tofiles_msg = |
| 322 | "", *nano_gotodir_msg = "", *nano_case_msg = |
| 323 | "", *nano_reverse_msg = "", *nano_execute_msg = |
| 324 | "", *nano_dos_msg = "", *nano_mac_msg = |
| 325 | "", *nano_backup_msg = ""; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 326 | |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 327 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame^] | 328 | char *nano_openprev_msg = "", *nano_opennext_msg = |
| 329 | "", *nano_multibuffer_msg = ""; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 330 | #endif |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 331 | #ifdef HAVE_REGEX_H |
| 332 | char *nano_regexp_msg = "", *nano_bracket_msg = ""; |
| 333 | #endif |
Chris Allegretta | 6636dc3 | 2001-01-05 05:41:07 +0000 | [diff] [blame] | 334 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 335 | nano_help_msg = _("Invoke the help menu"); |
| 336 | nano_writeout_msg = _("Write the current file to disk"); |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 337 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 338 | nano_exit_msg = _("Close currently loaded file/Exit from nano"); |
| 339 | #else |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 340 | nano_exit_msg = _("Exit from nano"); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 341 | #endif |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 342 | nano_goto_msg = _("Go to a specific line number"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 343 | nano_justify_msg = _("Justify the current paragraph"); |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 344 | nano_unjustify_msg = _("Unjustify after a justify"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 345 | nano_replace_msg = _("Replace text within the editor"); |
| 346 | nano_insert_msg = _("Insert another file into the current one"); |
| 347 | nano_whereis_msg = _("Search for text within the editor"); |
| 348 | nano_prevpage_msg = _("Move to the previous screen"); |
| 349 | nano_nextpage_msg = _("Move to the next screen"); |
| 350 | nano_cut_msg = _("Cut the current line and store it in the cutbuffer"); |
| 351 | nano_uncut_msg = _("Uncut from the cutbuffer into the current line"); |
Chris Allegretta | 88520c9 | 2001-05-05 17:45:54 +0000 | [diff] [blame] | 352 | nano_cursorpos_msg = _("Show the position of the cursor"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 353 | nano_spell_msg = _("Invoke the spell checker, if available"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 354 | nano_up_msg = _("Move up one line"); |
| 355 | nano_down_msg = _("Move down one line"); |
| 356 | nano_forward_msg = _("Move forward one character"); |
| 357 | nano_back_msg = _("Move back one character"); |
| 358 | nano_home_msg = _("Move to the beginning of the current line"); |
| 359 | nano_end_msg = _("Move to the end of the current line"); |
| 360 | nano_firstline_msg = _("Go to the first line of the file"); |
| 361 | nano_lastline_msg = _("Go to the last line of the file"); |
| 362 | nano_refresh_msg = _("Refresh (redraw) the current screen"); |
| 363 | nano_mark_msg = _("Mark text at the current cursor location"); |
| 364 | nano_delete_msg = _("Delete the character under the cursor"); |
| 365 | nano_backspace_msg = |
| 366 | _("Delete the character to the left of the cursor"); |
| 367 | nano_tab_msg = _("Insert a tab character"); |
| 368 | nano_enter_msg = _("Insert a carriage return at the cursor position"); |
| 369 | nano_case_msg = |
| 370 | _("Make the current search or replace case (in)sensitive"); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 371 | nano_tofiles_msg = _("Go to file browser"); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 372 | nano_execute_msg = _("Execute external command"); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 373 | nano_gotodir_msg = _("Go to directory"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 374 | nano_cancel_msg = _("Cancel the current function"); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 375 | nano_append_msg = _("Append to the current file"); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 376 | nano_prepend_msg = _("Prepend to the current file"); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 377 | nano_reverse_msg = _("Search backwards"); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 378 | nano_dos_msg = _("Write file out in DOS format"); |
| 379 | nano_mac_msg = _("Write file out in Mac format"); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 380 | nano_backup_msg = _("Back up original file when saving"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 381 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 382 | nano_regexp_msg = _("Use regular expressions"); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 383 | nano_bracket_msg = _("Find other bracket"); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 384 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 385 | #ifdef ENABLE_MULTIBUFFER |
| 386 | nano_openprev_msg = _("Open previously loaded file"); |
| 387 | nano_opennext_msg = _("Open next loaded file"); |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 388 | nano_multibuffer_msg = _("Toggle insert into new buffer"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 389 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 390 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 391 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 392 | free_shortcutage(&main_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 393 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 394 | /* The following macro is to be used in calling sc_init_one. The point is |
| 395 | * that sc_init_one takes 9 arguments, unless DISABLE_HELP is defined, |
| 396 | * when the fourth one should not be there. */ |
| 397 | #ifdef DISABLE_HELP |
| 398 | # define IFHELP(help, nextvar) nextvar |
| 399 | #else |
| 400 | # define IFHELP(help, nextvar) help, nextvar |
| 401 | #endif |
| 402 | |
| 403 | sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 404 | IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 405 | do_help); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 406 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 407 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 408 | if (open_files != NULL && (open_files->prev || open_files->next)) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 409 | sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 410 | IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 411 | do_exit); |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 412 | else |
| 413 | #endif |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 414 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 415 | sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 416 | IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 417 | do_exit); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 418 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 419 | sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 420 | IFHELP(nano_writeout_msg, 0), |
| 421 | NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 422 | |
Chris Allegretta | bf9a8cc | 2000-11-17 01:37:39 +0000 | [diff] [blame] | 423 | if (ISSET(PICO_MODE)) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 424 | sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 425 | IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0, |
Chris Allegretta | 16e4168 | 2000-09-11 22:33:54 +0000 | [diff] [blame] | 426 | NOVIEW, do_justify); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 427 | else |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 428 | |
| 429 | #ifdef ENABLE_MULTIBUFFER |
| 430 | /* this is so we can view multiple files */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 431 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 432 | IFHELP(nano_insert_msg, 0), |
| 433 | NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 434 | #else |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 435 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 436 | IFHELP(nano_insert_msg, 0), |
| 437 | NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 438 | #endif |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 439 | |
| 440 | if (ISSET(PICO_MODE)) |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 441 | #ifdef ENABLE_MULTIBUFFER |
| 442 | /* this is so we can view multiple files */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 443 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 444 | IFHELP(nano_insert_msg, 0), |
| 445 | NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 446 | #else |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 447 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 448 | IFHELP(nano_insert_msg, 0), |
| 449 | NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 450 | #endif |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 451 | else |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 452 | sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 453 | IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), |
| 454 | NANO_REPLACE_FKEY, 0, NOVIEW, do_replace); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 455 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 456 | sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 457 | IFHELP(nano_whereis_msg, 0), |
| 458 | NANO_WHEREIS_FKEY, 0, VIEW, do_search); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 459 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 460 | sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 461 | IFHELP(nano_prevpage_msg, 0), |
| 462 | NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 463 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 464 | sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 465 | IFHELP(nano_nextpage_msg, 0), |
| 466 | NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 467 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 468 | sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 469 | IFHELP(nano_cut_msg, 0), |
| 470 | NANO_CUT_FKEY, 0, NOVIEW, do_cut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 471 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 472 | if (unjustify) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 473 | sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 474 | IFHELP(nano_unjustify_msg, 0), |
| 475 | 0, 0, NOVIEW, do_uncut_text); |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 476 | else |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 477 | sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 478 | IFHELP(nano_uncut_msg, 0), |
| 479 | NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 480 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 481 | sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 482 | IFHELP(nano_cursorpos_msg, 0), |
| 483 | NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 484 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 485 | sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 486 | IFHELP(nano_spell_msg, 0), |
| 487 | NANO_SPELL_FKEY, 0, NOVIEW, do_spell); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 488 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 489 | sc_init_one(&main_list, NANO_UP_KEY, _("Up"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 490 | IFHELP(nano_up_msg, 0), |
| 491 | KEY_UP, 0, VIEW, do_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 492 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 493 | sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 494 | IFHELP(nano_down_msg, 0), |
| 495 | KEY_DOWN, 0, VIEW, do_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 496 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 497 | sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 498 | IFHELP(nano_forward_msg, 0), |
| 499 | KEY_RIGHT, 0, VIEW, do_right); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 500 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 501 | sc_init_one(&main_list, NANO_BACK_KEY, _("Back"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 502 | IFHELP(nano_back_msg, 0), |
| 503 | KEY_LEFT, 0, VIEW, do_left); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 504 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 505 | sc_init_one(&main_list, NANO_HOME_KEY, _("Home"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 506 | IFHELP(nano_home_msg, 0), |
| 507 | KEY_HOME, 362, VIEW, do_home); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 508 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 509 | sc_init_one(&main_list, NANO_END_KEY, _("End"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 510 | IFHELP(nano_end_msg, 0), |
| 511 | KEY_END, 385, VIEW, do_end); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 512 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 513 | sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 514 | IFHELP(nano_refresh_msg, 0), |
| 515 | 0, 0, VIEW, total_refresh); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 516 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 517 | sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 518 | IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY), |
| 519 | 0, 0, NOVIEW, do_mark); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 520 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 521 | sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 522 | IFHELP(nano_delete_msg, 0), KEY_DC, |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 523 | NANO_CONTROL_D, NOVIEW, do_delete); |
| 524 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 525 | sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 526 | IFHELP(nano_backspace_msg, 0), |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 527 | KEY_BACKSPACE, 127, NOVIEW, do_backspace); |
| 528 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 529 | sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 530 | IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 531 | |
Chris Allegretta | bf9a8cc | 2000-11-17 01:37:39 +0000 | [diff] [blame] | 532 | if (ISSET(PICO_MODE)) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 533 | sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 534 | IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), |
| 535 | NANO_REPLACE_FKEY, 0, NOVIEW, do_replace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 536 | else |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 537 | sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 538 | IFHELP(nano_justify_msg, 0), |
| 539 | NANO_JUSTIFY_FKEY, 0, NOVIEW, do_justify); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 540 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 541 | sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 542 | IFHELP(nano_enter_msg, 0), |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 543 | KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 544 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 545 | sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 546 | IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), |
| 547 | NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 548 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 549 | #ifndef NANO_SMALL |
| 550 | sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"), |
| 551 | IFHELP(_("Move forward one word"), 0), |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 552 | 0, 0, VIEW, do_next_word); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 553 | |
| 554 | sc_init_one(&main_list, -9, _("Prev Word"), |
| 555 | IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0, |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 556 | VIEW, do_prev_word); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 557 | #endif |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 558 | #if !defined(NANO_SMALL) && defined(HAVE_REGEX_H) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 559 | sc_init_one(&main_list, -9, _("Find Other Bracket"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 560 | IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), |
| 561 | 0, 0, VIEW, do_find_bracket); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 562 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 563 | #ifdef ENABLE_MULTIBUFFER |
| 564 | sc_init_one(&main_list, -9, _("Previous File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 565 | IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), |
| 566 | 0, 0, VIEW, open_prevfile_void); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 567 | sc_init_one(&main_list, -9, _("Next File"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 568 | IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), |
| 569 | 0, 0, VIEW, open_nextfile_void); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 570 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 571 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 572 | free_shortcutage(&whereis_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 573 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 574 | sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"), |
| 575 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 576 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 577 | sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"), |
| 578 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 579 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 580 | sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 581 | IFHELP(nano_firstline_msg, 0), |
| 582 | 0, 0, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 583 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 584 | sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 585 | IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 586 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 587 | sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 588 | IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 589 | |
Chris Allegretta | d865da1 | 2002-07-29 23:46:38 +0000 | [diff] [blame] | 590 | sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 591 | IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 592 | |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 593 | #ifndef NANO_SMALL |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 594 | sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 595 | IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 596 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 597 | sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 598 | IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 599 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 600 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 601 | sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"), |
| 602 | IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 603 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 604 | #endif /* !NANO_SMALL */ |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 605 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 606 | free_shortcutage(&replace_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 607 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 608 | sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"), |
| 609 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 610 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 611 | sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"), |
| 612 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 613 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 614 | sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 615 | IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 616 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 617 | sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 618 | IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 619 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 620 | sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 621 | IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 622 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 623 | sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 624 | IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 625 | |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 626 | #ifndef NANO_SMALL |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 627 | sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 628 | IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 629 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 630 | sc_init_one(&replace_list, TOGGLE_BACKWARDS_KEY, _("Direction"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 631 | IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 632 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 633 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 634 | sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"), |
| 635 | IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 636 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 637 | #endif /* !NANO_SMALL */ |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 638 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 639 | free_shortcutage(&replace_list_2); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 640 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 641 | sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"), |
| 642 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 643 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 644 | sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"), |
| 645 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 646 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 647 | sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 648 | IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 649 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 650 | sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 651 | IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 652 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 653 | free_shortcutage(&goto_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 654 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 655 | sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"), |
| 656 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 657 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 658 | sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 659 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 660 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 661 | sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"), |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 662 | IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 663 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 664 | sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"), |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 665 | IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 666 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 667 | free_shortcutage(&help_list); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 668 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 669 | sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 670 | IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY, |
| 671 | KEY_PPAGE, VIEW, do_page_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 672 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 673 | sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 674 | IFHELP(nano_nextpage_msg, 0), |
| 675 | NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 676 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 677 | sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 678 | IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW, |
| 679 | do_exit); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 680 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 681 | free_shortcutage(&writefile_list); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 682 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 683 | sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"), |
| 684 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 685 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 686 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 687 | sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 688 | IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 689 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 690 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 691 | #ifndef NANO_SMALL |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 692 | sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"), |
| 693 | IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 694 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 695 | sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"), |
| 696 | IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 697 | #endif |
| 698 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 699 | sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"), |
| 700 | IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 701 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 702 | sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"), |
| 703 | IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 704 | |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 705 | #ifndef NANO_SMALL |
| 706 | sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"), |
| 707 | IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0); |
| 708 | #endif |
| 709 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 710 | sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"), |
| 711 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 712 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 713 | free_shortcutage(&insertfile_list); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 714 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 715 | sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"), |
| 716 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 717 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 718 | sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 719 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 720 | |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 721 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 722 | sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 723 | IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 724 | #endif |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 725 | #ifndef NANO_SMALL |
| 726 | sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 727 | IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 728 | #endif |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 729 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame^] | 730 | sc_init_one(&insertfile_list, NANO_LOAD_KEY, _("New Buffer"), |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 731 | IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0); |
| 732 | #endif |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 733 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 734 | free_shortcutage(&spell_list); |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 735 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 736 | sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"), |
| 737 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 738 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 739 | sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 740 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 741 | |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 742 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 743 | free_shortcutage(&extcmd_list); |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 744 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 745 | sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"), |
| 746 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 747 | |
| 748 | sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 749 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 750 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 751 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 752 | #ifndef DISABLE_BROWSER |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 753 | free_shortcutage(&browser_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 754 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 755 | sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"), |
| 756 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 757 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 758 | sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"), |
| 759 | IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 760 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 761 | sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 762 | IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY, |
| 763 | KEY_PPAGE, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 764 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 765 | sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 766 | IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY, |
| 767 | KEY_NPAGE, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 768 | |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 769 | sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 770 | IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), |
| 771 | NANO_GOTO_FKEY, 0, VIEW, 0); |
Rocco Corsi | 12f294c | 2001-04-14 06:50:24 +0000 | [diff] [blame] | 772 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 773 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 774 | |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 775 | sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"), |
| 776 | IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 777 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 778 | sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"), |
Chris Allegretta | 6fe98d7 | 2002-05-16 23:30:14 +0000 | [diff] [blame] | 779 | IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 780 | #endif |
| 781 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 782 | #if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP) |
| 783 | currshortcut = main_list; |
| 784 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 785 | #ifndef NANO_SMALL |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 786 | toggle_init(); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 787 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 788 | } |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 789 | |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 790 | /* This function is called just before calling exit(). Practically, the |
| 791 | * only effect is to cause a segmentation fault if the various data |
| 792 | * structures got bolloxed earlier. Thus, we don't bother having this |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 793 | * function unless debugging is turned on. */ |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 794 | #ifdef DEBUG |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 795 | /* added by SPK for memory cleanup, gracefully return our malloc()s */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 796 | void thanks_for_all_the_fish(void) |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 797 | { |
Chris Allegretta | 2598c66 | 2002-03-28 01:59:34 +0000 | [diff] [blame] | 798 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 799 | if (operating_dir != NULL) |
| 800 | free(operating_dir); |
| 801 | if (full_operating_dir != NULL) |
| 802 | free(full_operating_dir); |
| 803 | #endif |
| 804 | if (last_search != NULL) |
| 805 | free(last_search); |
| 806 | if (last_replace != NULL) |
| 807 | free(last_replace); |
| 808 | if (hblank != NULL) |
| 809 | free(hblank); |
| 810 | #ifndef DISABLE_SPELLER |
| 811 | if (alt_speller != NULL) |
| 812 | free(alt_speller); |
| 813 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame^] | 814 | #ifndef DISABLE_HELP |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 815 | if (help_text != NULL) |
| 816 | free(help_text); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame^] | 817 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 818 | if (filename != NULL) |
| 819 | free(filename); |
| 820 | if (answer != NULL) |
| 821 | free(answer); |
| 822 | if (cutbuffer != NULL) |
| 823 | free_filestruct(cutbuffer); |
| 824 | |
| 825 | free_shortcutage(&main_list); |
| 826 | free_shortcutage(&whereis_list); |
| 827 | free_shortcutage(&replace_list); |
| 828 | free_shortcutage(&replace_list_2); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 829 | free_shortcutage(&goto_list); |
| 830 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 831 | free_shortcutage(&writefile_list); |
| 832 | free_shortcutage(&insertfile_list); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 833 | free_shortcutage(&help_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 834 | free_shortcutage(&spell_list); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 835 | #ifndef NANO_SMALL |
| 836 | free_shortcutage(&extcmd_list); |
| 837 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 838 | #ifndef DISABLE_BROWSER |
| 839 | free_shortcutage(&browser_list); |
| 840 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 841 | |
| 842 | #ifndef NANO_SMALL |
| 843 | free_toggles(); |
| 844 | #endif |
| 845 | |
| 846 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 847 | if (open_files != NULL) { |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 848 | /* We free the memory associated with each open file. */ |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 849 | while (open_files->prev != NULL) |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 850 | open_files = open_files->prev; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 851 | free_openfilestruct(open_files); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 852 | } |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 853 | #else |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 854 | if (fileage != NULL) |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 855 | free_filestruct(fileage); |
| 856 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 857 | |
| 858 | #ifdef ENABLE_COLOR |
| 859 | free(syntaxstr); |
| 860 | while (syntaxes != NULL) { |
| 861 | syntaxtype *bill = syntaxes; |
| 862 | |
| 863 | free(syntaxes->desc); |
| 864 | while (syntaxes->extensions != NULL) { |
| 865 | exttype *bob = syntaxes->extensions; |
| 866 | |
| 867 | syntaxes->extensions = bob->next; |
| 868 | free(bob->val); |
| 869 | free(bob); |
| 870 | } |
| 871 | while (syntaxes->color != NULL) { |
| 872 | colortype *bob = syntaxes->color; |
| 873 | |
| 874 | syntaxes->color = bob->next; |
| 875 | free(bob->start); |
| 876 | free(bob->end); |
| 877 | free(bob); |
| 878 | } |
| 879 | syntaxes = syntaxes->next; |
| 880 | free(bill); |
| 881 | } |
| 882 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 883 | } |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 884 | #endif /* DEBUG */ |