Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +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 | d8a1d37 | 2007-10-11 05:01:32 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 * |
| 6 | * Free Software Foundation, Inc. * |
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 * |
David Lawrence Ramsey | d0035b4 | 2007-08-11 05:17:36 +0000 | [diff] [blame] | 9 | * the Free Software Foundation; either version 3, 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 | a855fa2 | 2008-07-12 02:13:22 +0000 | [diff] [blame] | 24 | #include "proto.h" |
| 25 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 26 | #include <ctype.h> |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 27 | #include <string.h> |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 28 | #include <strings.h> |
| 29 | #include "assert.h" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 30 | |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 31 | /* Global variables. */ |
| 32 | #ifndef NANO_TINY |
David Lawrence Ramsey | 1c5af64 | 2006-05-10 15:15:06 +0000 | [diff] [blame] | 33 | sigjmp_buf jump_buf; |
David Lawrence Ramsey | b6fb688 | 2006-11-27 07:28:52 +0000 | [diff] [blame] | 34 | /* Used to return to either main() or the unjustify routine in |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 35 | * do_justify() after a SIGWINCH. */ |
David Lawrence Ramsey | 1c5af64 | 2006-05-10 15:15:06 +0000 | [diff] [blame] | 36 | bool jump_buf_main = FALSE; |
| 37 | /* Have we set jump_buf so that we return to main() after a |
| 38 | * SIGWINCH? */ |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 39 | #endif |
| 40 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 41 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 42 | ssize_t fill = 0; |
| 43 | /* The column where we will wrap lines. */ |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 44 | ssize_t wrap_at = -CHARS_FROM_EOL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 45 | /* The position where we will wrap lines. fill is equal to this |
| 46 | * if it's greater than zero, and equal to (COLS + this) if it |
| 47 | * isn't. */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 48 | #endif |
| 49 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 50 | char *last_search = NULL; |
| 51 | /* The last string we searched for. */ |
| 52 | char *last_replace = NULL; |
| 53 | /* The last replacement string we searched for. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 54 | |
Chris Allegretta | a48507d | 2009-08-14 03:18:29 +0000 | [diff] [blame^] | 55 | unsigned flags[4] = {0, 0, 0, 0}; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 56 | /* Our flag containing the states of all global options. */ |
| 57 | WINDOW *topwin; |
| 58 | /* The top portion of the window, where we display the version |
| 59 | * number of nano, the name of the current file, and whether the |
| 60 | * current file has been modified. */ |
| 61 | WINDOW *edit; |
David Lawrence Ramsey | b159f94 | 2006-07-28 17:06:27 +0000 | [diff] [blame] | 62 | /* The middle portion of the window, i.e. the edit window, where |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 63 | * we display the current file we're editing. */ |
| 64 | WINDOW *bottomwin; |
| 65 | /* The bottom portion of the window, where we display statusbar |
| 66 | * messages, the statusbar prompt, and a list of shortcuts. */ |
| 67 | int editwinrows = 0; |
| 68 | /* How many rows does the edit window take up? */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 69 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 70 | filestruct *cutbuffer = NULL; |
| 71 | /* The buffer where we store cut text. */ |
Chris Allegretta | 12dc8ca | 2008-07-31 04:24:04 +0000 | [diff] [blame] | 72 | filestruct *cutbottom = NULL; |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 73 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 74 | filestruct *jusbuffer = NULL; |
| 75 | /* The buffer where we store unjustified text. */ |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 76 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 77 | partition *filepart = NULL; |
| 78 | /* The partition where we store a portion of the current |
| 79 | * file. */ |
David Lawrence Ramsey | 64661ac | 2005-07-08 19:57:25 +0000 | [diff] [blame] | 80 | openfilestruct *openfile = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 81 | /* The list of all open file buffers. */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 82 | |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 83 | #ifndef NANO_TINY |
| 84 | char *matchbrackets = NULL; |
| 85 | /* The opening and closing brackets that can be found by bracket |
| 86 | * searches. */ |
| 87 | #endif |
| 88 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 89 | #if !defined(NANO_TINY) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 90 | char *whitespace = NULL; |
| 91 | /* The characters used when displaying the first characters of |
| 92 | * tabs and spaces. */ |
| 93 | int whitespace_len[2]; |
| 94 | /* The length of these characters. */ |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 95 | #endif |
| 96 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 97 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 98 | char *punct = NULL; |
| 99 | /* The closing punctuation that can end sentences. */ |
| 100 | char *brackets = NULL; |
| 101 | /* The closing brackets that can follow closing punctuation and |
| 102 | * can end sentences. */ |
| 103 | char *quotestr = NULL; |
| 104 | /* The quoting string. The default value is set in main(). */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 105 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 106 | regex_t quotereg; |
| 107 | /* The compiled regular expression from the quoting string. */ |
| 108 | int quoterc; |
David Lawrence Ramsey | 8816564 | 2006-05-22 18:30:09 +0000 | [diff] [blame] | 109 | /* Whether it was compiled successfully. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 110 | char *quoteerr = NULL; |
| 111 | /* The error message, if it didn't. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 112 | #else |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 113 | size_t quotelen; |
| 114 | /* The length of the quoting string in bytes. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 115 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 116 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 117 | |
Chris Allegretta | 0dc26dc | 2009-01-24 22:40:41 +0000 | [diff] [blame] | 118 | bool nodelay_mode = FALSE; |
| 119 | /* Are we in nodelay mode (checking for a cancel wile doing something */ |
| 120 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 121 | char *answer = NULL; |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 122 | /* The answer string used by the statusbar prompt. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 123 | |
| 124 | ssize_t tabsize = -1; |
| 125 | /* The width of a tab in spaces. The default value is set in |
| 126 | * main(). */ |
| 127 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 128 | #ifndef NANO_TINY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 129 | char *backup_dir = NULL; |
| 130 | /* The directory where we store backup files. */ |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 131 | #endif |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 132 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 133 | char *operating_dir = NULL; |
| 134 | /* The relative path to the operating directory, which we can't |
| 135 | * move outside of. */ |
| 136 | char *full_operating_dir = NULL; |
| 137 | /* The full path to it. */ |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 138 | #endif |
| 139 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 140 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 141 | char *alt_speller = NULL; |
| 142 | /* The command to use for the alternate spell checker. */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 143 | #endif |
| 144 | |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 145 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 146 | syntaxtype *syntaxes = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 147 | /* The global list of color syntaxes. */ |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 148 | char *syntaxstr = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 149 | /* The color syntax name specified on the command line. */ |
Chris Allegretta | fd265af | 2009-02-06 03:41:02 +0000 | [diff] [blame] | 150 | |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 151 | #endif |
| 152 | |
Chris Allegretta | fd265af | 2009-02-06 03:41:02 +0000 | [diff] [blame] | 153 | bool edit_refresh_needed = NULL; |
| 154 | /* Did a command mangle enough of the buffer refresh that we |
| 155 | should repaint the screen */ |
| 156 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 157 | const shortcut *currshortcut; |
| 158 | /* The current shortcut list we're using. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 159 | int currmenu; |
| 160 | /* The currently loaded menu */ |
| 161 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 162 | sc *sclist = NULL; |
| 163 | /* New shortcut key struct */ |
| 164 | subnfunc *allfuncs = NULL; |
| 165 | /* New struct for the function list */ |
| 166 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 167 | #ifndef NANO_TINY |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 168 | filestruct *search_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 169 | /* The search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 170 | filestruct *searchage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 171 | /* The top of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 172 | filestruct *searchbot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 173 | /* The bottom of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 174 | filestruct *replace_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 175 | /* The replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 176 | filestruct *replaceage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 177 | /* The top of the replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 178 | filestruct *replacebot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 179 | /* The bottom of the replace string history list. */ |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 180 | #endif |
| 181 | |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 182 | /* Regular expressions. */ |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 183 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 184 | regex_t search_regexp; |
| 185 | /* The compiled regular expression to use in searches. */ |
| 186 | regmatch_t regmatches[10]; |
| 187 | /* The match positions for parenthetical subexpressions, 10 |
| 188 | * maximum, used in regular expression searches. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 189 | #endif |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 190 | |
David Lawrence Ramsey | 4d72de7 | 2006-04-12 15:27:40 +0000 | [diff] [blame] | 191 | int reverse_attr = A_REVERSE; |
| 192 | /* The curses attribute we use for reverse video. */ |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 193 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 194 | char *homedir = NULL; |
David Lawrence Ramsey | c1c818e | 2006-05-14 18:22:01 +0000 | [diff] [blame] | 195 | /* The user's home directory, from $HOME or /etc/passwd. */ |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 196 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 197 | /* Return the number of entries in the shortcut list s for a given menu. */ |
| 198 | size_t length_of_list(int menu) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 199 | { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 200 | subnfunc *f; |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 201 | size_t i = 0; |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 202 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 203 | for (f = allfuncs; f != NULL; f = f->next) |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 204 | if ((f->menus & menu) != 0 |
| 205 | #ifndef DISABLE_HELP |
| 206 | && strlen(f->help) > 0 |
| 207 | #endif |
| 208 | ) { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 209 | i++; |
| 210 | } |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 211 | return i; |
| 212 | } |
| 213 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 214 | /* Set type of function based on the string */ |
| 215 | function_type strtokeytype(char *str) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 216 | { |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 217 | if (str[0] == 'M' || str[0] == 'm') |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 218 | return META; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 219 | else if (str[0] == '^') |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 220 | return CONTROL; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 221 | else if (str[0] == 'F' || str[0] == 'F') |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 222 | return FKEY; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 223 | else |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 224 | return RAW; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /* Add a string to the new function list strict. |
| 228 | Does not allow updates, yet anyway */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 229 | void add_to_funcs(short func, int menus, const char *desc, const char *help, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 230 | bool blank_after, bool viewok) |
| 231 | { |
| 232 | subnfunc *f; |
| 233 | |
| 234 | if (allfuncs == NULL) { |
Chris Allegretta | f86fa86 | 2009-02-25 04:32:15 +0000 | [diff] [blame] | 235 | allfuncs = (subnfunc *) nmalloc(sizeof(subnfunc)); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 236 | f = allfuncs; |
| 237 | } else { |
| 238 | for (f = allfuncs; f->next != NULL; f = f->next) |
| 239 | ; |
| 240 | f->next = (subnfunc *)nmalloc(sizeof(subnfunc)); |
| 241 | f = f->next; |
| 242 | } |
| 243 | f->next = NULL; |
| 244 | f->scfunc = func; |
| 245 | f->menus = menus; |
| 246 | f->desc = desc; |
| 247 | f->viewok = viewok; |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 248 | #ifndef DISABLE_HELP |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 249 | f->help = help; |
| 250 | f->blank_after = blank_after; |
| 251 | #endif |
| 252 | |
| 253 | #ifdef DEBUG |
| 254 | fprintf(stderr, "Added func \"%s\"", f->desc); |
| 255 | #endif |
| 256 | } |
| 257 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 258 | const sc *first_sc_for(int menu, short func) { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 259 | const sc *s; |
Chris Allegretta | b775c07 | 2008-03-09 05:07:37 +0000 | [diff] [blame] | 260 | const sc *metasc = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 261 | |
| 262 | for (s = sclist; s != NULL; s = s->next) { |
| 263 | if ((s->menu & menu) && s->scfunc == func) { |
Chris Allegretta | b775c07 | 2008-03-09 05:07:37 +0000 | [diff] [blame] | 264 | /* try to use a meta sequence as a last resort. Otherwise |
| 265 | we will run into problems when we try and handle things like |
| 266 | the arrow keys, home, etc, if for some reason the user bound |
| 267 | them to a meta sequence first *shrug* */ |
| 268 | if (s->type == META) { |
| 269 | metasc = s; |
| 270 | continue; |
| 271 | } /* otherwise it was something else, use it */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 272 | return s; |
| 273 | } |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 274 | } |
| 275 | |
Chris Allegretta | b775c07 | 2008-03-09 05:07:37 +0000 | [diff] [blame] | 276 | /* If we're here we may have found only meta sequences, if so use one */ |
| 277 | if (metasc) |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 278 | return metasc; |
Chris Allegretta | b775c07 | 2008-03-09 05:07:37 +0000 | [diff] [blame] | 279 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 280 | #ifdef DEBUG |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 281 | fprintf(stderr, "Whoops, returning null given func %ld in menu %d\n", (long) func, menu); |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 282 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 283 | /* Otherwise... */ |
| 284 | return NULL; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 285 | } |
| 286 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 287 | |
| 288 | /* Add a string to the new shortcut list implementation |
| 289 | Allows updates to existing entries in the list */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 290 | void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 291 | { |
| 292 | sc *s; |
| 293 | |
| 294 | if (sclist == NULL) { |
Chris Allegretta | f86fa86 | 2009-02-25 04:32:15 +0000 | [diff] [blame] | 295 | sclist = (sc *) nmalloc(sizeof(sc)); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 296 | s = sclist; |
| 297 | s->next = NULL; |
| 298 | } else { |
| 299 | for (s = sclist; s->next != NULL; s = s->next) |
| 300 | if (s->menu == menu && s->keystr == scstring) |
| 301 | break; |
| 302 | |
| 303 | if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */ |
| 304 | #ifdef DEBUG |
| 305 | fprintf(stderr, "No match found...\n"); |
| 306 | #endif |
| 307 | s->next = (sc *)nmalloc(sizeof(sc)); |
| 308 | s = s->next; |
| 309 | s->next = NULL; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | s->type = strtokeytype(scstring); |
| 314 | s->menu = menu; |
| 315 | s->toggle = toggle; |
| 316 | s->keystr = scstring; |
| 317 | s->scfunc = func; |
| 318 | s->execute = execute; |
| 319 | assign_keyinfo(s); |
| 320 | |
| 321 | #ifdef DEBUG |
| 322 | fprintf(stderr, "list val = %d\n", (int) s->menu); |
| 323 | fprintf(stderr, "Hey, set sequence to %d for shortcut \"%s\"\n", s->seq, scstring); |
| 324 | #endif |
| 325 | } |
| 326 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 327 | /* Return the given menu's first shortcut sequence, or the default value |
| 328 | (2nd arg). Assumes currmenu for the menu to check*/ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 329 | int sc_seq_or (short func, int defaultval) |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 330 | { |
| 331 | const sc *s = first_sc_for(currmenu, func); |
| 332 | |
| 333 | if (s) |
| 334 | return s->seq; |
| 335 | /* else */ |
| 336 | return defaultval; |
| 337 | |
| 338 | } |
| 339 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 340 | /* Assign the info to the shortcut struct |
| 341 | Assumes keystr is already assigned, naturally */ |
| 342 | void assign_keyinfo(sc *s) |
| 343 | { |
| 344 | if (s->type == CONTROL) { |
| 345 | assert(strlen(s->keystr) > 1); |
| 346 | s->seq = s->keystr[1] - 64; |
| 347 | } else if (s->type == META) { |
| 348 | assert(strlen(s->keystr) > 2); |
| 349 | s->seq = tolower((int) s->keystr[2]); |
| 350 | } else if (s->type == FKEY) { |
| 351 | assert(strlen(s->keystr) > 1); |
| 352 | s->seq = KEY_F0 + atoi(&s->keystr[1]); |
| 353 | } else /* raw */ |
| 354 | s->seq = (int) s->keystr[0]; |
Chris Allegretta | 9b42220 | 2008-03-05 17:15:33 +0000 | [diff] [blame] | 355 | |
| 356 | /* Override some keys which don't bind as nicely as we'd like */ |
| 357 | if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space"))) |
| 358 | s->seq = 0; |
| 359 | else if (s->type == META && (!strcasecmp(&s->keystr[2], "space"))) |
| 360 | s->seq = (int) ' '; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 361 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kup"))) |
| 362 | s->seq = KEY_UP; |
| 363 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kdown"))) |
| 364 | s->seq = KEY_DOWN; |
| 365 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kleft"))) |
| 366 | s->seq = KEY_LEFT; |
| 367 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kright"))) |
| 368 | s->seq = KEY_RIGHT; |
| 369 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kinsert"))) |
| 370 | s->seq = KEY_IC; |
| 371 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kdel"))) |
| 372 | s->seq = KEY_DC; |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 373 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kbsp"))) |
| 374 | s->seq = KEY_BACKSPACE; |
| 375 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kenter"))) |
| 376 | s->seq = KEY_ENTER; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 377 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kpup"))) |
| 378 | s->seq = KEY_PPAGE; |
| 379 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kpdown"))) |
| 380 | s->seq = KEY_NPAGE; |
| 381 | #ifdef KEY_HOME |
| 382 | else if (s->type == RAW && (!strcasecmp(s->keystr, "khome"))) |
| 383 | s->seq = KEY_HOME; |
| 384 | #endif |
| 385 | #ifdef KEY_END |
| 386 | else if (s->type == RAW && (!strcasecmp(s->keystr, "kend"))) |
| 387 | s->seq = KEY_END; |
| 388 | #endif |
Chris Allegretta | 9b42220 | 2008-03-05 17:15:33 +0000 | [diff] [blame] | 389 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | #ifdef DEBUG |
| 393 | |
| 394 | void print_sclist(void) |
| 395 | { |
| 396 | sc *s; |
| 397 | const subnfunc *f; |
| 398 | |
| 399 | for (s = sclist; s->next != NULL; s = s->next) { |
| 400 | f = sctofunc(s); |
| 401 | if (f) |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 402 | fprintf(stderr, "Shortcut \"%s\", function: %s, menus %d\n", s->keystr, f->desc, f->menus); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 403 | else |
| 404 | fprintf(stderr, "Hmm, didnt find a func for \"%s\"\n", s->keystr); |
| 405 | } |
| 406 | |
| 407 | } |
| 408 | #endif |
| 409 | |
| 410 | |
| 411 | /* Stuff we need to make at least static here so we can access it below */ |
| 412 | const char *cancel_msg = N_("Cancel"); |
| 413 | |
| 414 | #ifndef NANO_TINY |
| 415 | const char *case_sens_msg = N_("Case Sens"); |
| 416 | const char *backwards_msg = N_("Backwards"); |
| 417 | #endif |
| 418 | |
| 419 | #ifdef HAVE_REGEX_H |
| 420 | const char *regexp_msg = N_("Regexp"); |
| 421 | #endif |
| 422 | |
| 423 | /* Stuff we want to just stun out if we're in TINY mode */ |
| 424 | #ifdef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 425 | const char *gototext_msg = ""; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 426 | const char *do_para_begin_msg = ""; |
| 427 | const char *do_para_end_msg = ""; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 428 | const char *case_sens_msg = ""; |
| 429 | const char *backwards_msg = ""; |
| 430 | const char *do_cut_till_end = ""; |
| 431 | const char *dos_format_msg = ""; |
| 432 | const char *mac_format_msg = ""; |
| 433 | const char *append_msg = ""; |
| 434 | const char *prepend_msg = ""; |
| 435 | const char *backup_file_msg = ""; |
| 436 | const char *to_files_msg = ""; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 437 | const char *first_file_msg = ""; |
| 438 | const char *whereis_next_msg = ""; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 439 | const char *last_file_msg = ""; |
| 440 | const char *new_buffer_msg = ""; |
| 441 | const char *goto_dir_msg; |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 442 | const char *ext_cmd_msg = ""; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 443 | |
| 444 | #else |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 445 | /* TRANSLATORS: Try to keep the next five strings at most 10 characters. */ |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 446 | const char *prev_history_msg = N_("PrevHstory"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 447 | const char *next_history_msg = N_("NextHstory"); |
| 448 | const char *replace_msg = N_("Replace"); |
| 449 | const char *no_replace_msg = N_("No Replace"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 450 | const char *gototext_msg = N_("Go To Text"); |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 451 | /* TRANSLATORS: Try to keep the next three strings at most 12 characters. */ |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 452 | const char *whereis_next_msg = N_("WhereIs Next"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 453 | #ifndef DISABLE_BROWSER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 454 | const char *first_file_msg = N_("First File"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 455 | const char *last_file_msg = N_("Last File"); |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 456 | /* TRANSLATORS: Try to keep the next nine strings at most 16 characters. */ |
| 457 | const char *to_files_msg = N_("To Files"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 458 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 459 | const char *dos_format_msg = N_("DOS Format"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 460 | const char *mac_format_msg = N_("Mac Format"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 461 | const char *append_msg = N_("Append"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 462 | const char *prepend_msg = N_("Prepend"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 463 | const char *backup_file_msg = N_("Backup File"); |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 464 | const char *ext_cmd_msg = N_("Execute Command"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 465 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 466 | const char *new_buffer_msg = N_("New Buffer"); |
| 467 | #endif |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 468 | const char *goto_dir_msg = N_("Go To Dir"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 469 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 470 | #endif /* NANO_TINY */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 471 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 472 | /* Initialize all shortcut lists. If unjustify is TRUE, replace the |
| 473 | * Uncut shortcut in the main shortcut list with UnJustify. */ |
David Lawrence Ramsey | 1f1ebb8 | 2004-11-11 21:50:01 +0000 | [diff] [blame] | 474 | void shortcut_init(bool unjustify) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 475 | { |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 476 | /* TRANSLATORS: Try to keep the following strings at most 10 characters. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 477 | const char *get_help_msg = N_("Get Help"); |
| 478 | const char *exit_msg = N_("Exit"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 479 | const char *whereis_msg = N_("Where Is"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 480 | const char *prev_page_msg = N_("Prev Page"); |
| 481 | const char *next_page_msg = N_("Next Page"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 482 | const char *first_line_msg = N_("First Line"); |
| 483 | const char *last_line_msg = N_("Last Line"); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 484 | const char *suspend_msg = N_("Suspend"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 485 | #ifndef DISABLE_JUSTIFY |
| 486 | const char *beg_of_par_msg = N_("Beg of Par"); |
| 487 | const char *end_of_par_msg = N_("End of Par"); |
| 488 | const char *fulljstify_msg = N_("FullJstify"); |
| 489 | #endif |
David Lawrence Ramsey | 8137876 | 2006-04-24 20:53:43 +0000 | [diff] [blame] | 490 | const char *refresh_msg = N_("Refresh"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 491 | const char *insert_file_msg = N_("Insert File"); |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 492 | const char *go_to_line_msg = N_("Go To Line"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 493 | |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 494 | #ifndef DISABLE_JUSTIFY |
| 495 | const char *nano_justify_msg = N_("Justify the current paragraph"); |
| 496 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 497 | #ifndef DISABLE_HELP |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 498 | /* TRANSLATORS: The next long series of strings are shortcut descriptions; |
| 499 | * they are best kept shorter than 56 characters, but may be longer. */ |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 500 | const char *nano_cancel_msg = N_("Cancel the current function"); |
David Lawrence Ramsey | 57c9afb | 2006-04-14 20:21:45 +0000 | [diff] [blame] | 501 | const char *nano_help_msg = N_("Display this help text"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 502 | const char *nano_exit_msg = |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 503 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | be231d3 | 2006-05-21 21:37:21 +0000 | [diff] [blame] | 504 | N_("Close the current file buffer / Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 505 | #else |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 506 | N_("Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 507 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 508 | ; |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 509 | const char *nano_writeout_msg = |
| 510 | N_("Write the current file to disk"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 511 | const char *nano_insert_msg = |
| 512 | N_("Insert another file into the current one"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 513 | const char *nano_whereis_msg = |
David Lawrence Ramsey | be231d3 | 2006-05-21 21:37:21 +0000 | [diff] [blame] | 514 | N_("Search for a string or a regular expression"); |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 515 | const char *nano_prevpage_msg = N_("Go to previous screen"); |
| 516 | const char *nano_nextpage_msg = N_("Go to next screen"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 517 | const char *nano_cut_msg = |
| 518 | N_("Cut the current line and store it in the cutbuffer"); |
| 519 | const char *nano_uncut_msg = |
| 520 | N_("Uncut from the cutbuffer into the current line"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 521 | const char *nano_cursorpos_msg = |
David Lawrence Ramsey | f50bd4b | 2006-04-14 20:15:44 +0000 | [diff] [blame] | 522 | N_("Display the position of the cursor"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 523 | const char *nano_spell_msg = |
| 524 | N_("Invoke the spell checker, if available"); |
David Lawrence Ramsey | be231d3 | 2006-05-21 21:37:21 +0000 | [diff] [blame] | 525 | const char *nano_replace_msg = |
| 526 | N_("Replace a string or a regular expression"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 527 | const char *nano_gotoline_msg = N_("Go to line and column number"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 528 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8381fdd | 2004-11-01 22:40:02 +0000 | [diff] [blame] | 529 | const char *nano_mark_msg = N_("Mark text at the cursor position"); |
| 530 | const char *nano_whereis_next_msg = N_("Repeat last search"); |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 531 | const char *nano_copy_msg = |
| 532 | N_("Copy the current line and store it in the cutbuffer"); |
David Lawrence Ramsey | aee00d4 | 2006-07-05 18:42:22 +0000 | [diff] [blame] | 533 | const char *nano_indent_msg = N_("Indent the current line"); |
| 534 | const char *nano_unindent_msg = N_("Unindent the current line"); |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 535 | const char *nano_undo_msg = N_("Undo the last operation"); |
| 536 | const char *nano_redo_msg = N_("Redo the last undone operation"); |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 537 | #endif |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 538 | const char *nano_forward_msg = N_("Go forward one character"); |
| 539 | const char *nano_back_msg = N_("Go back one character"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 540 | #ifndef NANO_TINY |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 541 | const char *nano_nextword_msg = N_("Go forward one word"); |
| 542 | const char *nano_prevword_msg = N_("Go back one word"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 543 | #endif |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 544 | const char *nano_prevline_msg = N_("Go to previous line"); |
| 545 | const char *nano_nextline_msg = N_("Go to next line"); |
| 546 | const char *nano_home_msg = N_("Go to beginning of current line"); |
| 547 | const char *nano_end_msg = N_("Go to end of current line"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 548 | #ifndef DISABLE_JUSTIFY |
| 549 | const char *nano_parabegin_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 550 | N_("Go to beginning of paragraph; then of previous paragraph"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 551 | const char *nano_paraend_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 552 | N_("Go just beyond end of paragraph; then of next paragraph"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 553 | #endif |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 554 | const char *nano_firstline_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 555 | N_("Go to the first line of the file"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 556 | const char *nano_lastline_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 557 | N_("Go to the last line of the file"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 558 | #ifndef NANO_TINY |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 559 | const char *nano_bracket_msg = N_("Go to the matching bracket"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 560 | const char *nano_scrollup_msg = |
| 561 | N_("Scroll up one line without scrolling the cursor"); |
| 562 | const char *nano_scrolldown_msg = |
| 563 | N_("Scroll down one line without scrolling the cursor"); |
| 564 | #endif |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 565 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 566 | const char *nano_prevfile_msg = |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 567 | N_("Switch to the previous file buffer"); |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 568 | const char *nano_nextfile_msg = |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 569 | N_("Switch to the next file buffer"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 570 | #endif |
David Lawrence Ramsey | 40e0572 | 2006-04-23 19:21:12 +0000 | [diff] [blame] | 571 | const char *nano_verbatim_msg = |
David Lawrence Ramsey | 939d423 | 2006-04-24 21:00:17 +0000 | [diff] [blame] | 572 | N_("Insert the next keystroke verbatim"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 573 | const char *nano_tab_msg = |
David Lawrence Ramsey | bf78420 | 2006-04-29 13:59:04 +0000 | [diff] [blame] | 574 | N_("Insert a tab at the cursor position"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 575 | const char *nano_enter_msg = |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 576 | N_("Insert a newline at the cursor position"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 577 | const char *nano_delete_msg = |
| 578 | N_("Delete the character under the cursor"); |
| 579 | const char *nano_backspace_msg = |
| 580 | N_("Delete the character to the left of the cursor"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 581 | #ifndef NANO_TINY |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 582 | const char *nano_cut_till_end_msg = |
| 583 | N_("Cut from the cursor position to the end of the file"); |
| 584 | #endif |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 585 | #ifndef DISABLE_JUSTIFY |
| 586 | const char *nano_fulljustify_msg = N_("Justify the entire file"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 587 | #endif |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 588 | #ifndef NANO_TINY |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 589 | const char *nano_wordcount_msg = |
| 590 | N_("Count the number of words, lines, and characters"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 591 | #endif |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 592 | const char *nano_refresh_msg = |
| 593 | N_("Refresh (redraw) the current screen"); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 594 | const char *nano_suspend_msg = |
| 595 | N_("Suspend the editor (if suspend is enabled)"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 596 | #ifndef NANO_TINY |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 597 | const char *nano_case_msg = |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 598 | N_("Toggle the case sensitivity of the search"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 599 | const char *nano_reverse_msg = |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 600 | N_("Reverse the direction of the search"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 601 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 602 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 603 | const char *nano_regexp_msg = |
| 604 | N_("Toggle the use of regular expressions"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 605 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 606 | #ifndef NANO_TINY |
David Lawrence Ramsey | 305d889 | 2006-05-24 19:48:03 +0000 | [diff] [blame] | 607 | const char *nano_prev_history_msg = |
David Lawrence Ramsey | 7b0531a | 2006-07-31 01:30:31 +0000 | [diff] [blame] | 608 | N_("Recall the previous search/replace string"); |
David Lawrence Ramsey | 305d889 | 2006-05-24 19:48:03 +0000 | [diff] [blame] | 609 | const char *nano_next_history_msg = |
David Lawrence Ramsey | 7b0531a | 2006-07-31 01:30:31 +0000 | [diff] [blame] | 610 | N_("Recall the next search/replace string"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 611 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 612 | #ifndef DISABLE_BROWSER |
| 613 | const char *nano_tofiles_msg = N_("Go to file browser"); |
| 614 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 615 | #ifndef NANO_TINY |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 616 | const char *nano_dos_msg = N_("Toggle the use of DOS format"); |
| 617 | const char *nano_mac_msg = N_("Toggle the use of Mac format"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 618 | #endif |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 619 | const char *nano_append_msg = N_("Toggle appending"); |
| 620 | const char *nano_prepend_msg = N_("Toggle prepending"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 621 | #ifndef NANO_TINY |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 622 | const char *nano_backup_msg = |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 623 | N_("Toggle backing up of the original file"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 624 | const char *nano_execute_msg = N_("Execute external command"); |
| 625 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 626 | #if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER) |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 627 | const char *nano_multibuffer_msg = |
| 628 | N_("Toggle the use of a new buffer"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 629 | #endif |
| 630 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 631 | const char *nano_exitbrowser_msg = N_("Exit from the file browser"); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 632 | const char *nano_firstfile_msg = |
| 633 | N_("Go to the first file in the list"); |
| 634 | const char *nano_lastfile_msg = |
| 635 | N_("Go to the last file in the list"); |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 636 | const char *nano_gotodir_msg = N_("Go to directory"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 637 | |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 638 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 639 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 640 | |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 641 | #ifndef DISABLE_HELP |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 642 | #define IFSCHELP(help) help |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 643 | #else |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 644 | #define IFSCHELP(help) "" |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 645 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 646 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 647 | while (allfuncs != NULL) { |
| 648 | subnfunc *f = allfuncs; |
| 649 | allfuncs = (allfuncs)->next; |
| 650 | free(f); |
| 651 | } |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 652 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 653 | add_to_funcs(DO_HELP_VOID, MALL, get_help_msg, IFSCHELP(nano_help_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 654 | FALSE, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 655 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 656 | add_to_funcs( CANCEL_MSG, |
Chris Allegretta | cc59383 | 2008-03-19 02:32:48 +0000 | [diff] [blame] | 657 | (MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 658 | cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 659 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 660 | add_to_funcs(DO_EXIT, MMAIN, |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 661 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 662 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
David Lawrence Ramsey | 017dde2 | 2006-03-24 05:28:03 +0000 | [diff] [blame] | 663 | openfile != NULL && openfile != openfile->next ? N_("Close") : |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 664 | #endif |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 665 | exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 666 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 667 | add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW); |
Chris Allegretta | 90ee8ee | 2008-03-20 04:45:55 +0000 | [diff] [blame] | 668 | |
Chris Allegretta | dcd19c9 | 2008-03-20 04:51:26 +0000 | [diff] [blame] | 669 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 670 | add_to_funcs(DO_EXIT, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW); |
Chris Allegretta | dcd19c9 | 2008-03-20 04:51:26 +0000 | [diff] [blame] | 671 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 672 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 673 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 674 | add_to_funcs(DO_WRITEOUT_VOID, MMAIN, N_("WriteOut"), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 675 | IFSCHELP(nano_writeout_msg), FALSE, NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 676 | |
David Lawrence Ramsey | a539fce | 2004-06-29 00:43:56 +0000 | [diff] [blame] | 677 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 678 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 679 | add_to_funcs(DO_JUSTIFY_VOID, MMAIN, N_("Justify"), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 680 | nano_justify_msg, TRUE, NOVIEW); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 681 | #endif |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 682 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 683 | /* We allow inserting files in view mode if multibuffers are |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 684 | * available, so that we can view multiple files. If we're using |
| 685 | * restricted mode, inserting files is disabled, since it allows |
| 686 | * reading from or writing to files not specified on the command |
| 687 | * line. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 688 | add_to_funcs(!ISSET(RESTRICTED) ? DO_INSERTFILE_VOID : NANO_DISABLED_MSG, |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 689 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 690 | MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE, |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 691 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 692 | VIEW); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 693 | #else |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 694 | NOVIEW); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 695 | #endif |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 696 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 697 | add_to_funcs(DO_SEARCH, MMAIN|MBROWSER, whereis_msg, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 698 | IFSCHELP(nano_whereis_msg), FALSE, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 699 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 700 | add_to_funcs(DO_PAGE_UP, MMAIN|MHELP, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 701 | prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 702 | add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 703 | next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 704 | |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 705 | |
David Lawrence Ramsey | cde9039 | 2006-04-09 18:27:42 +0000 | [diff] [blame] | 706 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 707 | add_to_funcs(DO_CUT_TEXT_VOID, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 708 | FALSE, NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 709 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 710 | if (unjustify) |
David Lawrence Ramsey | ed467e5 | 2006-07-03 18:40:53 +0000 | [diff] [blame] | 711 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 712 | add_to_funcs(DO_UNCUT_TEXT, MMAIN, N_("UnJustify"), "", |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 713 | FALSE, NOVIEW); |
| 714 | |
Chris Allegretta | 0779835 | 2000-11-27 22:58:23 +0000 | [diff] [blame] | 715 | else |
David Lawrence Ramsey | ed467e5 | 2006-07-03 18:40:53 +0000 | [diff] [blame] | 716 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 717 | add_to_funcs(DO_UNCUT_TEXT, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 718 | FALSE, NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 719 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 720 | #ifndef NANO_TINY |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 721 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 722 | add_to_funcs(DO_CURSORPOS_VOID, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 723 | FALSE, VIEW); |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 724 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 725 | |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 726 | /* If we're using restricted mode, spell checking is disabled |
| 727 | * because it allows reading from or writing to files not specified |
| 728 | * on the command line. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 729 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 730 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 731 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 732 | add_to_funcs(DO_SPELL, MMAIN, N_("To Spell"), IFSCHELP(nano_spell_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 733 | TRUE, NOVIEW); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 734 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 735 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 736 | add_to_funcs(DO_FIRST_LINE, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 737 | (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP), |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 738 | first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 739 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 740 | add_to_funcs(DO_LAST_LINE, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 741 | (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 742 | last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 743 | |
| 744 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 745 | add_to_funcs(DO_GOTOLINECOLUMN_VOID, (MMAIN|MWHEREIS), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 746 | go_to_line_msg, IFSCHELP(nano_gotoline_msg), FALSE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 747 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 748 | #ifdef NANO_TINY |
Chris Allegretta | 1fb25fd | 2008-03-18 03:06:27 +0000 | [diff] [blame] | 749 | /* TRANSLATORS: Try to keep this at most 10 characters. */ |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 750 | add_to_funcs(DO_CURSORPOS_VOID, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 751 | FALSE, VIEW); |
| 752 | #endif |
| 753 | |
| 754 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 755 | add_to_funcs(DO_REPLACE, (MMAIN|MWHEREIS), replace_msg, IFSCHELP(nano_replace_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 756 | |
David Lawrence Ramsey | f1e5627 | 2006-05-22 18:28:20 +0000 | [diff] [blame] | 757 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 758 | FALSE, |
David Lawrence Ramsey | f1e5627 | 2006-05-22 18:28:20 +0000 | [diff] [blame] | 759 | #else |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 760 | TRUE, |
David Lawrence Ramsey | f1e5627 | 2006-05-22 18:28:20 +0000 | [diff] [blame] | 761 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 762 | NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 763 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 764 | #ifndef NANO_TINY |
David Lawrence Ramsey | efb4b0a | 2006-04-19 14:09:01 +0000 | [diff] [blame] | 765 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 766 | add_to_funcs(DO_MARK, MMAIN, N_("Mark Text"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 767 | IFSCHELP(nano_mark_msg), FALSE, VIEW); |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 768 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 769 | add_to_funcs(DO_RESEARCH, (MMAIN|MBROWSER), whereis_next_msg, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 770 | IFSCHELP(nano_whereis_next_msg), TRUE, VIEW); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 771 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 772 | add_to_funcs(DO_COPY_TEXT, MMAIN, N_("Copy Text"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 773 | IFSCHELP(nano_copy_msg), FALSE, NOVIEW); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 774 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 775 | add_to_funcs(DO_INDENT_VOID, MMAIN, N_("Indent Text"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 776 | IFSCHELP(nano_indent_msg), FALSE, NOVIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 777 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 778 | add_to_funcs(DO_UNINDENT, MMAIN, N_("Unindent Text"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 779 | IFSCHELP(nano_unindent_msg), FALSE, NOVIEW); |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 780 | |
Chris Allegretta | a48507d | 2009-08-14 03:18:29 +0000 | [diff] [blame^] | 781 | if (ISSET(UNDOABLE)) { |
Chris Allegretta | ad37e67 | 2009-07-12 03:36:58 +0000 | [diff] [blame] | 782 | add_to_funcs(DO_UNDO, MMAIN, N_("Undo"), |
| 783 | IFSCHELP(nano_undo_msg), FALSE, NOVIEW); |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 784 | |
Chris Allegretta | ad37e67 | 2009-07-12 03:36:58 +0000 | [diff] [blame] | 785 | add_to_funcs(DO_REDO, MMAIN, N_("Redo"), |
| 786 | IFSCHELP(nano_redo_msg), TRUE, NOVIEW); |
| 787 | } |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 788 | |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 789 | #endif |
| 790 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 791 | add_to_funcs(DO_PAGE_UP, MBROWSER, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 792 | prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 793 | add_to_funcs(DO_PAGE_DOWN, MBROWSER, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 794 | next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 795 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 796 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 797 | add_to_funcs(DO_RIGHT, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 798 | FALSE, VIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 799 | add_to_funcs(DO_RIGHT, MALL, "", "", FALSE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 800 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 801 | add_to_funcs(DO_LEFT, (MMAIN|MBROWSER), N_("Back"), IFSCHELP(nano_back_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 802 | FALSE, VIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 803 | add_to_funcs(DO_LEFT, MALL, "", "", FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 804 | |
| 805 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 806 | add_to_funcs(DO_NEXT_WORD_VOID, MMAIN, N_("Next Word"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 807 | IFSCHELP(nano_nextword_msg), FALSE, VIEW); |
David Lawrence Ramsey | c596755 | 2002-06-21 03:20:06 +0000 | [diff] [blame] | 808 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 809 | add_to_funcs(DO_PREV_WORD_VOID, MMAIN, N_("Prev Word"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 810 | IFSCHELP(nano_prevword_msg), FALSE, VIEW); |
Chris Allegretta | 8d990b5 | 2001-09-22 22:14:25 +0000 | [diff] [blame] | 811 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 812 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 813 | add_to_funcs(DO_UP_VOID, (MMAIN|MHELP|MBROWSER), N_("Prev Line"), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 814 | IFSCHELP(nano_prevline_msg), FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 815 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 816 | add_to_funcs(DO_DOWN_VOID, (MMAIN|MHELP|MBROWSER), N_("Next Line"), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 817 | IFSCHELP(nano_nextline_msg), TRUE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 818 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 819 | add_to_funcs(DO_HOME, MMAIN, N_("Home"), IFSCHELP(nano_home_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 820 | FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 821 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 822 | add_to_funcs(DO_END, MMAIN, N_("End"), IFSCHELP(nano_end_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 823 | FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 824 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 825 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 826 | add_to_funcs(DO_PARA_BEGIN_VOID, (MMAIN|MWHEREIS), beg_of_par_msg, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 827 | IFSCHELP(nano_parabegin_msg), FALSE, VIEW); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 828 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 829 | add_to_funcs(DO_PARA_END_VOID, (MMAIN|MWHEREIS), end_of_par_msg, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 830 | IFSCHELP(nano_paraend_msg), FALSE, VIEW); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 831 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 832 | |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 833 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 834 | add_to_funcs(DO_FIND_BRACKET, MMAIN, _("Find Other Bracket"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 835 | IFSCHELP(nano_bracket_msg), FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 836 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 837 | add_to_funcs(DO_SCROLL_UP, MMAIN, N_("Scroll Up"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 838 | IFSCHELP(nano_scrollup_msg), FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 839 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 840 | add_to_funcs(DO_SCROLL_DOWN, MMAIN, N_("Scroll Down"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 841 | IFSCHELP(nano_scrolldown_msg), FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 842 | #endif |
David Lawrence Ramsey | df45365 | 2006-04-21 02:05:09 +0000 | [diff] [blame] | 843 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 844 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 845 | add_to_funcs(SWITCH_TO_PREV_BUFFER_VOID, MMAIN, _("Previous File"), |
Chris Allegretta | 2cca483 | 2008-03-31 06:25:14 +0000 | [diff] [blame] | 846 | IFSCHELP(nano_prevfile_msg), FALSE, VIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 847 | add_to_funcs(SWITCH_TO_NEXT_BUFFER_VOID, MMAIN, N_("Next File"), |
Chris Allegretta | 2cca483 | 2008-03-31 06:25:14 +0000 | [diff] [blame] | 848 | IFSCHELP(nano_nextfile_msg), TRUE, VIEW); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 849 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 850 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 851 | add_to_funcs(DO_VERBATIM_INPUT, MMAIN, N_("Verbatim Input"), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 852 | IFSCHELP(nano_verbatim_msg), FALSE, NOVIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 853 | add_to_funcs(DO_VERBATIM_INPUT, MWHEREIS|MREPLACE|MREPLACE2|MEXTCMD|MSPELL, |
Chris Allegretta | aa17df0 | 2008-03-17 05:50:04 +0000 | [diff] [blame] | 854 | "", "", FALSE, NOVIEW); |
| 855 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 856 | add_to_funcs(DO_TAB, MMAIN, N_("Tab"), IFSCHELP(nano_tab_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 857 | FALSE, NOVIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 858 | add_to_funcs(DO_TAB, MALL, "", "", FALSE, NOVIEW); |
| 859 | add_to_funcs(DO_ENTER, MMAIN, N_("Enter"), IFSCHELP(nano_enter_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 860 | FALSE, NOVIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 861 | add_to_funcs(DO_ENTER, MALL, "", "", FALSE, NOVIEW); |
| 862 | add_to_funcs(DO_DELETE, MMAIN, N_("Delete"), IFSCHELP(nano_delete_msg), |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 863 | FALSE, NOVIEW); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 864 | add_to_funcs(DO_DELETE, MALL, "", "", FALSE, NOVIEW); |
| 865 | add_to_funcs(DO_BACKSPACE, MMAIN, N_("Backspace"), IFSCHELP(nano_backspace_msg), |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 866 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 867 | FALSE, |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 868 | #else |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 869 | TRUE, |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 870 | #endif |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 871 | NOVIEW); |
| 872 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 873 | add_to_funcs(DO_BACKSPACE, MALL, "", "", |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 874 | #ifndef NANO_TINY |
| 875 | FALSE, |
| 876 | #else |
| 877 | TRUE, |
| 878 | #endif |
| 879 | NOVIEW); |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 880 | |
David Lawrence Ramsey | 2ca2356 | 2006-04-23 19:15:15 +0000 | [diff] [blame] | 881 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 882 | add_to_funcs(DO_CUT_TILL_END, MMAIN, N_("CutTillEnd"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 883 | IFSCHELP(nano_cut_till_end_msg), TRUE, NOVIEW); |
David Lawrence Ramsey | 2ca2356 | 2006-04-23 19:15:15 +0000 | [diff] [blame] | 884 | #endif |
| 885 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 886 | add_to_funcs(XON_COMPLAINT, MMAIN, "", "", FALSE, VIEW); |
| 887 | add_to_funcs(XOFF_COMPLAINT, MMAIN, "", "", FALSE, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 888 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 889 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 890 | add_to_funcs(DO_FULL_JUSTIFY, (MMAIN|MWHEREIS), fulljstify_msg, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 891 | IFSCHELP(nano_fulljustify_msg), FALSE, NOVIEW); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 892 | #endif |
| 893 | |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 894 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 895 | add_to_funcs(DO_WORDLINECHAR_COUNT, MMAIN, N_("Word Count"), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 896 | IFSCHELP(nano_wordcount_msg), FALSE, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 897 | #endif |
David Lawrence Ramsey | efb4b0a | 2006-04-19 14:09:01 +0000 | [diff] [blame] | 898 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 899 | add_to_funcs(TOTAL_REFRESH, (MMAIN|MHELP), refresh_msg, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 900 | IFSCHELP(nano_refresh_msg), FALSE, VIEW); |
| 901 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 902 | add_to_funcs(DO_SUSPEND_VOID, MMAIN, suspend_msg, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 903 | IFSCHELP(nano_suspend_msg), TRUE, VIEW); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 904 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 905 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 906 | add_to_funcs( CASE_SENS_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 907 | (MWHEREIS|MREPLACE|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 908 | case_sens_msg, IFSCHELP(nano_case_msg), FALSE, VIEW); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 909 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 910 | add_to_funcs( BACKWARDS_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 911 | (MWHEREIS|MREPLACE|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 912 | backwards_msg, IFSCHELP(nano_reverse_msg), FALSE, VIEW); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 913 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 914 | |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 915 | #ifdef HAVE_REGEX_H |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 916 | add_to_funcs( REGEXP_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 917 | (MWHEREIS|MREPLACE|MWHEREISFILE), |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 918 | regexp_msg, IFSCHELP(nano_regexp_msg), FALSE, VIEW); |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 919 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 920 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 921 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 922 | add_to_funcs( PREV_HISTORY_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 923 | (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 924 | prev_history_msg, IFSCHELP(nano_prev_history_msg), FALSE, VIEW); |
David Lawrence Ramsey | 305d889 | 2006-05-24 19:48:03 +0000 | [diff] [blame] | 925 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 926 | add_to_funcs( NEXT_HISTORY_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 927 | (MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 928 | next_history_msg, IFSCHELP(nano_next_history_msg), FALSE, VIEW); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 929 | #endif |
David Lawrence Ramsey | 02085d7 | 2004-11-07 16:04:18 +0000 | [diff] [blame] | 930 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 931 | add_to_funcs( NO_REPLACE_MSG, MREPLACE, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 932 | no_replace_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW); |
Chris Allegretta | 5f36c37 | 2001-07-16 00:48:53 +0000 | [diff] [blame] | 933 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 934 | add_to_funcs( GOTOTEXT_MSG, MGOTOLINE, |
Chris Allegretta | 10f868d | 2008-03-14 04:08:51 +0000 | [diff] [blame] | 935 | gototext_msg, IFSCHELP(nano_whereis_msg), TRUE, VIEW); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 936 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 937 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 938 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 939 | add_to_funcs( TO_FILES_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 940 | (MGOTOLINE|MINSERTFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 941 | to_files_msg, IFSCHELP(nano_tofiles_msg), FALSE, VIEW); |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 942 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 943 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 944 | #ifndef NANO_TINY |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 945 | /* If we're using restricted mode, the DOS format, Mac format, |
| 946 | * append, prepend, and backup toggles are disabled. The first and |
| 947 | * second are useless since inserting files is disabled, the third |
| 948 | * and fourth are disabled because they allow writing to files not |
| 949 | * specified on the command line, and the fifth is useless since |
| 950 | * backups are disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 951 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 952 | add_to_funcs( DOS_FORMAT_MSG, MWRITEFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 953 | dos_format_msg, IFSCHELP(nano_dos_msg), FALSE, NOVIEW); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 954 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 955 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 956 | add_to_funcs( MAC_FORMAT_MSG, MWRITEFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 957 | mac_format_msg, IFSCHELP(nano_mac_msg), FALSE, NOVIEW); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 958 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 959 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 960 | add_to_funcs( APPEND_MSG, MWRITEFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 961 | append_msg, IFSCHELP(nano_append_msg), FALSE, NOVIEW); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 962 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 963 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 964 | add_to_funcs( PREPEND_MSG, MWRITEFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 965 | prepend_msg, IFSCHELP(nano_prepend_msg), FALSE, NOVIEW); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 966 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 967 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 968 | add_to_funcs( BACKUP_FILE_MSG, MWRITEFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 969 | backup_file_msg, IFSCHELP(nano_backup_msg), FALSE, NOVIEW); |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 970 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 971 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 972 | #ifndef NANO_TINY |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 973 | /* If we're using restricted mode, command execution is disabled. |
| 974 | * It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 975 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 976 | add_to_funcs( EXT_CMD_MSG, MINSERTFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 977 | ext_cmd_msg, IFSCHELP(nano_execute_msg), FALSE, NOVIEW); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 978 | |
Chris Allegretta | f7c6811 | 2002-09-03 22:58:40 +0000 | [diff] [blame] | 979 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 32e3b88 | 2004-05-29 01:20:17 +0000 | [diff] [blame] | 980 | /* If we're using restricted mode, the multibuffer toggle is |
| 981 | * disabled. It's useless since inserting files is disabled. */ |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 982 | if (!ISSET(RESTRICTED)) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 983 | add_to_funcs( NEW_BUFFER_MSG, MINSERTFILE, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 984 | new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 985 | #endif |
Chris Allegretta | cc197ef | 2001-05-29 04:21:44 +0000 | [diff] [blame] | 986 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 987 | add_to_funcs( INSERT_FILE_MSG, MEXTCMD, |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 988 | insert_file_msg, IFSCHELP(nano_insert_msg), FALSE, VIEW); |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 989 | |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 990 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 991 | add_to_funcs( NEW_BUFFER_MSG, MEXTCMD, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 992 | new_buffer_msg, IFSCHELP(nano_multibuffer_msg), FALSE, NOVIEW); |
Chris Allegretta | 52c5a6e | 2002-03-21 05:07:28 +0000 | [diff] [blame] | 993 | #endif |
David Lawrence Ramsey | 47e82b1 | 2004-09-28 22:21:46 +0000 | [diff] [blame] | 994 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 995 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 996 | #ifndef DISABLE_HELP |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 997 | add_to_funcs( REFRESH_MSG, MHELP, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 998 | refresh_msg, nano_refresh_msg, FALSE, VIEW); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 999 | #endif |
| 1000 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 1001 | #ifndef DISABLE_BROWSER |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1002 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1003 | add_to_funcs( FIRST_FILE_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1004 | (MBROWSER|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 1005 | first_file_msg, IFSCHELP(nano_firstfile_msg), FALSE, VIEW); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1006 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1007 | add_to_funcs( LAST_FILE_MSG, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1008 | (MBROWSER|MWHEREISFILE), |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 1009 | last_file_msg, IFSCHELP(nano_lastfile_msg), FALSE, VIEW); |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1010 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1011 | add_to_funcs( GOTO_DIR_MSG, MBROWSER, |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 1012 | goto_dir_msg, IFSCHELP(nano_gotodir_msg), FALSE, VIEW); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1013 | #endif |
| 1014 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1015 | currmenu = MMAIN; |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 1016 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1017 | add_to_sclist(MALL, "^G", DO_HELP_VOID, 0, TRUE); |
| 1018 | add_to_sclist(MALL, "F1", DO_HELP_VOID, 0, TRUE); |
| 1019 | add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", DO_EXIT, 0, TRUE); |
| 1020 | add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", DO_EXIT, 0, TRUE); |
| 1021 | add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE); |
| 1022 | add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE); |
| 1023 | add_to_sclist(MMAIN, "^O", DO_WRITEOUT_VOID, 0, TRUE); |
| 1024 | add_to_sclist(MMAIN, "F3", DO_WRITEOUT_VOID, 0, TRUE); |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1025 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1026 | add_to_sclist(MMAIN, "^J", DO_JUSTIFY_VOID, 0, TRUE); |
| 1027 | add_to_sclist(MMAIN, "F4", DO_JUSTIFY_VOID, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1028 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1029 | add_to_sclist(MMAIN, "^R", DO_INSERTFILE_VOID, 0, TRUE); |
| 1030 | add_to_sclist(MMAIN, "F5", DO_INSERTFILE_VOID, 0, TRUE); |
| 1031 | add_to_sclist(MMAIN, "kinsert", DO_INSERTFILE_VOID, 0, TRUE); |
| 1032 | add_to_sclist(MMAIN|MBROWSER, "^W", DO_SEARCH, 0, TRUE); |
| 1033 | add_to_sclist(MMAIN|MBROWSER, "F6", DO_SEARCH, 0, TRUE); |
| 1034 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^Y", DO_PAGE_UP, 0, TRUE); |
| 1035 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F7", DO_PAGE_UP, 0, TRUE); |
| 1036 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpup", DO_PAGE_UP, 0, TRUE); |
| 1037 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^V", DO_PAGE_DOWN, 0, TRUE); |
| 1038 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F8", DO_PAGE_DOWN, 0, TRUE); |
| 1039 | add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpdown", DO_PAGE_DOWN, 0, TRUE); |
| 1040 | add_to_sclist(MMAIN, "^K", DO_CUT_TEXT_VOID, 0, TRUE); |
| 1041 | add_to_sclist(MMAIN, "F9", DO_CUT_TEXT_VOID, 0, TRUE); |
| 1042 | add_to_sclist(MMAIN, "^U", DO_UNCUT_TEXT, 0, TRUE); |
| 1043 | add_to_sclist(MMAIN, "F10", DO_UNCUT_TEXT, 0, TRUE); |
| 1044 | add_to_sclist(MMAIN, "^C", DO_CURSORPOS_VOID, 0, TRUE); |
| 1045 | add_to_sclist(MMAIN, "F11", DO_CURSORPOS_VOID, 0, TRUE); |
Chris Allegretta | 506af6f | 2008-05-31 22:49:55 +0000 | [diff] [blame] | 1046 | #ifndef DISABLE_SPELLER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1047 | add_to_sclist(MMAIN, "^T", DO_SPELL, 0, TRUE); |
| 1048 | add_to_sclist(MMAIN, "F12", DO_SPELL, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1049 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1050 | add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE); |
| 1051 | add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE); |
| 1052 | add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE); |
| 1053 | add_to_sclist(MMAIN, "^\\", DO_REPLACE, 0, TRUE); |
| 1054 | add_to_sclist(MMAIN, "F14", DO_REPLACE, 0, TRUE); |
| 1055 | add_to_sclist(MMAIN, "M-R", DO_REPLACE, 0, TRUE); |
| 1056 | add_to_sclist(MWHEREIS, "^R", DO_REPLACE, 0, FALSE); |
| 1057 | add_to_sclist(MREPLACE, "^R", NO_REPLACE_MSG, 0, FALSE); |
| 1058 | add_to_sclist(MWHEREIS, "^T", DO_GOTOLINECOLUMN_VOID, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1059 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1060 | add_to_sclist(MMAIN, "^^", DO_MARK, 0, TRUE); |
| 1061 | add_to_sclist(MMAIN, "F15", DO_MARK, 0, TRUE); |
| 1062 | add_to_sclist(MMAIN, "M-A", DO_MARK, 0, TRUE); |
| 1063 | add_to_sclist(MALL, "M-W", DO_RESEARCH, 0, TRUE); |
| 1064 | add_to_sclist(MALL, "F16", DO_RESEARCH, 0, TRUE); |
| 1065 | add_to_sclist(MMAIN, "M-^", DO_COPY_TEXT, 0, TRUE); |
| 1066 | add_to_sclist(MMAIN, "M-6", DO_COPY_TEXT, 0, TRUE); |
| 1067 | add_to_sclist(MMAIN, "M-}", DO_INDENT_VOID, 0, TRUE); |
| 1068 | add_to_sclist(MMAIN, "M-{", DO_UNINDENT, 0, TRUE); |
Chris Allegretta | a48507d | 2009-08-14 03:18:29 +0000 | [diff] [blame^] | 1069 | if (ISSET(UNDOABLE)) { |
Chris Allegretta | ad37e67 | 2009-07-12 03:36:58 +0000 | [diff] [blame] | 1070 | add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE); |
| 1071 | add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE); |
| 1072 | } |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1073 | add_to_sclist(MALL, "^F", DO_RIGHT, 0, TRUE); |
| 1074 | add_to_sclist(MALL, "^B", DO_LEFT, 0, TRUE); |
| 1075 | add_to_sclist(MMAIN, "^Space", DO_NEXT_WORD_VOID, 0, TRUE); |
| 1076 | add_to_sclist(MMAIN, "M-Space", DO_PREV_WORD_VOID, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1077 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1078 | add_to_sclist(MALL, "kright", DO_RIGHT, 0, TRUE); |
| 1079 | add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE); |
| 1080 | add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE); |
| 1081 | add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE); |
| 1082 | add_to_sclist(MMAIN, "^P", DO_UP_VOID, 0, TRUE); |
| 1083 | add_to_sclist(MMAIN, "kup", DO_UP_VOID, 0, TRUE); |
| 1084 | add_to_sclist(MMAIN, "^N", DO_DOWN_VOID, 0, TRUE); |
| 1085 | add_to_sclist(MMAIN, "kdown", DO_DOWN_VOID, 0, TRUE); |
| 1086 | add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE); |
| 1087 | add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE); |
| 1088 | add_to_sclist(MALL, "^E", DO_END, 0, TRUE); |
| 1089 | add_to_sclist(MALL, "kend", DO_END, 0, TRUE); |
Chris Allegretta | 1b6ed07 | 2008-06-03 08:09:05 +0000 | [diff] [blame] | 1090 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1091 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", PREV_HISTORY_MSG, 0, FALSE); |
| 1092 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", PREV_HISTORY_MSG, 0, FALSE); |
| 1093 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", NEXT_HISTORY_MSG, 0, FALSE); |
| 1094 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", NEXT_HISTORY_MSG, 0, FALSE); |
Chris Allegretta | 1b6ed07 | 2008-06-03 08:09:05 +0000 | [diff] [blame] | 1095 | #endif |
Chris Allegretta | 1347f22 | 2008-06-29 06:22:31 +0000 | [diff] [blame] | 1096 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1097 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1098 | "^W", DO_PARA_BEGIN_VOID, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1099 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1100 | "^O", DO_PARA_END_VOID, 0, TRUE); |
| 1101 | add_to_sclist(MALL, "M-(", DO_PARA_BEGIN_VOID, 0, TRUE); |
| 1102 | add_to_sclist(MALL, "M-9", DO_PARA_BEGIN_VOID, 0, TRUE); |
| 1103 | add_to_sclist(MALL, "M-)", DO_PARA_END_VOID, 0, TRUE); |
| 1104 | add_to_sclist(MALL, "M-0", DO_PARA_END_VOID, 0, TRUE); |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1105 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1106 | add_to_sclist(MWHEREIS, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1107 | "M-C", CASE_SENS_MSG, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1108 | add_to_sclist(MREPLACE, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1109 | "M-C", CASE_SENS_MSG, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1110 | add_to_sclist(MREPLACE2, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1111 | "M-C", CASE_SENS_MSG, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1112 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1113 | "M-B", BACKWARDS_MSG, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1114 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1115 | "M-R", REGEXP_MSG, 0, FALSE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1116 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1117 | add_to_sclist(MMAIN, "M-\\", DO_FIRST_LINE, 0, TRUE); |
| 1118 | add_to_sclist(MMAIN, "M-|", DO_FIRST_LINE, 0, TRUE); |
| 1119 | add_to_sclist(MMAIN, "M-/", DO_LAST_LINE, 0, TRUE); |
| 1120 | add_to_sclist(MMAIN, "M-?", DO_LAST_LINE, 0, TRUE); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 1121 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1122 | "^Y", DO_FIRST_LINE, 0, TRUE); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 1123 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP, |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1124 | "^V", DO_LAST_LINE, 0, TRUE); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 1125 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1126 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", FIRST_FILE_MSG, 0, TRUE); |
| 1127 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", FIRST_FILE_MSG, 0, TRUE); |
| 1128 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", LAST_FILE_MSG, 0, TRUE); |
| 1129 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", LAST_FILE_MSG, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1130 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1131 | add_to_sclist(MMAIN, "M-]", DO_FIND_BRACKET, 0, TRUE); |
| 1132 | add_to_sclist(MMAIN, "M--", DO_SCROLL_UP, 0, TRUE); |
| 1133 | add_to_sclist(MMAIN, "M-_", DO_SCROLL_UP, 0, TRUE); |
| 1134 | add_to_sclist(MMAIN, "M-+", DO_SCROLL_DOWN, 0, TRUE); |
| 1135 | add_to_sclist(MMAIN, "M-=", DO_SCROLL_DOWN, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1136 | #endif |
| 1137 | |
| 1138 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1139 | add_to_sclist(MMAIN, "M-<", SWITCH_TO_PREV_BUFFER_VOID, 0, TRUE); |
| 1140 | add_to_sclist(MMAIN, "M-,", SWITCH_TO_PREV_BUFFER_VOID, 0, TRUE); |
| 1141 | add_to_sclist(MMAIN, "M->", SWITCH_TO_NEXT_BUFFER_VOID, 0, TRUE); |
| 1142 | add_to_sclist(MMAIN, "M-.", SWITCH_TO_NEXT_BUFFER_VOID, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1143 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1144 | add_to_sclist(MALL, "M-V", DO_VERBATIM_INPUT, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1145 | #ifndef NANO_TINY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1146 | add_to_sclist(MALL, "M-T", DO_CUT_TILL_END, 0, TRUE); |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1147 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1148 | add_to_sclist(MALL, "M-J", DO_FULL_JUSTIFY, 0, TRUE); |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1149 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1150 | add_to_sclist(MMAIN, "M-D", DO_WORDLINECHAR_COUNT, 0, TRUE); |
| 1151 | add_to_sclist(MMAIN, "M-X", DO_TOGGLE, NO_HELP, TRUE); |
| 1152 | add_to_sclist(MMAIN, "M-C", DO_TOGGLE, CONST_UPDATE, TRUE); |
| 1153 | add_to_sclist(MMAIN, "M-O", DO_TOGGLE, MORE_SPACE, TRUE); |
| 1154 | add_to_sclist(MMAIN, "M-S", DO_TOGGLE, SMOOTH_SCROLL, TRUE); |
| 1155 | add_to_sclist(MMAIN, "M-P", DO_TOGGLE, WHITESPACE_DISPLAY, TRUE); |
| 1156 | add_to_sclist(MMAIN, "M-Y", DO_TOGGLE, NO_COLOR_SYNTAX, TRUE); |
| 1157 | add_to_sclist(MMAIN, "M-H", DO_TOGGLE, SMART_HOME, TRUE); |
| 1158 | add_to_sclist(MMAIN, "M-I", DO_TOGGLE, AUTOINDENT, TRUE); |
| 1159 | add_to_sclist(MMAIN, "M-K", DO_TOGGLE, CUT_TO_END, TRUE); |
| 1160 | add_to_sclist(MMAIN, "M-L", DO_TOGGLE, NO_WRAP, TRUE); |
| 1161 | add_to_sclist(MMAIN, "M-Q", DO_TOGGLE, TABS_TO_SPACES, TRUE); |
| 1162 | add_to_sclist(MMAIN, "M-B", DO_TOGGLE, BACKUP_FILE, TRUE); |
| 1163 | add_to_sclist(MMAIN, "M-F", DO_TOGGLE, MULTIBUFFER, TRUE); |
| 1164 | add_to_sclist(MMAIN, "M-M", DO_TOGGLE, USE_MOUSE, TRUE); |
| 1165 | add_to_sclist(MMAIN, "M-N", DO_TOGGLE, NO_CONVERT, TRUE); |
| 1166 | add_to_sclist(MMAIN, "M-Z", DO_TOGGLE, SUSPEND, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1167 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1168 | add_to_sclist(MGOTOLINE, "^T", GOTOTEXT_MSG, 0, FALSE); |
| 1169 | add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", NEW_BUFFER_MSG, 0, FALSE); |
Chris Allegretta | cc59383 | 2008-03-19 02:32:48 +0000 | [diff] [blame] | 1170 | add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO), |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1171 | "^C", CANCEL_MSG, 0, FALSE); |
| 1172 | add_to_sclist(MHELP, "^X", DO_EXIT, 0, TRUE); |
| 1173 | add_to_sclist(MHELP, "F2", DO_EXIT, 0, TRUE); |
| 1174 | add_to_sclist(MWRITEFILE, "M-D", DOS_FORMAT_MSG, 0, FALSE); |
| 1175 | add_to_sclist(MWRITEFILE, "M-M", MAC_FORMAT_MSG, 0, FALSE); |
| 1176 | add_to_sclist(MWRITEFILE, "M-A", APPEND_MSG, 0, FALSE); |
| 1177 | add_to_sclist(MWRITEFILE, "M-P", PREPEND_MSG, 0, FALSE); |
| 1178 | add_to_sclist(MWRITEFILE, "M-B", BACKUP_FILE_MSG, 0, FALSE); |
| 1179 | add_to_sclist(MWRITEFILE, "^T", TO_FILES_MSG, 0, FALSE); |
| 1180 | add_to_sclist(MINSERTFILE, "^T", TO_FILES_MSG, 0, FALSE); |
| 1181 | add_to_sclist(MINSERTFILE, "^X", EXT_CMD_MSG, 0, FALSE); |
| 1182 | add_to_sclist(MMAIN, "^Z", DO_SUSPEND_VOID, 0, FALSE); |
| 1183 | add_to_sclist(MMAIN, "^L", TOTAL_REFRESH, 0, TRUE); |
| 1184 | add_to_sclist(MALL, "^I", DO_TAB, 0, TRUE); |
| 1185 | add_to_sclist(MALL, "^M", DO_ENTER, 0, TRUE); |
| 1186 | add_to_sclist(MALL, "kenter", DO_ENTER, 0, TRUE); |
| 1187 | add_to_sclist(MALL, "^D", DO_DELETE, 0, TRUE); |
| 1188 | add_to_sclist(MALL, "kdel", DO_DELETE, 0, TRUE); |
| 1189 | add_to_sclist(MALL, "^H", DO_BACKSPACE, 0, TRUE); |
| 1190 | add_to_sclist(MALL, "kbsp", DO_BACKSPACE, 0, TRUE); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1191 | |
| 1192 | #ifdef DEBUG |
| 1193 | print_sclist(); |
| 1194 | #endif |
| 1195 | |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1196 | } |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1197 | |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1198 | /* Given a function alias, execute the proper |
| 1199 | function, and then me */ |
| 1200 | void iso_me_harder_funcmap(short func) |
| 1201 | { |
| 1202 | if (func == TOTAL_REFRESH) |
| 1203 | total_refresh(); |
| 1204 | else if (func == DO_HELP_VOID) |
| 1205 | do_help_void(); |
| 1206 | else if (func == DO_SEARCH) |
| 1207 | do_search(); |
| 1208 | else if (func == DO_PAGE_UP) |
| 1209 | do_page_up(); |
| 1210 | else if (func == DO_PAGE_DOWN) |
| 1211 | do_page_down(); |
| 1212 | else if (func == DO_UP_VOID) |
| 1213 | do_up_void(); |
| 1214 | else if (func == DO_LEFT) |
| 1215 | do_left(); |
| 1216 | else if (func == DO_DOWN_VOID) |
| 1217 | do_down_void(); |
| 1218 | else if (func == DO_RIGHT) |
| 1219 | do_right(); |
| 1220 | else if (func == DO_ENTER) |
Chris Allegretta | e061a0d | 2009-04-25 03:31:30 +0000 | [diff] [blame] | 1221 | do_enter(FALSE); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1222 | else if (func == DO_EXIT) |
| 1223 | do_exit(); |
| 1224 | else if (func == DO_FIRST_LINE) |
| 1225 | do_first_line(); |
| 1226 | else if (func == DO_LAST_LINE) |
| 1227 | do_last_line(); |
| 1228 | else if (func == DO_BACKSPACE) |
| 1229 | do_backspace(); |
| 1230 | else if (func == DO_DELETE) |
| 1231 | do_delete(); |
| 1232 | else if (func == DO_TAB) |
| 1233 | do_tab(); |
| 1234 | else if (func == DO_VERBATIM_INPUT) |
| 1235 | do_verbatim_input(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1236 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1237 | else if (func == SWITCH_TO_NEXT_BUFFER_VOID) |
| 1238 | switch_to_next_buffer_void(); |
| 1239 | else if (func == SWITCH_TO_PREV_BUFFER_VOID) |
| 1240 | switch_to_prev_buffer_void(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1241 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1242 | else if (func == DO_END) |
| 1243 | do_end(); |
| 1244 | else if (func == DO_HOME) |
| 1245 | do_home(); |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1246 | else if (func == DO_SUSPEND_VOID) |
| 1247 | do_suspend_void(); |
| 1248 | else if (func == DO_WRITEOUT_VOID) |
| 1249 | do_writeout_void(); |
| 1250 | else if (func == DO_INSERTFILE_VOID) |
| 1251 | do_insertfile_void(); |
| 1252 | else if (func == DO_CUT_TEXT_VOID) |
| 1253 | do_cut_text_void(); |
| 1254 | else if (func == DO_UNCUT_TEXT) |
| 1255 | do_uncut_text(); |
| 1256 | else if (func == DO_CURSORPOS_VOID) |
| 1257 | do_cursorpos_void(); |
| 1258 | else if (func == DO_GOTOLINECOLUMN_VOID) |
| 1259 | do_gotolinecolumn_void(); |
| 1260 | else if (func == DO_REPLACE) |
| 1261 | do_replace(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1262 | else if (func == XOFF_COMPLAINT) |
| 1263 | xoff_complaint(); |
| 1264 | else if (func == XON_COMPLAINT) |
| 1265 | xon_complaint(); |
| 1266 | else if (func == DO_CUT_TEXT) |
| 1267 | do_cut_text_void(); |
| 1268 | #ifndef NANO_TINY |
| 1269 | else if (func == DO_CUT_TILL_END) |
| 1270 | do_cut_till_end(); |
| 1271 | else if (func == DO_REDO) |
| 1272 | do_redo(); |
| 1273 | else if (func == DO_UNDO) |
| 1274 | do_undo(); |
| 1275 | else if (func == DO_WORDLINECHAR_COUNT) |
| 1276 | do_wordlinechar_count(); |
| 1277 | else if (func == DO_FIND_BRACKET) |
| 1278 | do_find_bracket(); |
| 1279 | else if (func == DO_PREV_WORD_VOID) |
| 1280 | do_prev_word_void(); |
Chris Allegretta | 30f278f | 2009-01-31 16:13:03 +0000 | [diff] [blame] | 1281 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1282 | else if (func == DO_JUSTIFY_VOID) |
| 1283 | do_justify_void(); |
| 1284 | else if (func == DO_PARA_BEGIN_VOID) |
| 1285 | do_para_begin_void(); |
| 1286 | else if (func == DO_PARA_END_VOID) |
| 1287 | do_para_end_void(); |
| 1288 | else if (func == DO_FULL_JUSTIFY) |
| 1289 | do_full_justify(); |
Chris Allegretta | 30f278f | 2009-01-31 16:13:03 +0000 | [diff] [blame] | 1290 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1291 | else if (func == DO_MARK) |
| 1292 | do_mark(); |
| 1293 | else if (func == DO_RESEARCH) |
| 1294 | do_research(); |
| 1295 | else if (func == DO_COPY_TEXT) |
| 1296 | do_copy_text(); |
| 1297 | else if (func == DO_INDENT_VOID) |
| 1298 | do_indent_void(); |
| 1299 | else if (func == DO_UNINDENT) |
| 1300 | do_unindent(); |
| 1301 | else if (func == DO_SCROLL_UP) |
| 1302 | do_scroll_up(); |
| 1303 | else if (func == DO_SCROLL_DOWN) |
| 1304 | do_scroll_down(); |
| 1305 | else if (func == DO_NEXT_WORD_VOID) |
| 1306 | do_next_word_void(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1307 | #ifndef DISABLE_SPELLER |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1308 | else if (func == DO_SPELL) |
| 1309 | do_spell(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1310 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1311 | else if (func == DO_NEXT_WORD) |
| 1312 | do_next_word_void(); |
| 1313 | else if (func == DO_PREV_WORD) |
| 1314 | do_prev_word_void(); |
Chris Allegretta | 2d1bdd0 | 2009-01-28 05:11:57 +0000 | [diff] [blame] | 1315 | #endif |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1316 | } |
| 1317 | |
| 1318 | |
David Lawrence Ramsey | e6757b9 | 2006-04-19 13:36:56 +0000 | [diff] [blame] | 1319 | /* Free the given shortcut. */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1320 | void free_shortcutage(shortcut **shortcutage) |
| 1321 | { |
| 1322 | assert(shortcutage != NULL); |
David Lawrence Ramsey | 193b0e5 | 2005-06-06 18:41:17 +0000 | [diff] [blame] | 1323 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1324 | while (*shortcutage != NULL) { |
| 1325 | shortcut *ps = *shortcutage; |
| 1326 | *shortcutage = (*shortcutage)->next; |
| 1327 | free(ps); |
| 1328 | } |
| 1329 | } |
| 1330 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1331 | const subnfunc *sctofunc(sc *s) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1332 | { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1333 | subnfunc *f; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1334 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1335 | for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next) |
| 1336 | ; |
| 1337 | |
| 1338 | return f; |
| 1339 | } |
| 1340 | |
| 1341 | #ifndef NANO_TINY |
| 1342 | /* Now lets come up with a single (hopefully) |
| 1343 | function to get a string for each flag */ |
| 1344 | char *flagtostr(int flag) |
| 1345 | { |
| 1346 | switch (flag) { |
| 1347 | case NO_HELP: |
| 1348 | return N_("Help mode"); |
| 1349 | case CONST_UPDATE: |
| 1350 | return N_("Constant cursor position display"); |
| 1351 | case MORE_SPACE: |
| 1352 | return N_("Use of one more line for editing"); |
| 1353 | case SMOOTH_SCROLL: |
| 1354 | return N_("Smooth scrolling"); |
| 1355 | case WHITESPACE_DISPLAY: |
| 1356 | return N_("Whitespace display"); |
| 1357 | case NO_COLOR_SYNTAX: |
| 1358 | return N_("Color syntax highlighting"); |
| 1359 | case SMART_HOME: |
| 1360 | return N_("Smart home key"); |
| 1361 | case AUTOINDENT: |
| 1362 | return N_("Auto indent"); |
| 1363 | case CUT_TO_END: |
| 1364 | return N_("Cut to end"); |
| 1365 | case NO_WRAP: |
| 1366 | return N_("Long line wrapping"); |
| 1367 | case TABS_TO_SPACES: |
| 1368 | return N_("Conversion of typed tabs to spaces"); |
| 1369 | case BACKUP_FILE: |
| 1370 | return N_("Backup files"); |
| 1371 | case MULTIBUFFER: |
| 1372 | return N_("Multiple file buffers"); |
| 1373 | case USE_MOUSE: |
| 1374 | return N_("Mouse support"); |
| 1375 | case NO_CONVERT: |
| 1376 | return N_("No conversion from DOS/Mac format"); |
| 1377 | case SUSPEND: |
| 1378 | return N_("Suspension"); |
| 1379 | default: |
| 1380 | return "?????"; |
| 1381 | } |
| 1382 | } |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1383 | #endif /* NANO_TINY */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1384 | |
| 1385 | /* Interpret the string given by the rc file and return a |
| 1386 | shortcut struct, complete with proper value for execute */ |
| 1387 | sc *strtosc(int menu, char *input) |
| 1388 | { |
| 1389 | sc *s; |
| 1390 | |
| 1391 | s = (sc *)nmalloc(sizeof(sc)); |
| 1392 | s->execute = TRUE; /* overridden as needed below */ |
| 1393 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1394 | |
| 1395 | #ifndef DISABLE_HELP |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1396 | if (!strcasecmp(input, "help")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1397 | s->scfunc = DO_HELP_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1398 | else |
| 1399 | #endif |
| 1400 | if (!strcasecmp(input, "cancel")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1401 | s->scfunc = CANCEL_MSG; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1402 | s->execute = FALSE; |
| 1403 | } else if (!strcasecmp(input, "exit")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1404 | s->scfunc = DO_EXIT; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1405 | else if (!strcasecmp(input, "writeout")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1406 | s->scfunc = DO_WRITEOUT_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1407 | else if (!strcasecmp(input, "insert")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1408 | s->scfunc = DO_INSERTFILE_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1409 | else if (!strcasecmp(input, "whereis")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1410 | s->scfunc = DO_SEARCH; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1411 | else if (!strcasecmp(input, "up")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1412 | s->scfunc = DO_UP_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1413 | else if (!strcasecmp(input, "down")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1414 | s->scfunc = DO_DOWN_VOID; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 1415 | else if (!strcasecmp(input, "pageup") |
| 1416 | || !strcasecmp(input, "prevpage")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1417 | s->scfunc = DO_PAGE_UP; |
Chris Allegretta | 17436ce | 2008-03-11 03:03:53 +0000 | [diff] [blame] | 1418 | else if (!strcasecmp(input, "pagedown") |
| 1419 | || !strcasecmp(input, "nextpage")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1420 | s->scfunc = DO_PAGE_DOWN; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1421 | else if (!strcasecmp(input, "cut")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1422 | s->scfunc = DO_CUT_TEXT_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1423 | else if (!strcasecmp(input, "uncut")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1424 | s->scfunc = DO_UNCUT_TEXT; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1425 | else if (!strcasecmp(input, "curpos") || |
| 1426 | !strcasecmp(input, "cursorpos")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1427 | s->scfunc = DO_CURSORPOS_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1428 | else if (!strcasecmp(input, "firstline")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1429 | s->scfunc = DO_FIRST_LINE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1430 | else if (!strcasecmp(input, "lastline")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1431 | s->scfunc = DO_LAST_LINE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1432 | else if (!strcasecmp(input, "gotoline")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1433 | s->scfunc = DO_GOTOLINECOLUMN_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1434 | else if (!strcasecmp(input, "replace")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1435 | s->scfunc = DO_REPLACE; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1436 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1437 | else if (!strcasecmp(input, "justify")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1438 | s->scfunc = DO_JUSTIFY_VOID; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1439 | else if (!strcasecmp(input, "beginpara")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1440 | s->scfunc = DO_PARA_BEGIN_VOID; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1441 | else if (!strcasecmp(input, "endpara")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1442 | s->scfunc = DO_PARA_END_VOID; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1443 | else if (!strcasecmp(input, "fulljustify")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1444 | s->scfunc = DO_FULL_JUSTIFY; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1445 | #endif |
| 1446 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1447 | else if (!strcasecmp(input, "mark")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1448 | s->scfunc = DO_MARK; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1449 | else if (!strcasecmp(input, "searchagain") || |
| 1450 | !strcasecmp(input, "research")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1451 | s->scfunc = DO_RESEARCH; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1452 | else if (!strcasecmp(input, "copytext")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1453 | s->scfunc = DO_COPY_TEXT; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1454 | else if (!strcasecmp(input, "indent")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1455 | s->scfunc = DO_INDENT_VOID; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1456 | else if (!strcasecmp(input, "unindent")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1457 | s->scfunc = DO_UNINDENT; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1458 | else if (!strcasecmp(input, "scrollup")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1459 | s->scfunc = DO_SCROLL_UP; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1460 | else if (!strcasecmp(input, "scrolldown")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1461 | s->scfunc = DO_SCROLL_DOWN; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1462 | else if (!strcasecmp(input, "nextword")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1463 | s->scfunc = DO_NEXT_WORD_VOID; |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 1464 | else if (!strcasecmp(input, "suspend")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1465 | s->scfunc = DO_SUSPEND_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1466 | else if (!strcasecmp(input, "prevword")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1467 | s->scfunc = DO_PREV_WORD_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1468 | else if (!strcasecmp(input, "findbracket")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1469 | s->scfunc = DO_FIND_BRACKET; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1470 | else if (!strcasecmp(input, "wordcount")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1471 | s->scfunc = DO_WORDLINECHAR_COUNT; |
Chris Allegretta | 70859f4 | 2008-07-13 01:36:06 +0000 | [diff] [blame] | 1472 | else if (!strcasecmp(input, "undo")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1473 | s->scfunc = DO_UNDO; |
Chris Allegretta | 70859f4 | 2008-07-13 01:36:06 +0000 | [diff] [blame] | 1474 | else if (!strcasecmp(input, "redo")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1475 | s->scfunc = DO_REDO; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1476 | else if (!strcasecmp(input, "prevhistory")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1477 | s->scfunc = PREV_HISTORY_MSG; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1478 | s->execute = FALSE; |
| 1479 | } else if (!strcasecmp(input, "nexthistory")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1480 | s->scfunc = NEXT_HISTORY_MSG; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1481 | s->execute = FALSE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1482 | } else if (!strcasecmp(input, "nohelp") || |
| 1483 | !strcasecmp(input, "nohelp")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1484 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1485 | s->execute = FALSE; |
| 1486 | s->toggle = NO_HELP; |
| 1487 | } else if (!strcasecmp(input, "constupdate")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1488 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1489 | s->execute = FALSE; |
| 1490 | s->toggle = CONST_UPDATE; |
| 1491 | } else if (!strcasecmp(input, "morespace")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1492 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1493 | s->execute = FALSE; |
| 1494 | s->toggle = MORE_SPACE; |
| 1495 | } else if (!strcasecmp(input, "smoothscroll")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1496 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1497 | s->execute = FALSE; |
| 1498 | s->toggle = SMOOTH_SCROLL; |
Chris Allegretta | d3659f8 | 2008-03-16 23:57:14 +0000 | [diff] [blame] | 1499 | } else if (!strcasecmp(input, "whitespacedisplay")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1500 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1501 | s->execute = FALSE; |
| 1502 | s->toggle = WHITESPACE_DISPLAY; |
| 1503 | } else if (!strcasecmp(input, "nosyntax")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1504 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1505 | s->execute = FALSE; |
| 1506 | s->toggle = NO_COLOR_SYNTAX; |
| 1507 | } else if (!strcasecmp(input, "smarthome")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1508 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1509 | s->execute = FALSE; |
| 1510 | s->toggle = SMART_HOME; |
| 1511 | } else if (!strcasecmp(input, "autoindent")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1512 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1513 | s->execute = FALSE; |
| 1514 | s->toggle = AUTOINDENT; |
| 1515 | } else if (!strcasecmp(input, "cuttoend")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1516 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1517 | s->execute = FALSE; |
| 1518 | s->toggle = CUT_TO_END; |
| 1519 | } else if (!strcasecmp(input, "nowrap")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1520 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1521 | s->execute = FALSE; |
| 1522 | s->toggle = NO_WRAP; |
| 1523 | } else if (!strcasecmp(input, "tabstospaces")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1524 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1525 | s->execute = FALSE; |
| 1526 | s->toggle = TABS_TO_SPACES; |
| 1527 | } else if (!strcasecmp(input, "backupfile")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1528 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1529 | s->execute = FALSE; |
| 1530 | s->toggle = BACKUP_FILE; |
| 1531 | } else if (!strcasecmp(input, "mutlibuffer")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1532 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1533 | s->execute = FALSE; |
| 1534 | s->toggle = MULTIBUFFER; |
| 1535 | } else if (!strcasecmp(input, "mouse")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1536 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1537 | s->execute = FALSE; |
| 1538 | s->toggle = USE_MOUSE; |
| 1539 | } else if (!strcasecmp(input, "noconvert")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1540 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1541 | s->execute = FALSE; |
| 1542 | s->toggle = NO_CONVERT; |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 1543 | } else if (!strcasecmp(input, "suspendenable")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1544 | s->scfunc = DO_TOGGLE; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1545 | s->execute = FALSE; |
| 1546 | s->toggle = SUSPEND; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1547 | } |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1548 | #endif /* NANO_TINY */ |
| 1549 | else if (!strcasecmp(input, "right") || |
| 1550 | !strcasecmp(input, "forward")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1551 | s->scfunc = DO_RIGHT; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1552 | else if (!strcasecmp(input, "left") || |
| 1553 | !strcasecmp(input, "back")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1554 | s->scfunc = DO_LEFT; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1555 | else if (!strcasecmp(input, "up") || |
| 1556 | !strcasecmp(input, "prevline")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1557 | s->scfunc = DO_UP_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1558 | else if (!strcasecmp(input, "down") || |
| 1559 | !strcasecmp(input, "nextline")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1560 | s->scfunc = DO_DOWN_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1561 | else if (!strcasecmp(input, "home")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1562 | s->scfunc = DO_HOME; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1563 | else if (!strcasecmp(input, "end")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1564 | s->scfunc = DO_END; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1565 | #ifdef ENABLE_MULTIBUFFER |
| 1566 | else if (!strcasecmp(input, "prevbuf")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1567 | s->scfunc = SWITCH_TO_PREV_BUFFER_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1568 | else if (!strcasecmp(input, "nextbuf")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1569 | s->scfunc = SWITCH_TO_NEXT_BUFFER_VOID; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1570 | #endif |
| 1571 | else if (!strcasecmp(input, "verbatim")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1572 | s->scfunc = DO_VERBATIM_INPUT; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1573 | else if (!strcasecmp(input, "tab")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1574 | s->scfunc = DO_TAB; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1575 | else if (!strcasecmp(input, "enter")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1576 | s->scfunc = DO_ENTER; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1577 | else if (!strcasecmp(input, "delete")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1578 | s->scfunc = DO_DELETE; |
Chris Allegretta | fa40694 | 2008-07-13 16:44:19 +0000 | [diff] [blame] | 1579 | else if (!strcasecmp(input, "backspace")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1580 | s->scfunc = DO_BACKSPACE; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1581 | else if (!strcasecmp(input, "refresh")) |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1582 | s->scfunc = TOTAL_REFRESH; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1583 | else if (!strcasecmp(input, "casesens")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1584 | s->scfunc = CASE_SENS_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1585 | s->execute = FALSE; |
| 1586 | } else if (!strcasecmp(input, "regexp") || |
| 1587 | !strcasecmp(input, "regex")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1588 | s->scfunc = REGEXP_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1589 | s->execute = FALSE; |
| 1590 | } else if (!strcasecmp(input, "dontreplace")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1591 | s->scfunc = NO_REPLACE_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1592 | s->execute = FALSE; |
| 1593 | } else if (!strcasecmp(input, "gototext")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1594 | s->scfunc = GOTOTEXT_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1595 | s->execute = FALSE; |
| 1596 | } else if (!strcasecmp(input, "browser") || |
| 1597 | !strcasecmp(input, "tofiles")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1598 | s->scfunc = TO_FILES_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1599 | s->execute = FALSE; |
| 1600 | } else if (!strcasecmp(input, "dosformat")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1601 | s->scfunc = DOS_FORMAT_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1602 | s->execute = FALSE; |
| 1603 | } else if (!strcasecmp(input, "macformat")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1604 | s->scfunc = MAC_FORMAT_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1605 | s->execute = FALSE; |
| 1606 | } else if (!strcasecmp(input, "append")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1607 | s->scfunc = APPEND_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1608 | s->execute = FALSE; |
| 1609 | } else if (!strcasecmp(input, "prepend")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1610 | s->scfunc = PREPEND_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1611 | s->execute = FALSE; |
| 1612 | } else if (!strcasecmp(input, "backup")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1613 | s->scfunc = BACKUP_FILE_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1614 | s->execute = FALSE; |
| 1615 | #ifdef ENABLE_MULTIBUFFER |
| 1616 | } else if (!strcasecmp(input, "newbuffer")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1617 | s->scfunc = NEW_BUFFER_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1618 | s->execute = FALSE; |
| 1619 | #endif |
| 1620 | } else if (!strcasecmp(input, "firstfile")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1621 | s->scfunc = FIRST_FILE_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1622 | s->execute = FALSE; |
| 1623 | } else if (!strcasecmp(input, "lastfile")) { |
Chris Allegretta | a117163 | 2009-01-19 19:10:39 +0000 | [diff] [blame] | 1624 | s->scfunc = LAST_FILE_MSG; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1625 | s->execute = FALSE; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1626 | } else { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1627 | free(s); |
| 1628 | return NULL; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1629 | } |
| 1630 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1631 | return s; |
| 1632 | |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1633 | } |
| 1634 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1635 | #ifdef ENABLE_NANORC |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1636 | /* Same thing as abnove but for the menu */ |
| 1637 | int strtomenu(char *input) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1638 | { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1639 | if (!strcasecmp(input, "all")) |
| 1640 | return MALL; |
| 1641 | else if (!strcasecmp(input, "main")) |
| 1642 | return MMAIN; |
| 1643 | else if (!strcasecmp(input, "search")) |
| 1644 | return MWHEREIS; |
| 1645 | else if (!strcasecmp(input, "replace")) |
| 1646 | return MREPLACE; |
| 1647 | else if (!strcasecmp(input, "replace2") || |
| 1648 | !strcasecmp(input, "replacewith")) |
| 1649 | return MREPLACE2; |
| 1650 | else if (!strcasecmp(input, "gotoline")) |
| 1651 | return MGOTOLINE; |
| 1652 | else if (!strcasecmp(input, "writeout")) |
| 1653 | return MWRITEFILE; |
| 1654 | else if (!strcasecmp(input, "insert")) |
| 1655 | return MINSERTFILE; |
| 1656 | else if (!strcasecmp(input, "externalcmd") || |
| 1657 | !strcasecmp(input, "extcmd")) |
| 1658 | return MEXTCMD; |
| 1659 | else if (!strcasecmp(input, "help")) |
| 1660 | return MHELP; |
| 1661 | else if (!strcasecmp(input, "spell")) |
| 1662 | return MSPELL; |
| 1663 | else if (!strcasecmp(input, "browser")) |
| 1664 | return MBROWSER; |
| 1665 | else if (!strcasecmp(input, "whereisfile")) |
| 1666 | return MWHEREISFILE; |
| 1667 | else if (!strcasecmp(input, "gotodir")) |
| 1668 | return MGOTODIR; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1669 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1670 | return -1; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1671 | } |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1672 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1673 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1674 | |
David Lawrence Ramsey | e6757b9 | 2006-04-19 13:36:56 +0000 | [diff] [blame] | 1675 | #ifdef DEBUG |
| 1676 | /* This function is used to gracefully return all the memory we've used. |
| 1677 | * It should be called just before calling exit(). Practically, the |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1678 | * only effect is to cause a segmentation fault if the various data |
| 1679 | * structures got bolloxed earlier. Thus, we don't bother having this |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1680 | * function unless debugging is turned on. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1681 | void thanks_for_all_the_fish(void) |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1682 | { |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1683 | delwin(topwin); |
| 1684 | delwin(edit); |
| 1685 | delwin(bottomwin); |
| 1686 | |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1687 | #ifndef DISABLE_JUSTIFY |
| 1688 | if (quotestr != NULL) |
| 1689 | free(quotestr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1690 | #ifdef HAVE_REGEX_H |
| 1691 | regfree("ereg); |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1692 | if (quoteerr != NULL) |
| 1693 | free(quoteerr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1694 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1695 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1696 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 1697 | if (backup_dir != NULL) |
| 1698 | free(backup_dir); |
| 1699 | #endif |
Chris Allegretta | 2598c66 | 2002-03-28 01:59:34 +0000 | [diff] [blame] | 1700 | #ifndef DISABLE_OPERATINGDIR |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1701 | if (operating_dir != NULL) |
| 1702 | free(operating_dir); |
| 1703 | if (full_operating_dir != NULL) |
| 1704 | free(full_operating_dir); |
| 1705 | #endif |
| 1706 | if (last_search != NULL) |
| 1707 | free(last_search); |
| 1708 | if (last_replace != NULL) |
| 1709 | free(last_replace); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1710 | #ifndef DISABLE_SPELLER |
| 1711 | if (alt_speller != NULL) |
| 1712 | free(alt_speller); |
| 1713 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1714 | if (answer != NULL) |
| 1715 | free(answer); |
| 1716 | if (cutbuffer != NULL) |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1717 | free_filestruct(cutbuffer); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 1718 | #ifndef DISABLE_JUSTIFY |
| 1719 | if (jusbuffer != NULL) |
| 1720 | free_filestruct(jusbuffer); |
| 1721 | #endif |
Chris Allegretta | b71cf30 | 2009-02-16 23:06:09 +0000 | [diff] [blame] | 1722 | #ifdef DEBUG |
David Lawrence Ramsey | 5d8d0b1 | 2005-05-26 05:53:29 +0000 | [diff] [blame] | 1723 | /* Free the memory associated with each open file buffer. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 1724 | if (openfile != NULL) |
David Lawrence Ramsey | 64661ac | 2005-07-08 19:57:25 +0000 | [diff] [blame] | 1725 | free_openfilestruct(openfile); |
Chris Allegretta | b71cf30 | 2009-02-16 23:06:09 +0000 | [diff] [blame] | 1726 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1727 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1728 | if (syntaxstr != NULL) |
| 1729 | free(syntaxstr); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1730 | while (syntaxes != NULL) { |
| 1731 | syntaxtype *bill = syntaxes; |
| 1732 | |
| 1733 | free(syntaxes->desc); |
| 1734 | while (syntaxes->extensions != NULL) { |
| 1735 | exttype *bob = syntaxes->extensions; |
| 1736 | |
| 1737 | syntaxes->extensions = bob->next; |
David Lawrence Ramsey | 2385c1a | 2005-07-29 21:42:08 +0000 | [diff] [blame] | 1738 | free(bob->ext_regex); |
David Lawrence Ramsey | 7fc0ada | 2005-08-29 18:52:06 +0000 | [diff] [blame] | 1739 | if (bob->ext != NULL) { |
| 1740 | regfree(bob->ext); |
| 1741 | free(bob->ext); |
| 1742 | } |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1743 | free(bob); |
| 1744 | } |
| 1745 | while (syntaxes->color != NULL) { |
| 1746 | colortype *bob = syntaxes->color; |
| 1747 | |
| 1748 | syntaxes->color = bob->next; |
David Lawrence Ramsey | 2385c1a | 2005-07-29 21:42:08 +0000 | [diff] [blame] | 1749 | free(bob->start_regex); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1750 | if (bob->start != NULL) { |
| 1751 | regfree(bob->start); |
| 1752 | free(bob->start); |
| 1753 | } |
David Lawrence Ramsey | d2361f0 | 2005-07-14 18:33:51 +0000 | [diff] [blame] | 1754 | if (bob->end_regex != NULL) |
| 1755 | free(bob->end_regex); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1756 | if (bob->end != NULL) { |
Chris Allegretta | ce452fb | 2003-02-03 02:56:44 +0000 | [diff] [blame] | 1757 | regfree(bob->end); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 1758 | free(bob->end); |
| 1759 | } |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1760 | free(bob); |
| 1761 | } |
| 1762 | syntaxes = syntaxes->next; |
| 1763 | free(bill); |
| 1764 | } |
| 1765 | #endif /* ENABLE_COLOR */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1766 | #ifndef NANO_TINY |
David Lawrence Ramsey | 40e4acf | 2005-05-26 06:09:07 +0000 | [diff] [blame] | 1767 | /* Free the search and replace history lists. */ |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1768 | if (searchage != NULL) |
| 1769 | free_filestruct(searchage); |
| 1770 | if (replaceage != NULL) |
| 1771 | free_filestruct(replaceage); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 1772 | #endif |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 1773 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | 31b159c | 2005-05-26 05:17:13 +0000 | [diff] [blame] | 1774 | if (homedir != NULL) |
| 1775 | free(homedir); |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 1776 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1777 | } |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1778 | #endif /* DEBUG */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1779 | |