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