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 | 315eb32 | 2005-11-28 19:35:29 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2004 Chris Allegretta * |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 6 | * Copyright (C) 2005-2006 David Lawrence Ramsey * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
Chris Allegretta | 3a24f3f | 2001-10-24 11:33:54 +0000 | [diff] [blame] | 9 | * the Free Software Foundation; either version 2, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 10 | * any later version. * |
| 11 | * * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 12 | * This program is distributed in the hope that it will be useful, but * |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 15 | * General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the Free Software * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * |
| 20 | * 02110-1301, USA. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 21 | * * |
| 22 | **************************************************************************/ |
| 23 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 24 | #include "proto.h" |
| 25 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 26 | /* Global variables */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 27 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 28 | ssize_t fill = 0; |
| 29 | /* The column where we will wrap lines. */ |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 30 | ssize_t wrap_at = -CHARS_FROM_EOL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 31 | /* The position where we will wrap lines. fill is equal to this |
| 32 | * if it's greater than zero, and equal to (COLS + this) if it |
| 33 | * isn't. */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 34 | #endif |
| 35 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 36 | char *last_search = NULL; |
| 37 | /* The last string we searched for. */ |
| 38 | char *last_replace = NULL; |
| 39 | /* The last replacement string we searched for. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 40 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 41 | long flags = 0; |
| 42 | /* Our flag containing the states of all global options. */ |
| 43 | WINDOW *topwin; |
| 44 | /* The top portion of the window, where we display the version |
| 45 | * number of nano, the name of the current file, and whether the |
| 46 | * current file has been modified. */ |
| 47 | WINDOW *edit; |
| 48 | /* The middle portion of the window, i.e, the edit window, where |
| 49 | * we display the current file we're editing. */ |
| 50 | WINDOW *bottomwin; |
| 51 | /* The bottom portion of the window, where we display statusbar |
| 52 | * messages, the statusbar prompt, and a list of shortcuts. */ |
| 53 | int editwinrows = 0; |
| 54 | /* How many rows does the edit window take up? */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 55 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 56 | filestruct *cutbuffer = NULL; |
| 57 | /* The buffer where we store cut text. */ |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 58 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 59 | filestruct *jusbuffer = NULL; |
| 60 | /* The buffer where we store unjustified text. */ |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 61 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 62 | partition *filepart = NULL; |
| 63 | /* The partition where we store a portion of the current |
| 64 | * file. */ |
David Lawrence Ramsey | 64661ac | 2005-07-08 19:57:25 +0000 | [diff] [blame] | 65 | openfilestruct *openfile = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 66 | /* The list of all open file buffers. */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 67 | |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 68 | #ifndef NANO_TINY |
| 69 | char *matchbrackets = NULL; |
| 70 | /* The opening and closing brackets that can be found by bracket |
| 71 | * searches. */ |
| 72 | #endif |
| 73 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 74 | #if !defined(NANO_TINY) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 75 | char *whitespace = NULL; |
| 76 | /* The characters used when displaying the first characters of |
| 77 | * tabs and spaces. */ |
| 78 | int whitespace_len[2]; |
| 79 | /* The length of these characters. */ |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 80 | #endif |
| 81 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 82 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 83 | char *punct = NULL; |
| 84 | /* The closing punctuation that can end sentences. */ |
| 85 | char *brackets = NULL; |
| 86 | /* The closing brackets that can follow closing punctuation and |
| 87 | * can end sentences. */ |
| 88 | char *quotestr = NULL; |
| 89 | /* The quoting string. The default value is set in main(). */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 90 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 91 | regex_t quotereg; |
| 92 | /* The compiled regular expression from the quoting string. */ |
| 93 | int quoterc; |
| 94 | /* Whether it actually compiled. */ |
| 95 | char *quoteerr = NULL; |
| 96 | /* The error message, if it didn't. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 97 | #else |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 98 | size_t quotelen; |
| 99 | /* The length of the quoting string in bytes. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 100 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 101 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 102 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 103 | char *answer = NULL; |
| 104 | /* The answer string used in the statusbar prompt. */ |
| 105 | |
| 106 | ssize_t tabsize = -1; |
| 107 | /* The width of a tab in spaces. The default value is set in |
| 108 | * main(). */ |
| 109 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 110 | #ifndef NANO_TINY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 111 | char *backup_dir = NULL; |
| 112 | /* The directory where we store backup files. */ |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 113 | #endif |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 114 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 115 | char *operating_dir = NULL; |
| 116 | /* The relative path to the operating directory, which we can't |
| 117 | * move outside of. */ |
| 118 | char *full_operating_dir = NULL; |
| 119 | /* The full path to it. */ |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 120 | #endif |
| 121 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 122 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 123 | char *alt_speller = NULL; |
| 124 | /* The command to use for the alternate spell checker. */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 125 | #endif |
| 126 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 127 | shortcut *main_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 128 | /* The main shortcut list. */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 129 | shortcut *whereis_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 130 | /* The "Search" shortcut list. */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 131 | shortcut *replace_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 132 | /* The "Search (to replace)" shortcut list. */ |
| 133 | shortcut *replace_list_2 = NULL; |
| 134 | /* The "Replace with" shortcut list. */ |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 135 | shortcut *gotoline_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 136 | /* The "Enter line number, column number" shortcut list. */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 137 | shortcut *writefile_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 138 | /* The "File Name to Write" shortcut list. */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 139 | shortcut *insertfile_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 140 | /* The "File to insert" shortcut list. */ |
| 141 | #ifndef NANO_TINY |
| 142 | shortcut *extcmd_list = NULL; |
| 143 | /* The "Command to execute" shortcut list. */ |
| 144 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 145 | #ifndef DISABLE_HELP |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 146 | shortcut *help_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 147 | /* The help text shortcut list. */ |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 148 | #endif |
| 149 | #ifndef DISABLE_SPELLER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 150 | shortcut *spell_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 151 | /* The internal spell checker shortcut list. */ |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 152 | #endif |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 153 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 154 | shortcut *browser_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 155 | /* The file browser shortcut list. */ |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 156 | shortcut *whereis_file_list = NULL; |
| 157 | /* The file browser "Search" shortcut list. */ |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 158 | shortcut *gotodir_list = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 159 | /* The "Go To Directory" shortcut list. */ |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 160 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 161 | |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 162 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 163 | syntaxtype *syntaxes = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 164 | /* The global list of color syntaxes. */ |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 165 | char *syntaxstr = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 166 | /* The color syntax name specified on the command line. */ |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 167 | #endif |
| 168 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 169 | const shortcut *currshortcut; |
| 170 | /* The current shortcut list we're using. */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 171 | #ifndef NANO_TINY |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 172 | toggle *toggles = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 173 | /* The global toggle list. */ |
Chris Allegretta | f0b26df | 2001-01-20 22:18:18 +0000 | [diff] [blame] | 174 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 175 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 176 | #ifndef NANO_TINY |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 177 | filestruct *search_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 178 | /* The search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 179 | filestruct *searchage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 180 | /* The top of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 181 | filestruct *searchbot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 182 | /* The bottom of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 183 | filestruct *replace_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 184 | /* The replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 185 | filestruct *replaceage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 186 | /* The top of the replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 187 | filestruct *replacebot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 188 | /* The bottom of the replace string history list. */ |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 189 | #endif |
| 190 | |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 191 | /* Regular expressions */ |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 192 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 193 | regex_t search_regexp; |
| 194 | /* The compiled regular expression to use in searches. */ |
| 195 | regmatch_t regmatches[10]; |
| 196 | /* The match positions for parenthetical subexpressions, 10 |
| 197 | * maximum, used in regular expression searches. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 198 | #endif |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 199 | |
David Lawrence Ramsey | 4d72de7 | 2006-04-12 15:27:40 +0000 | [diff] [blame] | 200 | int reverse_attr = A_REVERSE; |
| 201 | /* The curses attribute we use for reverse video. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 202 | bool curses_ended = FALSE; |
| 203 | /* Whether endwin() has ended curses mode and statusbar() |
| 204 | * should hence write to stderr instead of displaying on the |
| 205 | * statusbar. */ |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 206 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 207 | char *homedir = NULL; |
| 208 | /* The user's home directory, from $HOME or |
| 209 | * /etc/passwd. */ |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 210 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 211 | /* Return the number of entries in the shortcut list s. */ |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 212 | size_t length_of_list(const shortcut *s) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 213 | { |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 214 | size_t i = 0; |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 215 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 216 | for (; s != NULL; s = s->next) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 217 | i++; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 218 | return i; |
| 219 | } |
| 220 | |
David Lawrence Ramsey | a549a82 | 2005-07-01 23:11:52 +0000 | [diff] [blame] | 221 | /* Create a new shortcut structure, at the end of the shortcuts linked |
| 222 | * list. */ |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 223 | void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc, |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 224 | #ifndef DISABLE_HELP |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 225 | const char *help, |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 226 | #endif |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 227 | int metaval, int funcval, int miscval, bool view, void |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 228 | (*func)(void)) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 229 | { |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 230 | shortcut *s; |
| 231 | |
| 232 | if (*shortcutage == NULL) { |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 233 | *shortcutage = (shortcut *)nmalloc(sizeof(shortcut)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 234 | s = *shortcutage; |
| 235 | } else { |
| 236 | for (s = *shortcutage; s->next != NULL; s = s->next) |
| 237 | ; |
David Lawrence Ramsey | 70047ee | 2003-06-14 20:41:34 +0000 | [diff] [blame] | 238 | s->next = (shortcut *)nmalloc(sizeof(shortcut)); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 239 | s = s->next; |
| 240 | } |
| 241 | |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 242 | s->ctrlval = ctrlval; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 243 | s->desc = _(desc); |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 244 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 245 | s->help = _(help); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 246 | #endif |
David Lawrence Ramsey | 1576d53 | 2004-03-19 21:46:34 +0000 | [diff] [blame] | 247 | s->metaval = metaval; |
| 248 | s->funcval = funcval; |
| 249 | s->miscval = miscval; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 250 | s->viewok = view; |
| 251 | s->func = func; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 252 | s->next = NULL; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 253 | } |
| 254 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 255 | /* Initialize all shortcut lists. If unjustify is TRUE, replace the |
| 256 | * Uncut shortcut in the main shortcut list with UnJustify. */ |
David Lawrence Ramsey | 1f1ebb8 | 2004-11-11 21:50:01 +0000 | [diff] [blame] | 257 | void shortcut_init(bool unjustify) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 258 | { |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 259 | /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */ |
David Lawrence Ramsey | 12c08dd | 2006-03-25 15:56:40 +0000 | [diff] [blame] | 260 | const char *cancel_msg = N_("Cancel"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 261 | const char *get_help_msg = N_("Get Help"); |
| 262 | const char *exit_msg = N_("Exit"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 263 | const char *whereis_msg = N_("Where Is"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 264 | const char *prev_page_msg = N_("Prev Page"); |
| 265 | const char *next_page_msg = N_("Next Page"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 266 | const char *go_to_line_msg = N_("Go To Line"); |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 267 | /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */ |
David Lawrence Ramsey | 12c08dd | 2006-03-25 15:56:40 +0000 | [diff] [blame] | 268 | const char *replace_msg = N_("Replace"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 269 | #ifndef NANO_TINY |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 270 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 271 | const char *whereis_next_msg = N_("Where Is Next"); |
| 272 | #endif |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 273 | /* TRANSLATORS: Try to keep this and following strings at most 10 characters. */ |
David Lawrence Ramsey | 12c08dd | 2006-03-25 15:56:40 +0000 | [diff] [blame] | 274 | const char *refresh_msg = N_("Refresh"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 275 | const char *first_line_msg = N_("First Line"); |
| 276 | const char *last_line_msg = N_("Last Line"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 277 | #ifndef NANO_TINY |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 278 | const char *cut_till_end_msg = N_("CutTillEnd"); |
| 279 | #endif |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 280 | #ifndef DISABLE_JUSTIFY |
| 281 | const char *beg_of_par_msg = N_("Beg of Par"); |
| 282 | const char *end_of_par_msg = N_("End of Par"); |
| 283 | const char *fulljstify_msg = N_("FullJstify"); |
| 284 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 285 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 286 | const char *case_sens_msg = N_("Case Sens"); |
David Lawrence Ramsey | f3ecffd | 2005-06-16 18:48:30 +0000 | [diff] [blame] | 287 | const char *backwards_msg = N_("Backwards"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 288 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 289 | #ifdef HAVE_REGEX_H |
| 290 | const char *regexp_msg = N_("Regexp"); |
| 291 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 292 | #ifndef NANO_TINY |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 293 | /* TRANSLATORS: Try to keep this and previous strings at most 10 characters. */ |
David Lawrence Ramsey | 5e73eec | 2005-05-03 20:57:13 +0000 | [diff] [blame] | 294 | const char *history_msg = N_("History"); |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 295 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | af318aa | 2006-04-12 12:54:23 +0000 | [diff] [blame] | 296 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 04a8d1c | 2004-09-28 22:14:58 +0000 | [diff] [blame] | 297 | const char *new_buffer_msg = N_("New Buffer"); |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 298 | #endif |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 299 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 300 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | b61dc89 | 2006-04-15 17:21:52 +0000 | [diff] [blame^] | 301 | /* TRANSLATORS: Try to keep this and following strings at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 302 | const char *to_files_msg = N_("To Files"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 303 | const char *first_file_msg = N_("First File"); |
David Lawrence Ramsey | b61dc89 | 2006-04-15 17:21:52 +0000 | [diff] [blame^] | 304 | /* TRANSLATORS: Try to keep this and previous strings at most 16 characters. */ |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 305 | const char *last_file_msg = N_("Last File"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 306 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 307 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 308 | const char *nano_cancel_msg = N_("Cancel the current function"); |
David Lawrence Ramsey | 57c9afb | 2006-04-14 20:21:45 +0000 | [diff] [blame] | 309 | const char *nano_help_msg = N_("Display this help text"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 310 | const char *nano_exit_msg = |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 311 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 95f7a74 | 2005-06-16 03:11:39 +0000 | [diff] [blame] | 312 | N_("Close the current file buffer/Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 313 | #else |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 314 | N_("Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 315 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 316 | ; |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 317 | const char *nano_writeout_msg = |
| 318 | N_("Write the current file to disk"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 319 | const char *nano_justify_msg = N_("Justify the current paragraph"); |
| 320 | const char *nano_insert_msg = |
| 321 | N_("Insert another file into the current one"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 322 | const char *nano_whereis_msg = |
| 323 | N_("Search for text within the editor"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 324 | const char *nano_prevpage_msg = N_("Move to the previous screen"); |
| 325 | const char *nano_nextpage_msg = N_("Move to the next screen"); |
| 326 | const char *nano_cut_msg = |
| 327 | N_("Cut the current line and store it in the cutbuffer"); |
| 328 | const char *nano_uncut_msg = |
| 329 | N_("Uncut from the cutbuffer into the current line"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 330 | const char *nano_cursorpos_msg = |
David Lawrence Ramsey | f50bd4b | 2006-04-14 20:15:44 +0000 | [diff] [blame] | 331 | N_("Display the position of the cursor"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 332 | const char *nano_spell_msg = |
| 333 | N_("Invoke the spell checker, if available"); |
David Lawrence Ramsey | 16349c9 | 2005-07-11 20:50:43 +0000 | [diff] [blame] | 334 | const char *nano_gotoline_msg = N_("Go to line and column number"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 335 | const char *nano_replace_msg = N_("Replace text within the editor"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 336 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 337 | const char *nano_mark_msg = N_("Mark text at the cursor position"); |
| 338 | const char *nano_whereis_next_msg = N_("Repeat last search"); |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 339 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 340 | const char *nano_prevline_msg = N_("Move to the previous line"); |
| 341 | const char *nano_nextline_msg = N_("Move to the next line"); |
| 342 | const char *nano_forward_msg = N_("Move forward one character"); |
| 343 | const char *nano_back_msg = N_("Move back one character"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 344 | const char *nano_home_msg = |
| 345 | N_("Move to the beginning of the current line"); |
| 346 | const char *nano_end_msg = |
| 347 | N_("Move to the end of the current line"); |
| 348 | const char *nano_refresh_msg = |
| 349 | N_("Refresh (redraw) the current screen"); |
| 350 | const char *nano_delete_msg = |
| 351 | N_("Delete the character under the cursor"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 352 | const char *nano_backspace_msg = |
| 353 | N_("Delete the character to the left of the cursor"); |
David Lawrence Ramsey | e7c4168 | 2004-10-23 14:53:07 +0000 | [diff] [blame] | 354 | const char *nano_tab_msg = |
| 355 | N_("Insert a tab character at the cursor position"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 356 | const char *nano_enter_msg = |
| 357 | N_("Insert a carriage return at the cursor position"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 358 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 359 | const char *nano_nextword_msg = N_("Move forward one word"); |
| 360 | const char *nano_prevword_msg = N_("Move backward one word"); |
David Lawrence Ramsey | e010edd | 2005-06-12 22:31:03 +0000 | [diff] [blame] | 361 | const char *nano_wordcount_msg = |
David Lawrence Ramsey | 7293685 | 2005-07-25 03:47:08 +0000 | [diff] [blame] | 362 | N_("Count the number of words, lines, and characters"); |
David Lawrence Ramsey | ae9eea7 | 2005-11-10 07:40:55 +0000 | [diff] [blame] | 363 | const char *nano_scrollup_msg = |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 364 | N_("Scroll up one line without scrolling the cursor"); |
David Lawrence Ramsey | ae9eea7 | 2005-11-10 07:40:55 +0000 | [diff] [blame] | 365 | const char *nano_scrolldown_msg = |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 366 | N_("Scroll down one line without scrolling the cursor"); |
David Lawrence Ramsey | 00d7798 | 2004-08-07 21:27:37 +0000 | [diff] [blame] | 367 | #endif |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 368 | #ifndef DISABLE_JUSTIFY |
| 369 | const char *nano_parabegin_msg = |
| 370 | N_("Go to the beginning of the current paragraph"); |
| 371 | const char *nano_paraend_msg = |
| 372 | N_("Go to the end of the current paragraph"); |
| 373 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 374 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 375 | const char *nano_prevfile_msg = |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 376 | N_("Switch to the previous file buffer"); |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 377 | const char *nano_nextfile_msg = |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 378 | N_("Switch to the next file buffer"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 379 | #endif |
| 380 | const char *nano_verbatim_msg = N_("Insert character(s) verbatim"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 381 | #ifndef NANO_TINY |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 382 | const char *nano_cut_till_end_msg = |
| 383 | N_("Cut from the cursor position to the end of the file"); |
| 384 | #endif |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 385 | #ifndef DISABLE_JUSTIFY |
| 386 | const char *nano_fulljustify_msg = N_("Justify the entire file"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 387 | #endif |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 388 | #ifndef NANO_TINY |
David Lawrence Ramsey | 29fb951 | 2005-11-16 07:35:01 +0000 | [diff] [blame] | 389 | const char *nano_bracket_msg = N_("Find matching bracket"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 390 | #endif |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 391 | const char *nano_firstline_msg = |
| 392 | N_("Go to the first line of the file"); |
| 393 | const char *nano_lastline_msg = |
| 394 | N_("Go to the last line of the file"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 395 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 396 | const char *nano_case_msg = |
| 397 | N_("Make the current search/replace case (in)sensitive"); |
| 398 | const char *nano_reverse_msg = |
| 399 | N_("Make the current search/replace go backwards"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 400 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 401 | #ifdef HAVE_REGEX_H |
| 402 | const char *nano_regexp_msg = N_("Use regular expressions"); |
| 403 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 404 | #ifndef NANO_TINY |
David Lawrence Ramsey | 5e73eec | 2005-05-03 20:57:13 +0000 | [diff] [blame] | 405 | const char *nano_history_msg = |
| 406 | N_("Edit the previous search/replace strings"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 407 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 408 | #ifndef DISABLE_BROWSER |
| 409 | const char *nano_tofiles_msg = N_("Go to file browser"); |
| 410 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 411 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 412 | const char *nano_dos_msg = N_("Write file out in DOS format"); |
| 413 | const char *nano_mac_msg = N_("Write file out in Mac format"); |
| 414 | #endif |
| 415 | const char *nano_append_msg = N_("Append to the current file"); |
| 416 | const char *nano_prepend_msg = N_("Prepend to the current file"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 417 | #ifndef NANO_TINY |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 418 | const char *nano_backup_msg = |
| 419 | N_("Back up original file when saving"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 420 | const char *nano_execute_msg = N_("Execute external command"); |
| 421 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 422 | #if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 423 | const char *nano_multibuffer_msg = N_("Insert into new buffer"); |
| 424 | #endif |
| 425 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 426 | const char *nano_exitbrowser_msg = N_("Exit from the file browser"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 427 | const char *nano_firstfile_msg = |
| 428 | N_("Go to the first file in the list"); |
| 429 | const char *nano_lastfile_msg = |
| 430 | N_("Go to the last file in the list"); |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 431 | const char *nano_gotodir_msg = N_("Go to directory"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 432 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 433 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 434 | |
David Lawrence Ramsey | 8e4adcd | 2004-05-20 03:29:33 +0000 | [diff] [blame] | 435 | /* The following macro is to be used in calling sc_init_one(). The |
| 436 | * point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is |
| 437 | * defined, when the 4th one should not be there. */ |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 438 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | eb50922 | 2005-03-22 04:50:11 +0000 | [diff] [blame] | 439 | #define IFHELP(help, nextvar) help, nextvar |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 440 | #else |
David Lawrence Ramsey | eb50922 | 2005-03-22 04:50:11 +0000 | [diff] [blame] | 441 | #define IFHELP(help, nextvar) nextvar |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 442 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 443 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 444 | free_shortcutage(&main_list); |
| 445 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 446 | sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 447 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 448 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 449 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 450 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 451 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 452 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 453 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 454 | ); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 455 | |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 456 | sc_init_one(&main_list, NANO_EXIT_KEY, |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 457 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 458 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 459 | openfile != NULL && openfile != openfile->next ? N_("Close") : |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 460 | #endif |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 461 | exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, |
| 462 | NANO_NO_KEY, VIEW, do_exit); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 463 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 464 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 465 | sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"), |
| 466 | IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY, |
| 467 | NANO_NO_KEY, NOVIEW, do_writeout_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 468 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 469 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 470 | sc_init_one(&main_list, NANO_JUSTIFY_KEY, N_("Justify"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 471 | IFHELP(nano_justify_msg, NANO_NO_KEY), NANO_JUSTIFY_FKEY, |
| 472 | NANO_NO_KEY, NOVIEW, |
David Lawrence Ramsey | a539fce | 2004-06-29 00:43:56 +0000 | [diff] [blame] | 473 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 474 | do_justify_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 475 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 476 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 477 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 478 | ); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 479 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 480 | /* We allow inserting files in view mode if multibuffers are |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 481 | * available, so that we can view multiple files. If we're using |
| 482 | * restricted mode, inserting files is disabled, since it allows |
| 483 | * reading from or writing to files not specified on the command |
| 484 | * line. */ |
| 485 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 486 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 487 | sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"), |
| 488 | IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY, |
| 489 | NANO_NO_KEY, |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 490 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 491 | VIEW |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 492 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 493 | NOVIEW |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 494 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 495 | , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 496 | |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 497 | sc_init_one(&main_list, NANO_WHEREIS_KEY, whereis_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 498 | IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY, |
| 499 | NANO_NO_KEY, VIEW, do_search); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 500 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 501 | sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg, |
| 502 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
| 503 | NANO_NO_KEY, VIEW, do_page_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 504 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 505 | sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg, |
| 506 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
| 507 | NANO_NO_KEY, VIEW, do_page_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 508 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 509 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 510 | sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 511 | IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY, NANO_NO_KEY, |
| 512 | NOVIEW, do_cut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 513 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 514 | if (unjustify) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 515 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 516 | sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"), |
| 517 | IFHELP(NULL, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 518 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 519 | else |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 520 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 521 | sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 522 | IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY, |
| 523 | NANO_NO_KEY, NOVIEW, do_uncut_text); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 524 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 525 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 526 | sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"), |
| 527 | IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY, |
| 528 | NANO_NO_KEY, VIEW, do_cursorpos_void); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 529 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 530 | /* If we're using restricted mode, spell checking is disabled |
| 531 | * because it allows reading from or writing to files not specified |
| 532 | * on the command line. */ |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 533 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 534 | sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"), |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 535 | IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY, |
| 536 | NANO_NO_KEY, NOVIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 537 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 538 | !ISSET(RESTRICTED) ? do_spell : |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 539 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 540 | nano_disabled_msg); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 541 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 542 | sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg, |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 543 | IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY), |
David Lawrence Ramsey | 9245f97 | 2005-05-17 18:06:26 +0000 | [diff] [blame] | 544 | NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, |
| 545 | do_gotolinecolumn_void); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 546 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 547 | sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg, |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 548 | IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), |
| 549 | NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 550 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 551 | #ifndef NANO_TINY |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 552 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 553 | sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"), |
| 554 | IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY, |
David Lawrence Ramsey | a049c83 | 2005-06-12 23:53:28 +0000 | [diff] [blame] | 555 | NANO_NO_KEY, VIEW, do_mark); |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 556 | |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 557 | sc_init_one(&main_list, NANO_NO_KEY, whereis_next_msg, |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 558 | IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 559 | NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research); |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 560 | #endif |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 561 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 562 | sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"), |
| 563 | IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 564 | NANO_NO_KEY, VIEW, do_up); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 565 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 566 | sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"), |
| 567 | IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 568 | NANO_NO_KEY, VIEW, do_down); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 569 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 570 | sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 571 | IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 572 | VIEW, do_right); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 573 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 574 | sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 575 | IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 576 | VIEW, do_left); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 577 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 578 | sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 579 | IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 580 | VIEW, do_home); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 581 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 582 | sc_init_one(&main_list, NANO_END_KEY, N_("End"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 583 | IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 584 | VIEW, do_end); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 585 | |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 586 | sc_init_one(&main_list, NANO_REFRESH_KEY, refresh_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 587 | IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 588 | VIEW, total_refresh); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 589 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 590 | sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 591 | IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 592 | NOVIEW, do_delete); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 593 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 594 | sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace"), |
| 595 | IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 596 | NANO_NO_KEY, NOVIEW, do_backspace); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 597 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 598 | sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 599 | IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 600 | NOVIEW, do_tab); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 601 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 602 | sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"), |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 603 | IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 604 | NOVIEW, do_enter); |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 605 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 606 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 607 | sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"), |
| 608 | IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | e010edd | 2005-06-12 22:31:03 +0000 | [diff] [blame] | 609 | NANO_NO_KEY, VIEW, do_next_word_void); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 610 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 611 | sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"), |
| 612 | IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | a8824a1 | 2005-06-26 19:03:48 +0000 | [diff] [blame] | 613 | NANO_NO_KEY, VIEW, do_prev_word_void); |
David Lawrence Ramsey | e010edd | 2005-06-12 22:31:03 +0000 | [diff] [blame] | 614 | |
| 615 | sc_init_one(&main_list, NANO_NO_KEY, N_("Word Count"), |
| 616 | IFHELP(nano_wordcount_msg, NANO_WORDCOUNT_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 8e94234 | 2005-07-25 04:21:46 +0000 | [diff] [blame] | 617 | NANO_NO_KEY, VIEW, do_wordlinechar_count); |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 618 | |
David Lawrence Ramsey | ae9eea7 | 2005-11-10 07:40:55 +0000 | [diff] [blame] | 619 | sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Up"), |
| 620 | IFHELP(nano_scrollup_msg, NANO_SCROLLUP_KEY), NANO_NO_KEY, |
| 621 | NANO_SCROLLUP_ALTKEY, VIEW, do_scroll_up); |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 622 | |
David Lawrence Ramsey | ae9eea7 | 2005-11-10 07:40:55 +0000 | [diff] [blame] | 623 | sc_init_one(&main_list, NANO_NO_KEY, N_("Scroll Down"), |
| 624 | IFHELP(nano_scrolldown_msg, NANO_SCROLLDOWN_KEY), NANO_NO_KEY, |
| 625 | NANO_SCROLLDOWN_ALTKEY, VIEW, do_scroll_down); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 626 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 627 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 628 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 629 | sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg, |
| 630 | IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY, |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 631 | NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 632 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 633 | sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg, |
| 634 | IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY, |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 635 | NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 636 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 637 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 638 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 639 | sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"), |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 640 | IFHELP(nano_prevfile_msg, NANO_PREVFILE_KEY), NANO_NO_KEY, |
| 641 | NANO_PREVFILE_ALTKEY, VIEW, switch_to_prev_buffer_void); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 642 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 643 | sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"), |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 644 | IFHELP(nano_nextfile_msg, NANO_NEXTFILE_KEY), NANO_NO_KEY, |
| 645 | NANO_NEXTFILE_ALTKEY, VIEW, switch_to_next_buffer_void); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 646 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 647 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 648 | sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"), |
| 649 | IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY, |
| 650 | NANO_NO_KEY, NOVIEW, do_verbatim_input); |
| 651 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 652 | #ifndef NANO_TINY |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 653 | sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg, |
| 654 | IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY), |
| 655 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end); |
| 656 | #endif |
| 657 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 658 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 659 | sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg, |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 660 | IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY), |
| 661 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 662 | #endif |
| 663 | |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 664 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 665 | sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"), |
| 666 | IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY, |
| 667 | NANO_NO_KEY, VIEW, do_find_bracket); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 668 | #endif |
| 669 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 670 | free_shortcutage(&whereis_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 671 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 672 | sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 673 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 674 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 675 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 676 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 677 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 678 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 679 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 680 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 681 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 682 | sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 683 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 684 | VIEW, NULL); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 685 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 686 | sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg, |
| 687 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, |
| 688 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 689 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 690 | sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg, |
| 691 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, |
| 692 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 693 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 694 | sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 695 | IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 696 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 697 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 698 | sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg, |
| 699 | IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 700 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 701 | |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 702 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 703 | sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg, |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 704 | IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY, |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 705 | NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin_void); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 706 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 707 | sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg, |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 708 | IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY, |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 709 | NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 710 | #endif |
| 711 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 712 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 713 | sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg, |
| 714 | IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 715 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 716 | |
David Lawrence Ramsey | f3ecffd | 2005-06-16 18:48:30 +0000 | [diff] [blame] | 717 | sc_init_one(&whereis_list, NANO_NO_KEY, backwards_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 718 | IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 719 | NANO_NO_KEY, VIEW, NULL); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 720 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 721 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 722 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 723 | sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg, |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 724 | IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 725 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 726 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 727 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 728 | #ifndef NANO_TINY |
David Lawrence Ramsey | 5e73eec | 2005-05-03 20:57:13 +0000 | [diff] [blame] | 729 | sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 730 | IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 731 | VIEW, NULL); |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 732 | |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 733 | sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg, |
| 734 | IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY), |
| 735 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 736 | #endif |
David Lawrence Ramsey | 02085d7 | 2004-11-07 16:04:18 +0000 | [diff] [blame] | 737 | |
| 738 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 02085d7 | 2004-11-07 16:04:18 +0000 | [diff] [blame] | 739 | sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg, |
| 740 | IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY), |
| 741 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify); |
| 742 | #endif |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 743 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 744 | free_shortcutage(&replace_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 745 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 746 | sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 747 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 748 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 749 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 750 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 751 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 752 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 753 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 754 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 755 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 756 | sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 757 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 758 | VIEW, NULL); |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 759 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 760 | sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg, |
| 761 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY, |
| 762 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 763 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 764 | sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg, |
| 765 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY, |
| 766 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 767 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 768 | /* TRANSLATORS: Try to keep this at most 12 characters. */ |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 769 | sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"), |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 770 | IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 771 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 772 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 773 | sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg, |
| 774 | IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 775 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 8c2b40f | 2000-06-29 01:30:04 +0000 | [diff] [blame] | 776 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 777 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 778 | sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg, |
| 779 | IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 780 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 781 | |
David Lawrence Ramsey | f3ecffd | 2005-06-16 18:48:30 +0000 | [diff] [blame] | 782 | sc_init_one(&replace_list, NANO_NO_KEY, backwards_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 783 | IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 784 | NANO_NO_KEY, VIEW, NULL); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 785 | #endif |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 786 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 787 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 788 | sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg, |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 789 | IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 790 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 791 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 792 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 793 | #ifndef NANO_TINY |
David Lawrence Ramsey | 5e73eec | 2005-05-03 20:57:13 +0000 | [diff] [blame] | 794 | sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 795 | IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 796 | VIEW, NULL); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 797 | #endif |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 798 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 799 | free_shortcutage(&replace_list_2); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 800 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 801 | sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 802 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 803 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 804 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 805 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 806 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 807 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 808 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 809 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 810 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 811 | sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 812 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 813 | VIEW, NULL); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 814 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 815 | sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg, |
| 816 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 817 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 818 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 819 | sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg, |
| 820 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 821 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | 105da33 | 2000-10-31 05:10:10 +0000 | [diff] [blame] | 822 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 823 | #ifndef NANO_TINY |
David Lawrence Ramsey | 5e73eec | 2005-05-03 20:57:13 +0000 | [diff] [blame] | 824 | sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 825 | IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 826 | VIEW, NULL); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 827 | #endif |
| 828 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 829 | free_shortcutage(&gotoline_list); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 830 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 831 | sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 832 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 833 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 834 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 835 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 836 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 837 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 838 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 839 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 840 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 841 | sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 842 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 843 | VIEW, NULL); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 844 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 845 | sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 846 | IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 847 | NANO_NO_KEY, VIEW, do_first_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 848 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 849 | sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg, |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 850 | IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 851 | NANO_NO_KEY, VIEW, do_last_line); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 852 | |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 853 | sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY, |
| 854 | N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY), |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 855 | NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL); |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 856 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 857 | free_shortcutage(&writefile_list); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 858 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 859 | sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 860 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 861 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 862 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 863 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 864 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 865 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 866 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 867 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 868 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 869 | sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 870 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 871 | VIEW, NULL); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 872 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 873 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 874 | /* If we're using restricted mode, the file browser is disabled. |
| 875 | * It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 876 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 877 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 878 | sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 879 | IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 880 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 881 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 882 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 883 | #ifndef NANO_TINY |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 884 | /* If we're using restricted mode, the DOS format, Mac format, |
| 885 | * append, prepend, and backup toggles are disabled. The first and |
| 886 | * second are useless since inserting files is disabled, the third |
| 887 | * and fourth are disabled because they allow writing to files not |
| 888 | * specified on the command line, and the fifth is useless since |
| 889 | * backups are disabled. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 890 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 891 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 892 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 893 | sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 894 | IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 895 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 896 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 897 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 898 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 899 | sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 900 | IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 901 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 902 | #endif |
| 903 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 904 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 905 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 906 | sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 907 | IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 908 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 909 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 910 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 911 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 912 | sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 913 | IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 914 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 915 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 916 | #ifndef NANO_TINY |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 917 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 918 | /* TRANSLATORS: Try to keep this at most 16 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 919 | sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"), |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 920 | IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 921 | NANO_NO_KEY, NOVIEW, NULL); |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 922 | #endif |
| 923 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 924 | free_shortcutage(&insertfile_list); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 925 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 926 | sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 927 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 928 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 929 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 930 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 931 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 932 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 933 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 934 | ); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 935 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 936 | sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 937 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 938 | VIEW, NULL); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 939 | |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 940 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 941 | /* If we're using restricted mode, the file browser is disabled. |
| 942 | * It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 943 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 944 | sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg, |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 945 | IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 946 | NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 947 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 948 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 949 | #ifndef NANO_TINY |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 950 | /* If we're using restricted mode, command execution is disabled. |
| 951 | * It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 952 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 953 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 954 | sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY, |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 955 | /* TRANSLATORS: Try to keep this at most 22 characters. */ |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 956 | N_("Execute Command"), IFHELP(nano_execute_msg, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 957 | NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 958 | |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 959 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 960 | /* If we're using restricted mode, the multibuffer toggle is |
| 961 | * disabled. It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 962 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 963 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 04a8d1c | 2004-09-28 22:14:58 +0000 | [diff] [blame] | 964 | sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg, |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 965 | IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 966 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 967 | #endif |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 968 | #endif |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 969 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 970 | #ifndef NANO_TINY |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 971 | free_shortcutage(&extcmd_list); |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 972 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 973 | sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 974 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 975 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 976 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 977 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 978 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 979 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 980 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 981 | ); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 982 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 983 | sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 984 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 985 | VIEW, NULL); |
David Lawrence Ramsey | 04a8d1c | 2004-09-28 22:14:58 +0000 | [diff] [blame] | 986 | |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 987 | sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"), |
| 988 | IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 989 | NANO_NO_KEY, VIEW, NULL); |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 990 | |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 991 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 04a8d1c | 2004-09-28 22:14:58 +0000 | [diff] [blame] | 992 | sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg, |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 993 | IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 994 | NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 995 | #endif |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 996 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 997 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 998 | #ifndef DISABLE_HELP |
| 999 | free_shortcutage(&help_list); |
| 1000 | |
| 1001 | sc_init_one(&help_list, NANO_REFRESH_KEY, refresh_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 1002 | IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1003 | VIEW, NULL); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1004 | |
| 1005 | sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 1006 | IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY, NANO_NO_KEY, |
| 1007 | VIEW, NULL); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1008 | |
| 1009 | sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg, |
| 1010 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
| 1011 | NANO_NO_KEY, VIEW, NULL); |
| 1012 | |
| 1013 | sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg, |
| 1014 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
| 1015 | NANO_NO_KEY, VIEW, NULL); |
| 1016 | |
| 1017 | sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"), |
| 1018 | IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1019 | NANO_NO_KEY, VIEW, NULL); |
| 1020 | |
| 1021 | sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"), |
| 1022 | IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY, |
| 1023 | NANO_NO_KEY, VIEW, NULL); |
| 1024 | #endif |
| 1025 | |
| 1026 | #ifndef DISABLE_SPELLER |
| 1027 | free_shortcutage(&spell_list); |
| 1028 | |
| 1029 | sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 1030 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 1031 | VIEW, |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1032 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1033 | do_help_void |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1034 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 1035 | nano_disabled_msg |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1036 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 1037 | ); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1038 | |
| 1039 | sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 1040 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1041 | VIEW, NULL); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1042 | #endif |
| 1043 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 1044 | #ifndef DISABLE_BROWSER |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1045 | free_shortcutage(&browser_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1046 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1047 | sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 1048 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 1049 | VIEW, NULL); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1050 | |
David Lawrence Ramsey | 8037fe0 | 2004-07-23 12:30:40 +0000 | [diff] [blame] | 1051 | sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg, |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 1052 | IFHELP(nano_exitbrowser_msg, NANO_NO_KEY), NANO_EXIT_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1053 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1054 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1055 | sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg, |
| 1056 | IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1057 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1058 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1059 | sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg, |
| 1060 | IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY, |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1061 | NANO_NO_KEY, VIEW, NULL); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1062 | |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1063 | sc_init_one(&browser_list, NANO_WHEREIS_KEY, whereis_msg, |
| 1064 | IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1065 | VIEW, NULL); |
| 1066 | |
| 1067 | sc_init_one(&browser_list, NANO_NO_KEY, whereis_next_msg, |
| 1068 | IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY), |
| 1069 | NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, NULL); |
| 1070 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 1071 | /* TRANSLATORS: Try to keep this at most 22 characters. */ |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 1072 | sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"), |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 1073 | IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY), |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1074 | NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL); |
Rocco Corsi | 12f294c | 2001-04-14 06:50:24 +0000 | [diff] [blame] | 1075 | |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1076 | free_shortcutage(&whereis_file_list); |
| 1077 | |
| 1078 | sc_init_one(&whereis_file_list, NANO_HELP_KEY, get_help_msg, |
| 1079 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 1080 | VIEW, |
| 1081 | #ifndef DISABLE_HELP |
| 1082 | do_browser_help |
| 1083 | #else |
| 1084 | nano_disabled_msg |
| 1085 | #endif |
| 1086 | ); |
| 1087 | |
| 1088 | sc_init_one(&whereis_file_list, NANO_CANCEL_KEY, cancel_msg, |
| 1089 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1090 | VIEW, NULL); |
| 1091 | |
| 1092 | sc_init_one(&whereis_file_list, NANO_FIRSTFILE_KEY, first_file_msg, |
| 1093 | IFHELP(nano_firstfile_msg, NANO_NO_KEY), NANO_FIRSTFILE_FKEY, |
| 1094 | NANO_NO_KEY, VIEW, do_first_file); |
| 1095 | |
| 1096 | sc_init_one(&whereis_file_list, NANO_LASTFILE_KEY, last_file_msg, |
| 1097 | IFHELP(nano_lastfile_msg, NANO_NO_KEY), NANO_LASTFILE_FKEY, |
| 1098 | NANO_NO_KEY, VIEW, do_last_file); |
| 1099 | |
| 1100 | #ifndef NANO_SMALL |
| 1101 | sc_init_one(&whereis_file_list, NANO_NO_KEY, case_sens_msg, |
| 1102 | IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY, |
| 1103 | NANO_NO_KEY, VIEW, NULL); |
| 1104 | |
| 1105 | sc_init_one(&whereis_file_list, NANO_NO_KEY, backwards_msg, |
| 1106 | IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY, |
| 1107 | NANO_NO_KEY, VIEW, NULL); |
| 1108 | #endif |
| 1109 | |
| 1110 | #ifdef HAVE_REGEX_H |
| 1111 | sc_init_one(&whereis_file_list, NANO_NO_KEY, regexp_msg, |
| 1112 | IFHELP(nano_regexp_msg, NANO_REGEXP_KEY), NANO_NO_KEY, |
| 1113 | NANO_NO_KEY, VIEW, NULL); |
| 1114 | #endif |
| 1115 | |
| 1116 | #ifndef NANO_SMALL |
| 1117 | sc_init_one(&whereis_file_list, NANO_PREVLINE_KEY, history_msg, |
| 1118 | IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1119 | VIEW, NULL); |
| 1120 | #endif |
| 1121 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1122 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1123 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1124 | sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg, |
David Lawrence Ramsey | 1f479ee | 2006-03-29 19:58:49 +0000 | [diff] [blame] | 1125 | IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY, NANO_NO_KEY, |
| 1126 | VIEW, |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1127 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1128 | do_help_void |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1129 | #else |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 1130 | nano_disabled_msg |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 1131 | #endif |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 1132 | ); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1133 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1134 | sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg, |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 1135 | IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, |
| 1136 | VIEW, NULL); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 1137 | #endif |
| 1138 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 1139 | currshortcut = main_list; |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1140 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1141 | #ifndef NANO_TINY |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1142 | toggle_init(); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1143 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1144 | } |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1145 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1146 | /* Deallocate the given shortcut. */ |
| 1147 | void free_shortcutage(shortcut **shortcutage) |
| 1148 | { |
| 1149 | assert(shortcutage != NULL); |
David Lawrence Ramsey | 193b0e5 | 2005-06-06 18:41:17 +0000 | [diff] [blame] | 1150 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1151 | while (*shortcutage != NULL) { |
| 1152 | shortcut *ps = *shortcutage; |
| 1153 | *shortcutage = (*shortcutage)->next; |
| 1154 | free(ps); |
| 1155 | } |
| 1156 | } |
| 1157 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1158 | #ifndef NANO_TINY |
David Lawrence Ramsey | a549a82 | 2005-07-01 23:11:52 +0000 | [diff] [blame] | 1159 | /* Create a new toggle structure, at the end of the toggles linked |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1160 | * list. */ |
| 1161 | void toggle_init_one(int val, const char *desc, long flag) |
| 1162 | { |
| 1163 | toggle *u; |
| 1164 | |
| 1165 | if (toggles == NULL) { |
David Lawrence Ramsey | 94b975c | 2004-07-20 12:57:34 +0000 | [diff] [blame] | 1166 | toggles = (toggle *)nmalloc(sizeof(toggle)); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1167 | u = toggles; |
| 1168 | } else { |
| 1169 | for (u = toggles; u->next != NULL; u = u->next) |
| 1170 | ; |
David Lawrence Ramsey | 94b975c | 2004-07-20 12:57:34 +0000 | [diff] [blame] | 1171 | u->next = (toggle *)nmalloc(sizeof(toggle)); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1172 | u = u->next; |
| 1173 | } |
| 1174 | |
| 1175 | u->val = val; |
| 1176 | u->desc = _(desc); |
| 1177 | u->flag = flag; |
| 1178 | u->next = NULL; |
| 1179 | } |
| 1180 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1181 | /* Initialize the global toggle list. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1182 | void toggle_init(void) |
| 1183 | { |
| 1184 | /* There is no need to reinitialize the toggles. They can't |
| 1185 | * change. */ |
| 1186 | if (toggles != NULL) |
| 1187 | return; |
| 1188 | |
| 1189 | toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP); |
David Lawrence Ramsey | 26e637b | 2005-06-18 03:37:56 +0000 | [diff] [blame] | 1190 | toggle_init_one(TOGGLE_MORESPACE_KEY, |
| 1191 | N_("Use of more space for editing"), MORE_SPACE); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1192 | #ifdef ENABLE_MULTIBUFFER |
| 1193 | /* If we're using restricted mode, the multibuffer toggle is |
| 1194 | * disabled. It's useless since inserting files is disabled. */ |
| 1195 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 1196 | toggle_init_one(TOGGLE_MULTIBUFFER_KEY, |
| 1197 | N_("Multiple file buffers"), MULTIBUFFER); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1198 | #endif |
David Lawrence Ramsey | 26e637b | 2005-06-18 03:37:56 +0000 | [diff] [blame] | 1199 | toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1200 | #ifndef DISABLE_WRAPPING |
David Lawrence Ramsey | d873447 | 2005-06-18 03:03:32 +0000 | [diff] [blame] | 1201 | toggle_init_one(TOGGLE_WRAP_KEY, N_("Long line wrapping"), |
| 1202 | NO_WRAP); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1203 | #endif |
David Lawrence Ramsey | 26e637b | 2005-06-18 03:37:56 +0000 | [diff] [blame] | 1204 | #ifndef DISABLE_MOUSE |
| 1205 | toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE); |
| 1206 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1207 | /* If we're using restricted mode, the suspend toggle is disabled. |
| 1208 | * It's useless since suspending is disabled. */ |
| 1209 | if (!ISSET(RESTRICTED)) |
| 1210 | toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND); |
David Lawrence Ramsey | 26e637b | 2005-06-18 03:37:56 +0000 | [diff] [blame] | 1211 | toggle_init_one(TOGGLE_CONST_KEY, |
| 1212 | N_("Constant cursor position display"), CONST_UPDATE); |
David Lawrence Ramsey | 26e637b | 2005-06-18 03:37:56 +0000 | [diff] [blame] | 1213 | toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), |
| 1214 | AUTOINDENT); |
| 1215 | toggle_init_one(TOGGLE_TABSTOSPACES_KEY, |
| 1216 | N_("Conversion of typed tabs to spaces"), TABS_TO_SPACES); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 1217 | /* If we're using restricted mode, the DOS/Mac conversion toggle is |
| 1218 | * disabled. It's useless since inserting files is disabled. */ |
| 1219 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1220 | toggle_init_one(TOGGLE_NOCONVERT_KEY, |
| 1221 | N_("No conversion from DOS/Mac format"), NO_CONVERT); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 1222 | /* If we're using restricted mode, the backup toggle is disabled. |
| 1223 | * It's useless since backups are disabled. */ |
| 1224 | if (!ISSET(RESTRICTED)) |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 1225 | toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), |
| 1226 | BACKUP_FILE); |
| 1227 | toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), |
David Lawrence Ramsey | b2b6976 | 2005-06-16 02:13:10 +0000 | [diff] [blame] | 1228 | SMOOTH_SCROLL); |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 1229 | toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), |
| 1230 | SMART_HOME); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1231 | #ifdef ENABLE_COLOR |
| 1232 | toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"), |
David Lawrence Ramsey | 202d3c2 | 2005-03-10 20:55:11 +0000 | [diff] [blame] | 1233 | NO_COLOR_SYNTAX); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1234 | #endif |
| 1235 | #ifdef ENABLE_NANORC |
| 1236 | toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"), |
| 1237 | WHITESPACE_DISPLAY); |
| 1238 | #endif |
| 1239 | } |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1240 | #endif /* !NANO_TINY */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1241 | |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1242 | /* This function is called just before calling exit(). Practically, the |
| 1243 | * only effect is to cause a segmentation fault if the various data |
| 1244 | * structures got bolloxed earlier. Thus, we don't bother having this |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1245 | * function unless debugging is turned on. */ |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1246 | #ifdef DEBUG |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1247 | /* Added by SPK for memory cleanup; gracefully return our malloc()s. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1248 | void thanks_for_all_the_fish(void) |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1249 | { |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1250 | delwin(topwin); |
| 1251 | delwin(edit); |
| 1252 | delwin(bottomwin); |
| 1253 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1254 | #ifndef DISABLE_JUSTIFY |
| 1255 | if (quotestr != NULL) |
| 1256 | free(quotestr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1257 | #ifdef HAVE_REGEX_H |
| 1258 | regfree("ereg); |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1259 | if (quoteerr != NULL) |
| 1260 | free(quoteerr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1261 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1262 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1263 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 1264 | if (backup_dir != NULL) |
| 1265 | free(backup_dir); |
| 1266 | #endif |
Chris Allegretta | 2598c66 | 2002-03-28 01:59:34 +0000 | [diff] [blame] | 1267 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1268 | if (operating_dir != NULL) |
| 1269 | free(operating_dir); |
| 1270 | if (full_operating_dir != NULL) |
| 1271 | free(full_operating_dir); |
| 1272 | #endif |
| 1273 | if (last_search != NULL) |
| 1274 | free(last_search); |
| 1275 | if (last_replace != NULL) |
| 1276 | free(last_replace); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1277 | #ifndef DISABLE_SPELLER |
| 1278 | if (alt_speller != NULL) |
| 1279 | free(alt_speller); |
| 1280 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1281 | if (answer != NULL) |
| 1282 | free(answer); |
| 1283 | if (cutbuffer != NULL) |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1284 | free_filestruct(cutbuffer); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 1285 | #ifndef DISABLE_JUSTIFY |
| 1286 | if (jusbuffer != NULL) |
| 1287 | free_filestruct(jusbuffer); |
| 1288 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1289 | free_shortcutage(&main_list); |
| 1290 | free_shortcutage(&whereis_list); |
| 1291 | free_shortcutage(&replace_list); |
| 1292 | free_shortcutage(&replace_list_2); |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 1293 | free_shortcutage(&gotoline_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1294 | free_shortcutage(&writefile_list); |
| 1295 | free_shortcutage(&insertfile_list); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 1296 | #ifndef NANO_TINY |
| 1297 | free_shortcutage(&extcmd_list); |
| 1298 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1299 | #ifndef DISABLE_HELP |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1300 | free_shortcutage(&help_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1301 | #endif |
| 1302 | #ifndef DISABLE_SPELLER |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1303 | free_shortcutage(&spell_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1304 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1305 | #ifndef DISABLE_BROWSER |
| 1306 | free_shortcutage(&browser_list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1307 | free_shortcutage(&gotodir_list); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1308 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1309 | #ifndef NANO_TINY |
David Lawrence Ramsey | 40e4acf | 2005-05-26 06:09:07 +0000 | [diff] [blame] | 1310 | /* Free the memory associated with each toggle. */ |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1311 | while (toggles != NULL) { |
| 1312 | toggle *t = toggles; |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1313 | |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1314 | toggles = toggles->next; |
| 1315 | free(t); |
| 1316 | } |
| 1317 | #endif |
David Lawrence Ramsey | 5d8d0b1 | 2005-05-26 05:53:29 +0000 | [diff] [blame] | 1318 | /* Free the memory associated with each open file buffer. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 1319 | if (openfile != NULL) |
David Lawrence Ramsey | 64661ac | 2005-07-08 19:57:25 +0000 | [diff] [blame] | 1320 | free_openfilestruct(openfile); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1321 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1322 | if (syntaxstr != NULL) |
| 1323 | free(syntaxstr); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1324 | while (syntaxes != NULL) { |
| 1325 | syntaxtype *bill = syntaxes; |
| 1326 | |
| 1327 | free(syntaxes->desc); |
| 1328 | while (syntaxes->extensions != NULL) { |
| 1329 | exttype *bob = syntaxes->extensions; |
| 1330 | |
| 1331 | syntaxes->extensions = bob->next; |
David Lawrence Ramsey | 2385c1a | 2005-07-29 21:42:08 +0000 | [diff] [blame] | 1332 | free(bob->ext_regex); |
David Lawrence Ramsey | 7fc0ada | 2005-08-29 18:52:06 +0000 | [diff] [blame] | 1333 | if (bob->ext != NULL) { |
| 1334 | regfree(bob->ext); |
| 1335 | free(bob->ext); |
| 1336 | } |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1337 | free(bob); |
| 1338 | } |
| 1339 | while (syntaxes->color != NULL) { |
| 1340 | colortype *bob = syntaxes->color; |
| 1341 | |
| 1342 | syntaxes->color = bob->next; |
David Lawrence Ramsey | 2385c1a | 2005-07-29 21:42:08 +0000 | [diff] [blame] | 1343 | free(bob->start_regex); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1344 | if (bob->start != NULL) { |
| 1345 | regfree(bob->start); |
| 1346 | free(bob->start); |
| 1347 | } |
David Lawrence Ramsey | d2361f0 | 2005-07-14 18:33:51 +0000 | [diff] [blame] | 1348 | if (bob->end_regex != NULL) |
| 1349 | free(bob->end_regex); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1350 | if (bob->end != NULL) { |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1351 | regfree(bob->end); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1352 | free(bob->end); |
| 1353 | } |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1354 | free(bob); |
| 1355 | } |
| 1356 | syntaxes = syntaxes->next; |
| 1357 | free(bill); |
| 1358 | } |
| 1359 | #endif /* ENABLE_COLOR */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1360 | #ifndef NANO_TINY |
David Lawrence Ramsey | 40e4acf | 2005-05-26 06:09:07 +0000 | [diff] [blame] | 1361 | /* Free the search and replace history lists. */ |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1362 | if (searchage != NULL) |
| 1363 | free_filestruct(searchage); |
| 1364 | if (replaceage != NULL) |
| 1365 | free_filestruct(replaceage); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 1366 | #endif |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 1367 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1368 | if (homedir != NULL) |
| 1369 | free(homedir); |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 1370 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1371 | } |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1372 | #endif /* DEBUG */ |