Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 1 | /************************************************************************** |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 2 | * global.c -- This file is part of GNU nano. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 3 | * * |
Chris Allegretta | 8a07a96 | 2009-12-02 03:36:22 +0000 | [diff] [blame] | 4 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, * |
Benno Schulenberg | 7a9f4a4 | 2014-04-30 20:18:26 +0000 | [diff] [blame] | 5 | * 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. * |
Benno Schulenberg | 406e524 | 2016-08-29 15:14:18 +0200 | [diff] [blame] | 6 | * Copyright (C) 2014, 2015, 2016 Benno Schulenberg * |
| 7 | * * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 8 | * GNU nano is free software: you can redistribute it and/or modify * |
| 9 | * it under the terms of the GNU General Public License as published * |
| 10 | * by the Free Software Foundation, either version 3 of the License, * |
| 11 | * or (at your option) any later version. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 12 | * * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 13 | * GNU nano is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty * |
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
| 16 | * See the GNU General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 17 | * * |
| 18 | * You should have received a copy of the GNU General Public License * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 19 | * along with this program. If not, see http://www.gnu.org/licenses/. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 20 | * * |
| 21 | **************************************************************************/ |
| 22 | |
Chris Allegretta | a855fa2 | 2008-07-12 02:13:22 +0000 | [diff] [blame] | 23 | #include "proto.h" |
| 24 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 25 | #include <ctype.h> |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 26 | #include <string.h> |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 27 | #include <strings.h> |
| 28 | #include "assert.h" |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 29 | |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 30 | /* Global variables. */ |
| 31 | #ifndef NANO_TINY |
Benno Schulenberg | b77e6bd | 2016-12-14 20:37:03 +0100 | [diff] [blame] | 32 | volatile sig_atomic_t the_window_resized = FALSE; |
| 33 | /* Set to TRUE by the handler whenever a SIGWINCH occurs. */ |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 34 | #endif |
| 35 | |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 36 | #ifdef __linux__ |
Benno Schulenberg | 290d278 | 2016-07-29 09:15:07 +0200 | [diff] [blame] | 37 | bool console; |
| 38 | /* Whether we're running on a Linux VC (TRUE) or under X (FALSE). */ |
Benno Schulenberg | 928a24c | 2016-08-11 12:37:11 +0200 | [diff] [blame] | 39 | #endif |
| 40 | |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 41 | bool meta_key; |
| 42 | /* Whether the current keystroke is a Meta key. */ |
Benno Schulenberg | 382c9d7 | 2016-04-24 11:28:28 +0200 | [diff] [blame] | 43 | bool shift_held; |
| 44 | /* Whether Shift was being held together with a movement key. */ |
Benno Schulenberg | 318ed6b | 2016-04-12 10:24:57 +0200 | [diff] [blame] | 45 | bool focusing = TRUE; |
Benno Schulenberg | 07e199f | 2015-03-28 17:01:46 +0000 | [diff] [blame] | 46 | /* Whether an update of the edit window should center the cursor. */ |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 47 | |
Benno Schulenberg | eef7d10 | 2016-12-20 19:27:41 +0100 | [diff] [blame] | 48 | bool as_an_at = TRUE; |
| 49 | /* Whether a 0x0A byte should be shown as a ^@ instead of a ^J. */ |
| 50 | |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 51 | int margin = 0; |
| 52 | /* The amount of space reserved at the left for line numbers. */ |
| 53 | int editwincols = -1; |
| 54 | /* The number of usable columns in the edit window: COLS - margin. */ |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 55 | |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 56 | message_type lastmessage = HUSH; |
| 57 | /* Messages of type HUSH should not overwrite type MILD nor ALERT. */ |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 58 | |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 59 | filestruct *pletion_line = NULL; |
| 60 | /* The line where the last completion was found, if any. */ |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 61 | |
Benno Schulenberg | c661506 | 2016-08-16 10:49:55 +0200 | [diff] [blame] | 62 | int controlleft, controlright, controlup, controldown; |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 63 | #ifndef NANO_TINY |
Benno Schulenberg | 382c9d7 | 2016-04-24 11:28:28 +0200 | [diff] [blame] | 64 | int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown; |
| 65 | int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown; |
Benno Schulenberg | f08d79d | 2015-11-23 08:52:23 +0000 | [diff] [blame] | 66 | #endif |
| 67 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 68 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 69 | ssize_t fill = 0; |
| 70 | /* The column where we will wrap lines. */ |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 71 | ssize_t wrap_at = -CHARS_FROM_EOL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 72 | /* The position where we will wrap lines. fill is equal to this |
| 73 | * if it's greater than zero, and equal to (COLS + this) if it |
| 74 | * isn't. */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 75 | #endif |
| 76 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 77 | char *last_search = NULL; |
| 78 | /* The last string we searched for. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 79 | |
Benno Schulenberg | e255627 | 2016-04-30 21:22:16 +0200 | [diff] [blame] | 80 | char *present_path = NULL; |
| 81 | /* The current browser directory when trying to do tab completion. */ |
| 82 | |
Chris Allegretta | a48507d | 2009-08-14 03:18:29 +0000 | [diff] [blame] | 83 | unsigned flags[4] = {0, 0, 0, 0}; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 84 | /* Our flag containing the states of all global options. */ |
| 85 | WINDOW *topwin; |
| 86 | /* The top portion of the window, where we display the version |
| 87 | * number of nano, the name of the current file, and whether the |
| 88 | * current file has been modified. */ |
| 89 | WINDOW *edit; |
David Lawrence Ramsey | b159f94 | 2006-07-28 17:06:27 +0000 | [diff] [blame] | 90 | /* 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] | 91 | * we display the current file we're editing. */ |
| 92 | WINDOW *bottomwin; |
| 93 | /* The bottom portion of the window, where we display statusbar |
| 94 | * messages, the statusbar prompt, and a list of shortcuts. */ |
| 95 | int editwinrows = 0; |
| 96 | /* How many rows does the edit window take up? */ |
Benno Schulenberg | 0208ae7 | 2017-01-12 17:33:46 +0100 | [diff] [blame] | 97 | int maxlines = 0; |
| 98 | /* How many file lines can be shown (due to soft wrapping). */ |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 99 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 100 | filestruct *cutbuffer = NULL; |
| 101 | /* The buffer where we store cut text. */ |
Chris Allegretta | 12dc8ca | 2008-07-31 04:24:04 +0000 | [diff] [blame] | 102 | filestruct *cutbottom = NULL; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 103 | /* The last line in the cutbuffer. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 104 | partition *filepart = NULL; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 105 | /* The "partition" where we store a portion of the current file. */ |
David Lawrence Ramsey | 64661ac | 2005-07-08 19:57:25 +0000 | [diff] [blame] | 106 | openfilestruct *openfile = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 107 | /* The list of all open file buffers. */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 108 | |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 109 | #ifndef NANO_TINY |
| 110 | char *matchbrackets = NULL; |
| 111 | /* The opening and closing brackets that can be found by bracket |
| 112 | * searches. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 113 | char *whitespace = NULL; |
Benno Schulenberg | 90798fb | 2015-08-09 16:05:50 +0000 | [diff] [blame] | 114 | /* The characters used when visibly showing tabs and spaces. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 115 | int whitespace_len[2]; |
Benno Schulenberg | 90798fb | 2015-08-09 16:05:50 +0000 | [diff] [blame] | 116 | /* The length in bytes of these characters. */ |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 117 | #endif |
| 118 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 119 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 120 | char *punct = NULL; |
| 121 | /* The closing punctuation that can end sentences. */ |
| 122 | char *brackets = NULL; |
| 123 | /* The closing brackets that can follow closing punctuation and |
| 124 | * can end sentences. */ |
| 125 | char *quotestr = NULL; |
| 126 | /* The quoting string. The default value is set in main(). */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 127 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 128 | regex_t quotereg; |
| 129 | /* The compiled regular expression from the quoting string. */ |
| 130 | int quoterc; |
David Lawrence Ramsey | 8816564 | 2006-05-22 18:30:09 +0000 | [diff] [blame] | 131 | /* Whether it was compiled successfully. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 132 | char *quoteerr = NULL; |
| 133 | /* The error message, if it didn't. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 134 | #else |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 135 | size_t quotelen; |
| 136 | /* The length of the quoting string in bytes. */ |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 137 | #endif |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 138 | #endif /* !DISABLE_JUSTIFY */ |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 139 | |
Benno Schulenberg | 6f12992 | 2016-06-30 18:02:45 +0200 | [diff] [blame] | 140 | char *word_chars = NULL; |
| 141 | /* Nonalphanumeric characters that also form words. */ |
| 142 | |
Chris Allegretta | 0dc26dc | 2009-01-24 22:40:41 +0000 | [diff] [blame] | 143 | bool nodelay_mode = FALSE; |
Benno Schulenberg | 71c9a52 | 2014-05-13 20:14:01 +0000 | [diff] [blame] | 144 | /* Are we checking for a cancel wile doing something? */ |
Chris Allegretta | 0dc26dc | 2009-01-24 22:40:41 +0000 | [diff] [blame] | 145 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 146 | char *answer = NULL; |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 147 | /* The answer string used by the statusbar prompt. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 148 | |
| 149 | ssize_t tabsize = -1; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 150 | /* The width of a tab in spaces. The default is set in main(). */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 151 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 152 | #ifndef NANO_TINY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 153 | char *backup_dir = NULL; |
| 154 | /* The directory where we store backup files. */ |
Chris Allegretta | bf88d27 | 2013-01-01 03:24:39 +0000 | [diff] [blame] | 155 | |
Chris Allegretta | 3116d2f | 2013-01-03 04:36:39 +0000 | [diff] [blame] | 156 | const char *locking_prefix = "."; |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 157 | /* Prefix of how to store the vim-style lock file. */ |
Chris Allegretta | 3116d2f | 2013-01-03 04:36:39 +0000 | [diff] [blame] | 158 | const char *locking_suffix = ".swp"; |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 159 | /* Suffix of the vim-style lock file. */ |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 160 | #endif |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 161 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 162 | char *operating_dir = NULL; |
| 163 | /* The relative path to the operating directory, which we can't |
| 164 | * move outside of. */ |
| 165 | char *full_operating_dir = NULL; |
| 166 | /* The full path to it. */ |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 167 | #endif |
| 168 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 169 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 170 | char *alt_speller = NULL; |
| 171 | /* The command to use for the alternate spell checker. */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 172 | #endif |
| 173 | |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 174 | #ifndef DISABLE_COLOR |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 175 | syntaxtype *syntaxes = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 176 | /* The global list of color syntaxes. */ |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 177 | char *syntaxstr = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 178 | /* The color syntax name specified on the command line. */ |
Chris Allegretta | 8ce2413 | 2001-04-30 11:28:46 +0000 | [diff] [blame] | 179 | #endif |
| 180 | |
Benno Schulenberg | 53f4a9f | 2016-04-25 21:14:18 +0200 | [diff] [blame] | 181 | bool refresh_needed = FALSE; |
| 182 | /* Did a command mangle enough of the buffer that we should |
| 183 | * repaint the screen? */ |
Chris Allegretta | fd265af | 2009-02-06 03:41:02 +0000 | [diff] [blame] | 184 | |
Benno Schulenberg | 9106cc8 | 2016-05-08 12:01:33 +0200 | [diff] [blame] | 185 | int currmenu = MMOST; |
| 186 | /* The currently active menu, initialized to a dummy value. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 187 | sc *sclist = NULL; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 188 | /* The start of the shortcuts list. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 189 | subnfunc *allfuncs = NULL; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 190 | /* The start of the functions list. */ |
Benno Schulenberg | 20b1e92 | 2014-04-26 18:41:43 +0000 | [diff] [blame] | 191 | subnfunc *tailfunc; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 192 | /* The last function in the list. */ |
Benno Schulenberg | 11d7644 | 2014-04-26 19:01:18 +0000 | [diff] [blame] | 193 | subnfunc *exitfunc; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 194 | /* A pointer to the special Exit/Close item. */ |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 195 | subnfunc *uncutfunc; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 196 | /* A pointer to the special Uncut/Unjustify item. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 197 | |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 198 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 199 | filestruct *search_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 200 | /* The search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 201 | filestruct *searchage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 202 | /* The top of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 203 | filestruct *searchbot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 204 | /* The bottom of the search string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 205 | filestruct *replace_history = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 206 | /* The replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 207 | filestruct *replaceage = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 208 | /* The top of the replace string history list. */ |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 209 | filestruct *replacebot = NULL; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 210 | /* The bottom of the replace string history list. */ |
Benno Schulenberg | deb271d | 2016-01-12 19:20:40 +0000 | [diff] [blame] | 211 | poshiststruct *position_history = NULL; |
Benno Schulenberg | 7f87393 | 2014-02-25 21:27:22 +0000 | [diff] [blame] | 212 | /* The cursor position history list. */ |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 213 | #endif |
| 214 | |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 215 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 216 | regex_t search_regexp; |
| 217 | /* The compiled regular expression to use in searches. */ |
| 218 | regmatch_t regmatches[10]; |
| 219 | /* The match positions for parenthetical subexpressions, 10 |
| 220 | * maximum, used in regular expression searches. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 221 | #endif |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 222 | |
Benno Schulenberg | c970035 | 2014-05-04 08:53:06 +0000 | [diff] [blame] | 223 | int hilite_attribute = A_REVERSE; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 224 | /* The curses attribute we use to highlight something. */ |
Benno Schulenberg | 1663994 | 2014-05-03 18:24:45 +0000 | [diff] [blame] | 225 | #ifndef DISABLE_COLOR |
| 226 | char* specified_color_combo[] = {}; |
| 227 | /* The color combinations as specified in the rcfile. */ |
| 228 | #endif |
Benno Schulenberg | 960e848 | 2016-07-12 09:35:48 +0200 | [diff] [blame] | 229 | int interface_color_pair[] = {}; |
Benno Schulenberg | 1663994 | 2014-05-03 18:24:45 +0000 | [diff] [blame] | 230 | /* The processed color pairs for the interface elements. */ |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 231 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 232 | char *homedir = NULL; |
David Lawrence Ramsey | c1c818e | 2006-05-14 18:22:01 +0000 | [diff] [blame] | 233 | /* The user's home directory, from $HOME or /etc/passwd. */ |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 234 | |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 235 | |
Benno Schulenberg | 7f87393 | 2014-02-25 21:27:22 +0000 | [diff] [blame] | 236 | /* Return the number of entries in the shortcut list for a given menu. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 237 | size_t length_of_list(int menu) |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 238 | { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 239 | subnfunc *f; |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 240 | size_t i = 0; |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 241 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 242 | for (f = allfuncs; f != NULL; f = f->next) |
Benno Schulenberg | aeb49a8 | 2016-08-27 12:22:59 +0200 | [diff] [blame] | 243 | if ((f->menus & menu) && first_sc_for(menu, f->scfunc) != NULL) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 244 | i++; |
Benno Schulenberg | aeb49a8 | 2016-08-27 12:22:59 +0200 | [diff] [blame] | 245 | |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 246 | return i; |
| 247 | } |
| 248 | |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 249 | /* To make the functions and shortcuts lists clearer. */ |
| 250 | #define VIEW TRUE /* Is allowed in view mode. */ |
| 251 | #define NOVIEW FALSE |
| 252 | #define BLANKAFTER TRUE /* A blank line after this one. */ |
| 253 | #define TOGETHER FALSE |
| 254 | |
Benno Schulenberg | 7f87393 | 2014-02-25 21:27:22 +0000 | [diff] [blame] | 255 | /* Just throw this here. */ |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 256 | void case_sens_void(void) |
| 257 | { |
| 258 | } |
| 259 | void regexp_void(void) |
| 260 | { |
| 261 | } |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 262 | void backwards_void(void) |
| 263 | { |
| 264 | } |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 265 | void gototext_void(void) |
| 266 | { |
| 267 | } |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 268 | #ifndef DISABLE_BROWSER |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 269 | void to_files_void(void) |
| 270 | { |
| 271 | } |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 272 | void goto_dir_void(void) |
| 273 | { |
| 274 | } |
| 275 | #endif |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 276 | void dos_format_void(void) |
| 277 | { |
| 278 | } |
| 279 | void mac_format_void(void) |
| 280 | { |
| 281 | } |
| 282 | void append_void(void) |
| 283 | { |
| 284 | } |
| 285 | void prepend_void(void) |
| 286 | { |
| 287 | } |
| 288 | void backup_file_void(void) |
| 289 | { |
| 290 | } |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 291 | void discard_buffer(void) |
| 292 | { |
| 293 | } |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 294 | void new_buffer_void(void) |
| 295 | { |
| 296 | } |
Benno Schulenberg | a0f66c0 | 2014-06-23 18:30:35 +0000 | [diff] [blame] | 297 | void flip_replace_void(void) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 298 | { |
| 299 | } |
Benno Schulenberg | 04a38da | 2014-06-04 19:15:16 +0000 | [diff] [blame] | 300 | void flip_execute_void(void) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 301 | { |
| 302 | } |
| 303 | |
Benno Schulenberg | 8075063 | 2014-07-27 19:18:00 +0000 | [diff] [blame] | 304 | /* Add a function to the function list. */ |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 305 | 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] | 306 | bool blank_after, bool viewok) |
| 307 | { |
Benno Schulenberg | 1eb23d4 | 2014-06-04 16:30:11 +0000 | [diff] [blame] | 308 | subnfunc *f = (subnfunc *)nmalloc(sizeof(subnfunc)); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 309 | |
Benno Schulenberg | 20b1e92 | 2014-04-26 18:41:43 +0000 | [diff] [blame] | 310 | if (allfuncs == NULL) |
| 311 | allfuncs = f; |
| 312 | else |
| 313 | tailfunc->next = f; |
| 314 | tailfunc = f; |
| 315 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 316 | f->next = NULL; |
| 317 | f->scfunc = func; |
| 318 | f->menus = menus; |
| 319 | f->desc = desc; |
| 320 | f->viewok = viewok; |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 321 | #ifndef DISABLE_HELP |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 322 | f->help = help; |
| 323 | f->blank_after = blank_after; |
| 324 | #endif |
| 325 | |
| 326 | #ifdef DEBUG |
Benno Schulenberg | 5c2b44a | 2014-04-15 20:01:19 +0000 | [diff] [blame] | 327 | fprintf(stderr, "Added func %ld (%s) for menus %x\n", (long)func, f->desc, menus); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 328 | #endif |
| 329 | } |
| 330 | |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 331 | /* Add a key combo to the shortcut list. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 332 | void add_to_sclist(int menus, const char *scstring, const int keycode, |
| 333 | void (*func)(void), int toggle) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 334 | { |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 335 | static sc *tailsc; |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 336 | #ifndef NANO_TINY |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 337 | static int counter = 0; |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 338 | #endif |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 339 | sc *s = (sc *)nmalloc(sizeof(sc)); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 340 | |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 341 | /* Start the list, or tack on the next item. */ |
| 342 | if (sclist == NULL) |
| 343 | sclist = s; |
| 344 | else |
| 345 | tailsc->next = s; |
| 346 | tailsc = s; |
| 347 | s->next = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 348 | |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 349 | /* Fill in the data. */ |
Benno Schulenberg | 1f866c2 | 2015-07-15 20:13:05 +0000 | [diff] [blame] | 350 | s->menus = menus; |
Benno Schulenberg | d23283e | 2014-07-27 19:13:46 +0000 | [diff] [blame] | 351 | s->scfunc = func; |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 352 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 353 | s->toggle = toggle; |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 354 | if (toggle) |
| 355 | s->ordinal = ++counter; |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 356 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 357 | assign_keyinfo(s, scstring, keycode); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 358 | |
| 359 | #ifdef DEBUG |
Benno Schulenberg | 1c9ab8b | 2016-07-24 21:49:07 +0200 | [diff] [blame] | 360 | fprintf(stderr, "Setting keycode to %d for shortcut \"%s\" in menus %x\n", s->keycode, scstring, s->menus); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 361 | #endif |
| 362 | } |
| 363 | |
Benno Schulenberg | 7454103 | 2014-05-13 20:20:51 +0000 | [diff] [blame] | 364 | /* Assign one function's shortcuts to another function. */ |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 365 | void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void)) |
| 366 | { |
| 367 | sc *s; |
| 368 | |
Benno Schulenberg | 7454103 | 2014-05-13 20:20:51 +0000 | [diff] [blame] | 369 | for (s = sclist; s != NULL; s = s->next) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 370 | if (s->scfunc == oldfunc) |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 371 | s->scfunc = newfunc; |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 372 | } |
| 373 | |
Benno Schulenberg | dbb5e7c | 2014-07-27 19:23:41 +0000 | [diff] [blame] | 374 | /* Return the first shortcut in the list of shortcuts that |
| 375 | * matches the given func in the given menu. */ |
| 376 | const sc *first_sc_for(int menu, void (*func)(void)) |
| 377 | { |
| 378 | const sc *s; |
| 379 | |
| 380 | for (s = sclist; s != NULL; s = s->next) |
Benno Schulenberg | 1f866c2 | 2015-07-15 20:13:05 +0000 | [diff] [blame] | 381 | if ((s->menus & menu) && s->scfunc == func) |
Benno Schulenberg | dbb5e7c | 2014-07-27 19:23:41 +0000 | [diff] [blame] | 382 | return s; |
| 383 | |
| 384 | #ifdef DEBUG |
| 385 | fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu); |
| 386 | #endif |
| 387 | /* Otherwise... */ |
| 388 | return NULL; |
| 389 | } |
| 390 | |
Benno Schulenberg | a9b5a0e | 2016-12-22 12:02:11 +0100 | [diff] [blame] | 391 | /* Return the first keycode that is bound to the given function in the |
| 392 | * current menu, if any; otherwise, return the given default value. */ |
| 393 | int the_code_for(void (*func)(void), int defaultval) |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 394 | { |
| 395 | const sc *s = first_sc_for(currmenu, func); |
| 396 | |
Benno Schulenberg | a9b5a0e | 2016-12-22 12:02:11 +0100 | [diff] [blame] | 397 | if (s == NULL) |
| 398 | return defaultval; |
| 399 | |
| 400 | meta_key = s->meta; |
| 401 | return s->keycode; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 402 | } |
| 403 | |
Benno Schulenberg | 3933a30 | 2014-07-02 08:47:09 +0000 | [diff] [blame] | 404 | /* Return a pointer to the function that is bound to the given key. */ |
| 405 | functionptrtype func_from_key(int *kbinput) |
| 406 | { |
| 407 | const sc *s = get_shortcut(kbinput); |
| 408 | |
| 409 | if (s) |
| 410 | return s->scfunc; |
| 411 | else |
| 412 | return NULL; |
| 413 | } |
| 414 | |
Benno Schulenberg | e295070 | 2016-07-23 14:42:40 +0200 | [diff] [blame] | 415 | /* Set the string and its corresponding keycode for the given shortcut s. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 416 | void assign_keyinfo(sc *s, const char *keystring, const int keycode) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 417 | { |
Benno Schulenberg | 3930a69 | 2016-07-30 12:44:23 +0200 | [diff] [blame] | 418 | s->keystr = keystring; |
Benno Schulenberg | e295070 | 2016-07-23 14:42:40 +0200 | [diff] [blame] | 419 | s->meta = (keystring[0] == 'M'); |
Benno Schulenberg | 5b0ab8b | 2016-07-23 12:15:39 +0200 | [diff] [blame] | 420 | |
Benno Schulenberg | 1c528db | 2016-07-25 09:33:43 +0200 | [diff] [blame] | 421 | assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2)); |
Chris Allegretta | 9b42220 | 2008-03-05 17:15:33 +0000 | [diff] [blame] | 422 | |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 423 | if (keycode) |
| 424 | s->keycode = keycode; |
| 425 | else if (keystring[0] == '^') { |
Benno Schulenberg | 9322e1e | 2016-07-25 10:30:41 +0200 | [diff] [blame] | 426 | if (strcasecmp(keystring, "^Space") == 0) |
| 427 | s->keycode = 0; |
Benno Schulenberg | fdee0df | 2016-10-11 10:50:04 +0200 | [diff] [blame] | 428 | else |
| 429 | s->keycode = keystring[1] - 64; |
Benno Schulenberg | 9322e1e | 2016-07-25 10:30:41 +0200 | [diff] [blame] | 430 | } else if (s->meta) { |
Benno Schulenberg | 9322e1e | 2016-07-25 10:30:41 +0200 | [diff] [blame] | 431 | if (strcasecmp(keystring, "M-Space") == 0) |
| 432 | s->keycode = (int)' '; |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 433 | else |
| 434 | s->keycode = tolower((int)keystring[2]); |
Benno Schulenberg | 9322e1e | 2016-07-25 10:30:41 +0200 | [diff] [blame] | 435 | } else if (keystring[0] == 'F') |
Benno Schulenberg | 3930a69 | 2016-07-30 12:44:23 +0200 | [diff] [blame] | 436 | s->keycode = KEY_F0 + atoi(&keystring[1]); |
Benno Schulenberg | 3930a69 | 2016-07-30 12:44:23 +0200 | [diff] [blame] | 437 | else if (!strcasecmp(keystring, "Ins")) |
Benno Schulenberg | b70fe38 | 2016-07-25 10:27:02 +0200 | [diff] [blame] | 438 | s->keycode = KEY_IC; |
Benno Schulenberg | 3930a69 | 2016-07-30 12:44:23 +0200 | [diff] [blame] | 439 | else if (!strcasecmp(keystring, "Del")) |
Benno Schulenberg | b70fe38 | 2016-07-25 10:27:02 +0200 | [diff] [blame] | 440 | s->keycode = KEY_DC; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | #ifdef DEBUG |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 444 | void print_sclist(void) |
| 445 | { |
| 446 | sc *s; |
| 447 | const subnfunc *f; |
| 448 | |
Benno Schulenberg | a85b6da | 2014-03-26 10:57:11 +0000 | [diff] [blame] | 449 | for (s = sclist; s != NULL; s = s->next) { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 450 | f = sctofunc(s); |
Benno Schulenberg | a85b6da | 2014-03-26 10:57:11 +0000 | [diff] [blame] | 451 | if (f) |
Benno Schulenberg | 70d2167 | 2014-03-26 10:53:10 +0000 | [diff] [blame] | 452 | fprintf(stderr, "Shortcut \"%s\", function: %s, menus %x\n", s->keystr, f->desc, f->menus); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 453 | else |
Benno Schulenberg | d0dec31 | 2014-04-08 12:35:18 +0000 | [diff] [blame] | 454 | fprintf(stderr, "Hmm, didn't find a func for \"%s\"\n", s->keystr); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 455 | } |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 456 | } |
| 457 | #endif |
| 458 | |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 459 | /* These four tags are used elsewhere too, so they are global. */ |
| 460 | /* TRANSLATORS: Try to keep the next fifteen strings at most 10 characters. */ |
Benno Schulenberg | 11d7644 | 2014-04-26 19:01:18 +0000 | [diff] [blame] | 461 | const char *exit_tag = N_("Exit"); |
| 462 | const char *close_tag = N_("Close"); |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 463 | const char *uncut_tag = N_("Uncut Text"); |
Benno Schulenberg | a3a69ee | 2016-01-17 16:25:31 +0000 | [diff] [blame] | 464 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 465 | const char *unjust_tag = N_("Unjustify"); |
| 466 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 467 | |
Benno Schulenberg | a2dcd6e | 2014-04-07 09:24:10 +0000 | [diff] [blame] | 468 | /* Initialize the list of functions and the list of shortcuts. */ |
| 469 | void shortcut_init(void) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 470 | { |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 471 | const char *read_file_tag = N_("Read File"); |
Benno Schulenberg | 9fc713b | 2014-04-22 10:18:48 +0000 | [diff] [blame] | 472 | const char *whereis_tag = N_("Where Is"); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 473 | const char *replace_tag = N_("Replace"); |
| 474 | const char *gotoline_tag = N_("Go To Line"); |
Benno Schulenberg | 12da94c | 2014-04-22 10:02:55 +0000 | [diff] [blame] | 475 | const char *prev_line_tag = N_("Prev Line"); |
| 476 | const char *next_line_tag = N_("Next Line"); |
Benno Schulenberg | cc65a42 | 2015-04-17 10:06:03 +0000 | [diff] [blame] | 477 | const char *prev_page_tag = N_("Prev Page"); |
| 478 | const char *next_page_tag = N_("Next Page"); |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 479 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 480 | const char *justify_tag = N_("Justify"); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 481 | const char *fulljustify_tag = N_("FullJstify"); |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 482 | #endif |
Benno Schulenberg | 9fc713b | 2014-04-22 10:18:48 +0000 | [diff] [blame] | 483 | const char *refresh_tag = N_("Refresh"); |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 484 | /* TRANSLATORS: Try to keep this string at most 12 characters. */ |
| 485 | const char *whereis_next_tag = N_("WhereIs Next"); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 486 | |
Benno Schulenberg | 8c5f504 | 2014-05-28 20:31:06 +0000 | [diff] [blame] | 487 | #ifndef DISABLE_HELP |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 488 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 7f87393 | 2014-02-25 21:27:22 +0000 | [diff] [blame] | 489 | /* TRANSLATORS: The next long series of strings are shortcut descriptions; |
| 490 | * they are best kept shorter than 56 characters, but may be longer. */ |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 491 | const char *nano_justify_msg = N_("Justify the current paragraph"); |
| 492 | #endif |
David Lawrence Ramsey | 804e107 | 2006-03-29 19:43:32 +0000 | [diff] [blame] | 493 | const char *nano_cancel_msg = N_("Cancel the current function"); |
David Lawrence Ramsey | 57c9afb | 2006-04-14 20:21:45 +0000 | [diff] [blame] | 494 | const char *nano_help_msg = N_("Display this help text"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 495 | const char *nano_exit_msg = |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 496 | #ifndef DISABLE_MULTIBUFFER |
David Lawrence Ramsey | be231d3 | 2006-05-21 21:37:21 +0000 | [diff] [blame] | 497 | N_("Close the current file buffer / Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 498 | #else |
Benno Schulenberg | a65ef42 | 2014-03-17 21:36:37 +0000 | [diff] [blame] | 499 | N_("Exit from nano") |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 500 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 501 | ; |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 502 | const char *nano_writeout_msg = |
| 503 | N_("Write the current file to disk"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 504 | const char *nano_insert_msg = |
| 505 | N_("Insert another file into the current one"); |
David Lawrence Ramsey | 9b108c2 | 2005-06-06 18:38:16 +0000 | [diff] [blame] | 506 | const char *nano_whereis_msg = |
David Lawrence Ramsey | be231d3 | 2006-05-21 21:37:21 +0000 | [diff] [blame] | 507 | N_("Search for a string or a regular expression"); |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 508 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | e21e954 | 2016-05-02 09:34:23 +0200 | [diff] [blame] | 509 | const char *nano_browser_whereis_msg = N_("Search for a string"); |
| 510 | const char *nano_browser_refresh_msg = N_("Refresh the file list"); |
Benno Schulenberg | 36df5ce | 2016-05-12 10:10:04 +0200 | [diff] [blame] | 511 | const char *nano_browser_lefthand_msg = N_("Go to lefthand column"); |
| 512 | const char *nano_browser_righthand_msg = N_("Go to righthand column"); |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 513 | #endif |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 514 | const char *nano_prevpage_msg = N_("Go one screenful up"); |
| 515 | const char *nano_nextpage_msg = N_("Go one screenful down"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 516 | const char *nano_cut_msg = |
| 517 | N_("Cut the current line and store it in the cutbuffer"); |
| 518 | const char *nano_uncut_msg = |
| 519 | N_("Uncut from the cutbuffer into the current line"); |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 520 | const char *nano_cursorpos_msg = N_("Display the position of the cursor"); |
Benno Schulenberg | b8b29ff | 2014-04-03 21:06:30 +0000 | [diff] [blame] | 521 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 522 | const char *nano_spell_msg = N_("Invoke the spell checker, if available"); |
Benno Schulenberg | b8b29ff | 2014-04-03 21:06:30 +0000 | [diff] [blame] | 523 | #endif |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 524 | const char *nano_replace_msg = N_("Replace a string or a regular expression"); |
Benno Schulenberg | f803ef5 | 2014-04-13 12:16:37 +0000 | [diff] [blame] | 525 | 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] | 526 | #ifndef NANO_TINY |
Benno Schulenberg | 4da2434 | 2014-04-27 15:20:57 +0000 | [diff] [blame] | 527 | const char *nano_mark_msg = N_("Mark text starting from the cursor position"); |
| 528 | const char *nano_whereis_next_msg = N_("Repeat the last search"); |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 529 | const char *nano_copy_msg = |
| 530 | N_("Copy the current line and store it in the cutbuffer"); |
David Lawrence Ramsey | aee00d4 | 2006-07-05 18:42:22 +0000 | [diff] [blame] | 531 | const char *nano_indent_msg = N_("Indent the current line"); |
| 532 | const char *nano_unindent_msg = N_("Unindent the current line"); |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 533 | const char *nano_undo_msg = N_("Undo the last operation"); |
| 534 | const char *nano_redo_msg = N_("Redo the last undone operation"); |
David Lawrence Ramsey | 4b4b608 | 2004-11-01 22:54:40 +0000 | [diff] [blame] | 535 | #endif |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 536 | const char *nano_back_msg = N_("Go back one character"); |
Benno Schulenberg | 5a5144b | 2016-02-05 12:01:02 +0000 | [diff] [blame] | 537 | const char *nano_forward_msg = N_("Go forward one character"); |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 538 | const char *nano_prevword_msg = N_("Go back one word"); |
Benno Schulenberg | 5a5144b | 2016-02-05 12:01:02 +0000 | [diff] [blame] | 539 | const char *nano_nextword_msg = N_("Go forward one word"); |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 540 | const char *nano_prevline_msg = N_("Go to previous line"); |
| 541 | const char *nano_nextline_msg = N_("Go to next line"); |
| 542 | const char *nano_home_msg = N_("Go to beginning of current line"); |
| 543 | const char *nano_end_msg = N_("Go to end of current line"); |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 544 | const char *nano_prevblock_msg = N_("Go to previous block of text"); |
| 545 | const char *nano_nextblock_msg = N_("Go to next block of text"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 546 | #ifndef DISABLE_JUSTIFY |
| 547 | const char *nano_parabegin_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 548 | N_("Go to beginning of paragraph; then of previous paragraph"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 549 | const char *nano_paraend_msg = |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 550 | N_("Go just beyond end of paragraph; then of next paragraph"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 551 | #endif |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 552 | const char *nano_firstline_msg = N_("Go to the first line of the file"); |
| 553 | const char *nano_lastline_msg = N_("Go to the last line of the file"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 554 | #ifndef NANO_TINY |
David Lawrence Ramsey | 9f1db5d | 2007-02-01 13:40:59 +0000 | [diff] [blame] | 555 | const char *nano_bracket_msg = N_("Go to the matching bracket"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 556 | const char *nano_scrollup_msg = |
| 557 | N_("Scroll up one line without scrolling the cursor"); |
| 558 | const char *nano_scrolldown_msg = |
| 559 | N_("Scroll down one line without scrolling the cursor"); |
| 560 | #endif |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 561 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 562 | const char *nano_prevfile_msg = N_("Switch to the previous file buffer"); |
| 563 | const char *nano_nextfile_msg = N_("Switch to the next file buffer"); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 564 | #endif |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 565 | const char *nano_verbatim_msg = N_("Insert the next keystroke verbatim"); |
| 566 | const char *nano_tab_msg = N_("Insert a tab at the cursor position"); |
| 567 | const char *nano_enter_msg = N_("Insert a newline at the cursor position"); |
| 568 | const char *nano_delete_msg = N_("Delete the character under the cursor"); |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 569 | const char *nano_backspace_msg = |
| 570 | N_("Delete the character to the left of the cursor"); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 571 | #ifndef NANO_TINY |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 572 | const char *nano_cut_word_left_msg = |
| 573 | N_("Cut backward from cursor to word start"); |
| 574 | const char *nano_cut_word_right_msg = |
| 575 | N_("Cut forward from cursor to next word start"); |
Benno Schulenberg | 95e77a9 | 2014-06-30 20:39:27 +0000 | [diff] [blame] | 576 | const char *nano_cut_till_eof_msg = |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 577 | N_("Cut from the cursor position to the end of the file"); |
| 578 | #endif |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 579 | #ifndef DISABLE_JUSTIFY |
| 580 | const char *nano_fulljustify_msg = N_("Justify the entire file"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 581 | #endif |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 582 | #ifndef NANO_TINY |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 583 | const char *nano_wordcount_msg = |
| 584 | N_("Count the number of words, lines, and characters"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 585 | #endif |
David Lawrence Ramsey | 854a44a | 2006-04-24 21:14:55 +0000 | [diff] [blame] | 586 | const char *nano_refresh_msg = |
| 587 | N_("Refresh (redraw) the current screen"); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 588 | const char *nano_suspend_msg = |
Benno Schulenberg | f7e8861 | 2015-07-26 09:29:42 +0000 | [diff] [blame] | 589 | N_("Suspend the editor (if suspension is enabled)"); |
Benno Schulenberg | 68a0314 | 2016-12-07 13:10:40 +0100 | [diff] [blame] | 590 | #ifdef ENABLE_WORDCOMPLETION |
| 591 | const char *nano_completion_msg = N_("Try and complete the current word"); |
| 592 | #endif |
Benno Schulenberg | 964c10d | 2016-12-07 19:56:27 +0100 | [diff] [blame] | 593 | #ifdef ENABLE_COMMENT |
| 594 | const char *nano_comment_msg = |
| 595 | N_("Comment/uncomment the current line or marked lines"); |
| 596 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 597 | #ifndef NANO_TINY |
Benno Schulenberg | ee7b095 | 2015-07-25 19:25:50 +0000 | [diff] [blame] | 598 | const char *nano_savefile_msg = N_("Save file without prompting"); |
Benno Schulenberg | 4990f74 | 2015-07-26 09:23:24 +0000 | [diff] [blame] | 599 | const char *nano_findprev_msg = N_("Search next occurrence backward"); |
| 600 | const char *nano_findnext_msg = N_("Search next occurrence forward"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 601 | const char *nano_case_msg = |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 602 | N_("Toggle the case sensitivity of the search"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 603 | const char *nano_reverse_msg = |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 604 | N_("Reverse the direction of the search"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 605 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 606 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 607 | const char *nano_regexp_msg = |
| 608 | N_("Toggle the use of regular expressions"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 609 | #endif |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 610 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | 305d889 | 2006-05-24 19:48:03 +0000 | [diff] [blame] | 611 | const char *nano_prev_history_msg = |
David Lawrence Ramsey | 7b0531a | 2006-07-31 01:30:31 +0000 | [diff] [blame] | 612 | N_("Recall the previous search/replace string"); |
David Lawrence Ramsey | 305d889 | 2006-05-24 19:48:03 +0000 | [diff] [blame] | 613 | const char *nano_next_history_msg = |
David Lawrence Ramsey | 7b0531a | 2006-07-31 01:30:31 +0000 | [diff] [blame] | 614 | N_("Recall the next search/replace string"); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 615 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 616 | #ifndef DISABLE_BROWSER |
| 617 | const char *nano_tofiles_msg = N_("Go to file browser"); |
| 618 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 619 | #ifndef NANO_TINY |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 620 | const char *nano_dos_msg = N_("Toggle the use of DOS format"); |
| 621 | const char *nano_mac_msg = N_("Toggle the use of Mac format"); |
David Lawrence Ramsey | 69e1ce5 | 2006-06-08 02:37:45 +0000 | [diff] [blame] | 622 | const char *nano_append_msg = N_("Toggle appending"); |
| 623 | const char *nano_prepend_msg = N_("Toggle prepending"); |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 624 | const char *nano_backup_msg = N_("Toggle backing up of the original file"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 625 | const char *nano_execute_msg = N_("Execute external command"); |
| 626 | #endif |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 627 | const char *nano_discard_buffer_msg = N_("Close buffer without saving it"); |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 628 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 629 | const char *nano_multibuffer_msg = N_("Toggle the use of a new buffer"); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 630 | #endif |
| 631 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 632 | const char *nano_exitbrowser_msg = N_("Exit from the file browser"); |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 633 | const char *nano_firstfile_msg = N_("Go to the first file in the list"); |
| 634 | const char *nano_lastfile_msg = N_("Go to the last file in the list"); |
Chris Allegretta | 8d41fb8 | 2009-12-23 05:03:09 +0000 | [diff] [blame] | 635 | const char *nano_backfile_msg = N_("Go to the previous file in the list"); |
Benno Schulenberg | 022d32a | 2014-05-26 10:07:00 +0000 | [diff] [blame] | 636 | const char *nano_forwardfile_msg = N_("Go to the next file in the list"); |
David Lawrence Ramsey | c41d428 | 2004-07-23 12:51:40 +0000 | [diff] [blame] | 637 | const char *nano_gotodir_msg = N_("Go to directory"); |
Chris Allegretta | 2bef182 | 2001-09-28 19:53:11 +0000 | [diff] [blame] | 638 | #endif |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 639 | #ifndef DISABLE_COLOR |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 640 | const char *nano_lint_msg = N_("Invoke the linter, if available"); |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 641 | const char *nano_prevlint_msg = N_("Go to previous linter msg"); |
| 642 | const char *nano_nextlint_msg = N_("Go to next linter msg"); |
Benno Schulenberg | 14a9c8a | 2015-03-27 16:55:49 +0000 | [diff] [blame] | 643 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 644 | const char *nano_formatter_msg = N_("Invoke formatter, if available"); |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 645 | #endif |
Benno Schulenberg | 14a9c8a | 2015-03-27 16:55:49 +0000 | [diff] [blame] | 646 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 647 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 648 | |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 649 | #ifndef DISABLE_HELP |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 650 | #define IFSCHELP(help) help |
David Lawrence Ramsey | ea43a1d | 2004-03-02 22:52:57 +0000 | [diff] [blame] | 651 | #else |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 652 | #define IFSCHELP(help) "" |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 653 | #endif |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 654 | |
Benno Schulenberg | f803ef5 | 2014-04-13 12:16:37 +0000 | [diff] [blame] | 655 | /* Start populating the different menus with functions. */ |
| 656 | |
Benno Schulenberg | f6a3ab0 | 2014-04-16 09:55:16 +0000 | [diff] [blame] | 657 | add_to_funcs(do_help_void, MMOST, |
Benno Schulenberg | c8b60ce | 2014-04-22 11:57:11 +0000 | [diff] [blame] | 658 | /* TRANSLATORS: Try to keep the following strings at most 10 characters. */ |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 659 | N_("Get Help"), IFSCHELP(nano_help_msg), TOGETHER, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 660 | |
Benno Schulenberg | f6a3ab0 | 2014-04-16 09:55:16 +0000 | [diff] [blame] | 661 | add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), |
Benno Schulenberg | 338807a | 2016-05-05 13:27:07 +0200 | [diff] [blame] | 662 | N_("Cancel"), IFSCHELP(nano_cancel_msg), BLANKAFTER, VIEW); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 663 | |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 664 | add_to_funcs(do_exit, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 665 | exit_tag, IFSCHELP(nano_exit_msg), TOGETHER, VIEW); |
Benno Schulenberg | 11d7644 | 2014-04-26 19:01:18 +0000 | [diff] [blame] | 666 | /* Remember the entry for Exit, to be able to replace it with Close. */ |
| 667 | exitfunc = tailfunc; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 668 | |
Chris Allegretta | dcd19c9 | 2008-03-20 04:51:26 +0000 | [diff] [blame] | 669 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 670 | add_to_funcs(do_exit, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 671 | exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW); |
Chris Allegretta | dcd19c9 | 2008-03-20 04:51:26 +0000 | [diff] [blame] | 672 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 673 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 674 | add_to_funcs(do_writeout_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 675 | N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 676 | |
Benno Schulenberg | 2ee18d6 | 2015-07-30 10:37:28 +0000 | [diff] [blame] | 677 | #ifndef DISABLE_JUSTIFY |
| 678 | if (!ISSET(RESTRICTED)) { |
| 679 | #else |
| 680 | /* If we can't replace Insert with Justify, show Insert anyway, to |
| 681 | * keep the help items nicely paired also in restricted mode. */ |
| 682 | if (TRUE) { |
| 683 | #endif |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 684 | add_to_funcs(do_insertfile_void, MMAIN, |
| 685 | read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER, |
Benno Schulenberg | 2ee18d6 | 2015-07-30 10:37:28 +0000 | [diff] [blame] | 686 | /* We allow inserting files in view mode if multibuffer mode |
| 687 | * is switched on, so that we can view multiple files. */ |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 688 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 689 | VIEW); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 690 | #else |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 691 | NOVIEW); |
Chris Allegretta | 32da456 | 2002-01-02 15:12:21 +0000 | [diff] [blame] | 692 | #endif |
Benno Schulenberg | 2ee18d6 | 2015-07-30 10:37:28 +0000 | [diff] [blame] | 693 | } else { |
| 694 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 695 | add_to_funcs(do_justify_void, MMAIN, |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 696 | justify_tag, IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW); |
Benno Schulenberg | 2ee18d6 | 2015-07-30 10:37:28 +0000 | [diff] [blame] | 697 | #endif |
| 698 | } |
Chris Allegretta | af6414a | 2001-02-11 19:05:05 +0000 | [diff] [blame] | 699 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 700 | add_to_funcs(do_search, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 701 | whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 702 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 703 | add_to_funcs(do_replace, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 704 | replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 705 | |
| 706 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 707 | add_to_funcs(do_search, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 708 | whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW); |
Benno Schulenberg | 960a120 | 2014-03-18 22:04:41 +0000 | [diff] [blame] | 709 | |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 710 | add_to_funcs(goto_dir_void, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 711 | N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | cae7aea | 2014-02-26 20:37:40 +0000 | [diff] [blame] | 712 | #endif |
| 713 | |
Benno Schulenberg | 5c2b44a | 2014-04-15 20:01:19 +0000 | [diff] [blame] | 714 | #ifndef DISABLE_HELP |
Benno Schulenberg | 12da94c | 2014-04-22 10:02:55 +0000 | [diff] [blame] | 715 | /* The description ("x") and blank_after (0) are irrelevant, |
| 716 | * because the help viewer does not have a help text. */ |
Benno Schulenberg | 9fc713b | 2014-04-22 10:18:48 +0000 | [diff] [blame] | 717 | add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW); |
Benno Schulenberg | 5c2b44a | 2014-04-15 20:01:19 +0000 | [diff] [blame] | 718 | |
Benno Schulenberg | 9fc713b | 2014-04-22 10:18:48 +0000 | [diff] [blame] | 719 | add_to_funcs(total_refresh, MHELP, refresh_tag, "x", 0, VIEW); |
Benno Schulenberg | 12da94c | 2014-04-22 10:02:55 +0000 | [diff] [blame] | 720 | |
| 721 | add_to_funcs(do_up_void, MHELP, prev_line_tag, "x", 0, VIEW); |
| 722 | add_to_funcs(do_down_void, MHELP, next_line_tag, "x" , 0, VIEW); |
Benno Schulenberg | 5c2b44a | 2014-04-15 20:01:19 +0000 | [diff] [blame] | 723 | #endif |
| 724 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 725 | add_to_funcs(do_cut_text_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 726 | N_("Cut Text"), IFSCHELP(nano_cut_msg), TOGETHER, NOVIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 727 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 728 | add_to_funcs(do_uncut_text, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 729 | uncut_tag, IFSCHELP(nano_uncut_msg), BLANKAFTER, NOVIEW); |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 730 | /* Remember the entry for Uncut, to be able to replace it with Unjustify. */ |
Benno Schulenberg | 20b1e92 | 2014-04-26 18:41:43 +0000 | [diff] [blame] | 731 | uncutfunc = tailfunc; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 732 | |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 733 | if (!ISSET(RESTRICTED)) { |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 734 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 735 | add_to_funcs(do_justify_void, MMAIN, |
Benno Schulenberg | b7f7df9 | 2015-07-30 19:51:08 +0000 | [diff] [blame] | 736 | justify_tag, IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW); |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 737 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 738 | |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 739 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 740 | add_to_funcs(do_spell, MMAIN, |
| 741 | N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 742 | #endif |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 743 | #ifndef DISABLE_COLOR |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 744 | add_to_funcs(do_linter, MMAIN, |
| 745 | N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | 14a9c8a | 2015-03-27 16:55:49 +0000 | [diff] [blame] | 746 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 747 | add_to_funcs(do_formatter, MMAIN, |
| 748 | N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW); |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 749 | #endif |
Benno Schulenberg | 14a9c8a | 2015-03-27 16:55:49 +0000 | [diff] [blame] | 750 | #endif |
Benno Schulenberg | 104ea6b | 2015-07-30 11:29:45 +0000 | [diff] [blame] | 751 | } |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 752 | |
Benno Schulenberg | fd6308d | 2016-09-03 13:41:02 +0200 | [diff] [blame] | 753 | add_to_funcs(do_cursorpos_void, MMAIN, |
| 754 | N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), TOGETHER, VIEW); |
| 755 | |
| 756 | #if (!defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \ |
| 757 | defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR)) |
| 758 | /* Conditionally placing this one here or further on, to keep the |
| 759 | * help items nicely paired in most conditions. */ |
| 760 | add_to_funcs(do_gotolinecolumn_void, MMAIN, |
| 761 | gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW); |
| 762 | #endif |
| 763 | |
Benno Schulenberg | b095725 | 2014-07-01 16:24:01 +0000 | [diff] [blame] | 764 | add_to_funcs(case_sens_void, MWHEREIS|MREPLACE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 765 | N_("Case Sens"), IFSCHELP(nano_case_msg), TOGETHER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 766 | #ifdef HAVE_REGEX_H |
Benno Schulenberg | b095725 | 2014-07-01 16:24:01 +0000 | [diff] [blame] | 767 | add_to_funcs(regexp_void, MWHEREIS|MREPLACE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 768 | N_("Regexp"), IFSCHELP(nano_regexp_msg), TOGETHER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 769 | #endif |
Benno Schulenberg | b095725 | 2014-07-01 16:24:01 +0000 | [diff] [blame] | 770 | add_to_funcs(backwards_void, MWHEREIS|MREPLACE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 771 | N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 772 | |
Benno Schulenberg | a0f66c0 | 2014-06-23 18:30:35 +0000 | [diff] [blame] | 773 | add_to_funcs(flip_replace_void, MWHEREIS, |
Benno Schulenberg | 3d82986 | 2016-05-16 16:55:11 +0200 | [diff] [blame] | 774 | replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 775 | |
Benno Schulenberg | a0f66c0 | 2014-06-23 18:30:35 +0000 | [diff] [blame] | 776 | add_to_funcs(flip_replace_void, MREPLACE, |
Benno Schulenberg | 3d82986 | 2016-05-16 16:55:11 +0200 | [diff] [blame] | 777 | N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 778 | |
| 779 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 780 | add_to_funcs(do_full_justify, MWHEREIS, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 781 | fulljustify_tag, IFSCHELP(nano_fulljustify_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 782 | |
Benno Schulenberg | 1dbebbc | 2016-09-03 13:32:49 +0200 | [diff] [blame] | 783 | add_to_funcs(do_gotolinecolumn_void, MWHEREIS, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 784 | gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | 0d5e732 | 2014-05-27 12:17:49 +0000 | [diff] [blame] | 785 | #endif |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 786 | |
Benno Schulenberg | cc65a42 | 2015-04-17 10:06:03 +0000 | [diff] [blame] | 787 | add_to_funcs(do_page_up, MMAIN|MHELP, |
| 788 | prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW); |
| 789 | add_to_funcs(do_page_down, MMAIN|MHELP, |
| 790 | next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW); |
Benno Schulenberg | 61758e9 | 2014-04-27 14:21:57 +0000 | [diff] [blame] | 791 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 792 | add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 793 | N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 794 | add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 795 | N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW); |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 796 | |
Benno Schulenberg | bc8bb7e | 2016-09-12 12:49:46 +0200 | [diff] [blame] | 797 | #ifndef NANO_TINY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 798 | add_to_funcs(do_research, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 799 | whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW); |
Benno Schulenberg | 4da2434 | 2014-04-27 15:20:57 +0000 | [diff] [blame] | 800 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 801 | add_to_funcs(do_find_bracket, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 802 | N_("To Bracket"), IFSCHELP(nano_bracket_msg), TOGETHER, VIEW); |
Benno Schulenberg | 4da2434 | 2014-04-27 15:20:57 +0000 | [diff] [blame] | 803 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 804 | add_to_funcs(do_mark, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 805 | N_("Mark Text"), IFSCHELP(nano_mark_msg), TOGETHER, VIEW); |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 806 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 807 | add_to_funcs(do_copy_text, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 808 | N_("Copy Text"), IFSCHELP(nano_copy_msg), BLANKAFTER, NOVIEW); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 809 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 810 | add_to_funcs(do_indent_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 811 | N_("Indent Text"), IFSCHELP(nano_indent_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 812 | add_to_funcs(do_unindent, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 813 | N_("Unindent Text"), IFSCHELP(nano_unindent_msg), BLANKAFTER, NOVIEW); |
Chris Allegretta | 07fcc4c | 2008-07-10 20:13:04 +0000 | [diff] [blame] | 814 | |
Benno Schulenberg | 736fbf2 | 2014-06-13 15:20:26 +0000 | [diff] [blame] | 815 | add_to_funcs(do_undo, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 816 | N_("Undo"), IFSCHELP(nano_undo_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | 736fbf2 | 2014-06-13 15:20:26 +0000 | [diff] [blame] | 817 | add_to_funcs(do_redo, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 818 | N_("Redo"), IFSCHELP(nano_redo_msg), BLANKAFTER, NOVIEW); |
Benno Schulenberg | e4c34c3 | 2014-03-17 14:15:57 +0000 | [diff] [blame] | 819 | #endif /* !NANO_TINY */ |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 820 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 821 | add_to_funcs(do_left, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 822 | N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 823 | add_to_funcs(do_right, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 824 | N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW); |
Chris Allegretta | 8d41fb8 | 2009-12-23 05:03:09 +0000 | [diff] [blame] | 825 | |
| 826 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 827 | add_to_funcs(do_left, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 828 | N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 829 | add_to_funcs(do_right, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 830 | N_("Forward"), IFSCHELP(nano_forwardfile_msg), TOGETHER, VIEW); |
Chris Allegretta | 8d41fb8 | 2009-12-23 05:03:09 +0000 | [diff] [blame] | 831 | #endif |
| 832 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 833 | add_to_funcs(do_prev_word_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 834 | N_("Prev Word"), IFSCHELP(nano_prevword_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 835 | add_to_funcs(do_next_word_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 836 | N_("Next Word"), IFSCHELP(nano_nextword_msg), TOGETHER, VIEW); |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 837 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 838 | add_to_funcs(do_home, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 839 | N_("Home"), IFSCHELP(nano_home_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 840 | add_to_funcs(do_end, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 841 | N_("End"), IFSCHELP(nano_end_msg), TOGETHER, VIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 842 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 843 | add_to_funcs(do_up_void, MMAIN|MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 844 | prev_line_tag, IFSCHELP(nano_prevline_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 845 | add_to_funcs(do_down_void, MMAIN|MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 846 | next_line_tag, IFSCHELP(nano_nextline_msg), BLANKAFTER, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 847 | |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 848 | add_to_funcs(do_prev_block, MMAIN, |
| 849 | N_("Prev Block"), IFSCHELP(nano_prevblock_msg), TOGETHER, VIEW); |
| 850 | add_to_funcs(do_next_block, MMAIN, |
| 851 | N_("Next Block"), IFSCHELP(nano_nextblock_msg), TOGETHER, VIEW); |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 852 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 853 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 854 | add_to_funcs(do_para_begin_void, MMAIN|MWHEREIS, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 855 | N_("Beg of Par"), IFSCHELP(nano_parabegin_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 856 | add_to_funcs(do_para_end_void, MMAIN|MWHEREIS, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 857 | N_("End of Par"), IFSCHELP(nano_paraend_msg), TOGETHER, VIEW); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 858 | #endif |
David Lawrence Ramsey | e049706 | 2003-08-23 21:11:06 +0000 | [diff] [blame] | 859 | |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 860 | #ifndef NANO_TINY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 861 | add_to_funcs(do_scroll_up, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 862 | N_("Scroll Up"), IFSCHELP(nano_scrollup_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 863 | add_to_funcs(do_scroll_down, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 864 | N_("Scroll Down"), IFSCHELP(nano_scrolldown_msg), BLANKAFTER, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 865 | #endif |
David Lawrence Ramsey | df45365 | 2006-04-21 02:05:09 +0000 | [diff] [blame] | 866 | |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 867 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 868 | add_to_funcs(switch_to_prev_buffer_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 869 | N_("Prev File"), IFSCHELP(nano_prevfile_msg), TOGETHER, VIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 870 | add_to_funcs(switch_to_next_buffer_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 871 | N_("Next File"), IFSCHELP(nano_nextfile_msg), BLANKAFTER, VIEW); |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 872 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 873 | |
Benno Schulenberg | 1dbebbc | 2016-09-03 13:32:49 +0200 | [diff] [blame] | 874 | #if (defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \ |
| 875 | !defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR)) |
Benno Schulenberg | 71e452a | 2016-05-14 12:29:51 +0200 | [diff] [blame] | 876 | add_to_funcs(do_gotolinecolumn_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 877 | gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | 0d5e732 | 2014-05-27 12:17:49 +0000 | [diff] [blame] | 878 | #endif |
| 879 | |
Benno Schulenberg | bc8bb7e | 2016-09-12 12:49:46 +0200 | [diff] [blame] | 880 | #ifdef NANO_TINY |
| 881 | /* Place this one here only in the tiny version; otherwise further up. */ |
| 882 | add_to_funcs(do_research, MMAIN, |
| 883 | whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW); |
| 884 | #endif |
| 885 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 886 | add_to_funcs(do_verbatim_input, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 887 | N_("Verbatim"), IFSCHELP(nano_verbatim_msg), TOGETHER, NOVIEW); |
Chris Allegretta | aa17df0 | 2008-03-17 05:50:04 +0000 | [diff] [blame] | 888 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 889 | add_to_funcs(do_tab, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 890 | N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | bde996d | 2015-11-11 19:56:35 +0000 | [diff] [blame] | 891 | add_to_funcs(do_enter, MMAIN, |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 892 | N_("Enter"), IFSCHELP(nano_enter_msg), BLANKAFTER, NOVIEW); |
| 893 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 894 | add_to_funcs(do_delete, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 895 | N_("Delete"), IFSCHELP(nano_delete_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 896 | add_to_funcs(do_backspace, MMAIN, |
| 897 | N_("Backspace"), IFSCHELP(nano_backspace_msg), |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 898 | #ifndef NANO_TINY |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 899 | TOGETHER, |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 900 | #else |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 901 | BLANKAFTER, |
David Lawrence Ramsey | bf48798 | 2006-04-24 20:50:52 +0000 | [diff] [blame] | 902 | #endif |
Chris Allegretta | eb64314 | 2008-03-12 04:44:14 +0000 | [diff] [blame] | 903 | NOVIEW); |
| 904 | |
David Lawrence Ramsey | 2ca2356 | 2006-04-23 19:15:15 +0000 | [diff] [blame] | 905 | #ifndef NANO_TINY |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 906 | add_to_funcs(do_cut_prev_word, MMAIN, |
Benno Schulenberg | cca22bb | 2016-02-05 12:27:54 +0000 | [diff] [blame] | 907 | /* TRANSLATORS: The next two strings refer to cutting words. */ |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 908 | N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW); |
| 909 | add_to_funcs(do_cut_next_word, MMAIN, |
| 910 | N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | 95e77a9 | 2014-06-30 20:39:27 +0000 | [diff] [blame] | 911 | add_to_funcs(do_cut_till_eof, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 912 | N_("CutTillEnd"), IFSCHELP(nano_cut_till_eof_msg), BLANKAFTER, NOVIEW); |
David Lawrence Ramsey | 2ca2356 | 2006-04-23 19:15:15 +0000 | [diff] [blame] | 913 | #endif |
| 914 | |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 915 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 916 | add_to_funcs(do_full_justify, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 917 | fulljustify_tag, IFSCHELP(nano_fulljustify_msg), TOGETHER, NOVIEW); |
David Lawrence Ramsey | db6015c | 2004-09-11 21:41:13 +0000 | [diff] [blame] | 918 | #endif |
| 919 | |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 920 | #ifndef NANO_TINY |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 921 | add_to_funcs(do_wordlinechar_count, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 922 | N_("Word Count"), IFSCHELP(nano_wordcount_msg), TOGETHER, VIEW); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 923 | #endif |
David Lawrence Ramsey | efb4b0a | 2006-04-19 14:09:01 +0000 | [diff] [blame] | 924 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 925 | add_to_funcs(total_refresh, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 926 | refresh_tag, IFSCHELP(nano_refresh_msg), TOGETHER, VIEW); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 927 | |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 928 | add_to_funcs(do_suspend_void, MMAIN, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 929 | N_("Suspend"), IFSCHELP(nano_suspend_msg), BLANKAFTER, VIEW); |
David Lawrence Ramsey | 8faf305 | 2003-09-04 20:25:29 +0000 | [diff] [blame] | 930 | |
Benno Schulenberg | 68a0314 | 2016-12-07 13:10:40 +0100 | [diff] [blame] | 931 | #ifdef ENABLE_WORDCOMPLETION |
| 932 | add_to_funcs(complete_a_word, MMAIN, |
| 933 | N_("Complete"), IFSCHELP(nano_completion_msg), TOGETHER, NOVIEW); |
| 934 | #endif |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 935 | #ifdef ENABLE_COMMENT |
| 936 | add_to_funcs(do_comment, MMAIN, |
| 937 | N_("Comment Lines"), IFSCHELP(nano_comment_msg), BLANKAFTER, NOVIEW); |
| 938 | #endif |
Benno Schulenberg | ee7b095 | 2015-07-25 19:25:50 +0000 | [diff] [blame] | 939 | #ifndef NANO_TINY |
| 940 | add_to_funcs(do_savefile, MMAIN, |
| 941 | N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW); |
Benno Schulenberg | 4990f74 | 2015-07-26 09:23:24 +0000 | [diff] [blame] | 942 | |
| 943 | add_to_funcs(do_findprevious, MMAIN, |
| 944 | N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW); |
| 945 | add_to_funcs(do_findnext, MMAIN, |
| 946 | N_("Next"), IFSCHELP(nano_findnext_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | ee7b095 | 2015-07-25 19:25:50 +0000 | [diff] [blame] | 947 | #endif |
| 948 | |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 949 | #ifndef DISABLE_HISTORIES |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 950 | add_to_funcs(get_history_older_void, |
Benno Schulenberg | e167afe | 2014-04-16 09:26:15 +0000 | [diff] [blame] | 951 | (MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE), |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 952 | N_("PrevHstory"), IFSCHELP(nano_prev_history_msg), TOGETHER, VIEW); |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 953 | add_to_funcs(get_history_newer_void, |
Benno Schulenberg | e167afe | 2014-04-16 09:26:15 +0000 | [diff] [blame] | 954 | (MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE), |
Benno Schulenberg | 71e452a | 2016-05-14 12:29:51 +0200 | [diff] [blame] | 955 | N_("NextHstory"), IFSCHELP(nano_next_history_msg), BLANKAFTER, VIEW); |
| 956 | #endif |
| 957 | |
Benno Schulenberg | 1dbebbc | 2016-09-03 13:32:49 +0200 | [diff] [blame] | 958 | #ifdef DISABLE_JUSTIFY |
Benno Schulenberg | 71e452a | 2016-05-14 12:29:51 +0200 | [diff] [blame] | 959 | add_to_funcs(do_gotolinecolumn_void, MWHEREIS, |
| 960 | gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW); |
David Lawrence Ramsey | c10d8ff | 2005-06-03 20:51:39 +0000 | [diff] [blame] | 961 | #endif |
David Lawrence Ramsey | 02085d7 | 2004-11-07 16:04:18 +0000 | [diff] [blame] | 962 | |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 963 | add_to_funcs(gototext_void, MGOTOLINE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 964 | N_("Go To Text"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 965 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 966 | #ifndef NANO_TINY |
Benno Schulenberg | cdcd365 | 2016-05-17 11:33:21 +0200 | [diff] [blame] | 967 | add_to_funcs(dos_format_void, MWRITEFILE, |
Benno Schulenberg | f811846 | 2015-08-13 19:29:55 +0000 | [diff] [blame] | 968 | N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | cdcd365 | 2016-05-17 11:33:21 +0200 | [diff] [blame] | 969 | add_to_funcs(mac_format_void, MWRITEFILE, |
Benno Schulenberg | f811846 | 2015-08-13 19:29:55 +0000 | [diff] [blame] | 970 | N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW); |
| 971 | |
| 972 | /* If we're using restricted mode, the Append, Prepend, and Backup toggles |
| 973 | * are disabled. The first and second are not useful as they only allow |
| 974 | * reduplicating the current file, and the third is not allowed as it |
| 975 | * would write to a file not specified on the command line. */ |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 976 | if (!ISSET(RESTRICTED)) { |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 977 | add_to_funcs(append_void, MWRITEFILE, |
| 978 | N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW); |
| 979 | add_to_funcs(prepend_void, MWRITEFILE, |
| 980 | N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW); |
Chris Allegretta | 0e9b7aa | 2002-04-16 03:15:47 +0000 | [diff] [blame] | 981 | |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 982 | add_to_funcs(backup_file_void, MWRITEFILE, |
Benno Schulenberg | 338807a | 2016-05-05 13:27:07 +0200 | [diff] [blame] | 983 | N_("Backup File"), IFSCHELP(nano_backup_msg), BLANKAFTER, NOVIEW); |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 984 | } |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 985 | |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 986 | /* If we're using restricted mode, file insertion is disabled, and |
| 987 | * thus command execution and the multibuffer toggle have no place. */ |
| 988 | if (!ISSET(RESTRICTED)) { |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 989 | add_to_funcs(flip_execute_void, MINSERTFILE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 990 | N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW); |
David Lawrence Ramsey | a593f53 | 2003-11-28 19:47:42 +0000 | [diff] [blame] | 991 | |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 992 | add_to_funcs(flip_execute_void, MEXTCMD, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 993 | read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW); |
Benno Schulenberg | ff6b92c | 2014-05-28 15:35:00 +0000 | [diff] [blame] | 994 | |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 995 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 996 | add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 997 | N_("New Buffer"), IFSCHELP(nano_multibuffer_msg), TOGETHER, NOVIEW); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 998 | #endif |
Benno Schulenberg | 91ee10a | 2014-03-27 21:35:18 +0000 | [diff] [blame] | 999 | } |
Benno Schulenberg | e4c34c3 | 2014-03-17 14:15:57 +0000 | [diff] [blame] | 1000 | #endif /* !NANO_TINY */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 1001 | |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 1002 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1003 | if (!ISSET(RESTRICTED)) |
| 1004 | add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 1005 | N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1006 | |
Benno Schulenberg | cc65a42 | 2015-04-17 10:06:03 +0000 | [diff] [blame] | 1007 | add_to_funcs(do_page_up, MBROWSER, |
| 1008 | prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW); |
| 1009 | add_to_funcs(do_page_down, MBROWSER, |
| 1010 | next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW); |
| 1011 | |
Benno Schulenberg | e34ac8e | 2014-03-17 12:15:23 +0000 | [diff] [blame] | 1012 | add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE), |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 1013 | N_("First File"), IFSCHELP(nano_firstfile_msg), TOGETHER, VIEW); |
Benno Schulenberg | e34ac8e | 2014-03-17 12:15:23 +0000 | [diff] [blame] | 1014 | add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE), |
Benno Schulenberg | cc65a42 | 2015-04-17 10:06:03 +0000 | [diff] [blame] | 1015 | N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1016 | #endif |
Chris Allegretta | b3655b4 | 2001-10-22 03:15:31 +0000 | [diff] [blame] | 1017 | |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 1018 | add_to_funcs(discard_buffer, MWRITEFILE, |
| 1019 | N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW); |
| 1020 | |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1021 | #if !defined(NANO_TINY) && !defined(DISABLE_BROWSER) |
Benno Schulenberg | f470c90 | 2014-05-28 21:02:39 +0000 | [diff] [blame] | 1022 | add_to_funcs(do_research, MBROWSER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 1023 | whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1024 | #endif |
Benno Schulenberg | e21e954 | 2016-05-02 09:34:23 +0200 | [diff] [blame] | 1025 | #ifndef DISABLE_BROWSER |
| 1026 | add_to_funcs(total_refresh, MBROWSER, |
| 1027 | refresh_tag, IFSCHELP(nano_browser_refresh_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | eedec06 | 2016-05-17 12:48:47 +0200 | [diff] [blame] | 1028 | #ifndef NANO_TINY |
Benno Schulenberg | 36df5ce | 2016-05-12 10:10:04 +0200 | [diff] [blame] | 1029 | add_to_funcs(do_prev_word_void, MBROWSER, |
| 1030 | N_("Left Column"), IFSCHELP(nano_browser_lefthand_msg), TOGETHER, VIEW); |
| 1031 | add_to_funcs(do_next_word_void, MBROWSER, |
| 1032 | N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), BLANKAFTER, VIEW); |
Benno Schulenberg | e21e954 | 2016-05-02 09:34:23 +0200 | [diff] [blame] | 1033 | #endif |
Benno Schulenberg | eedec06 | 2016-05-17 12:48:47 +0200 | [diff] [blame] | 1034 | #endif |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1035 | |
| 1036 | #ifndef DISABLE_COLOR |
| 1037 | add_to_funcs(do_page_up, MLINTER, |
Benno Schulenberg | cca22bb | 2016-02-05 12:27:54 +0000 | [diff] [blame] | 1038 | /* TRANSLATORS: Try to keep the next two strings at most 20 characters. */ |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 1039 | N_("Prev Lint Msg"), IFSCHELP(nano_prevlint_msg), TOGETHER, VIEW); |
Benno Schulenberg | 6371612 | 2014-04-27 19:51:03 +0000 | [diff] [blame] | 1040 | add_to_funcs(do_page_down, MLINTER, |
Benno Schulenberg | e6a4a64 | 2014-07-01 18:52:21 +0000 | [diff] [blame] | 1041 | N_("Next Lint Msg"), IFSCHELP(nano_nextlint_msg), TOGETHER, VIEW); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 1042 | #endif |
| 1043 | |
Benno Schulenberg | f803ef5 | 2014-04-13 12:16:37 +0000 | [diff] [blame] | 1044 | /* Start associating key combos with functions in specific menus. */ |
| 1045 | |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1046 | add_to_sclist(MMOST, "^G", 0, do_help_void, 0); |
| 1047 | add_to_sclist(MMOST, "F1", 0, do_help_void, 0); |
| 1048 | add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0); |
| 1049 | add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0); |
| 1050 | add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0); |
| 1051 | add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0); |
| 1052 | add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0); |
| 1053 | add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0); |
| 1054 | add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0); |
| 1055 | add_to_sclist(MMAIN|MBROWSER, "^W", 0, do_search, 0); |
| 1056 | add_to_sclist(MMAIN|MBROWSER, "F6", 0, do_search, 0); |
| 1057 | add_to_sclist(MMAIN, "^\\", 0, do_replace, 0); |
| 1058 | add_to_sclist(MMAIN, "M-R", 0, do_replace, 0); |
| 1059 | add_to_sclist(MMAIN, "F14", 0, do_replace, 0); |
| 1060 | add_to_sclist(MMOST, "^K", 0, do_cut_text_void, 0); |
| 1061 | add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0); |
| 1062 | add_to_sclist(MMAIN, "^U", 0, do_uncut_text, 0); |
| 1063 | add_to_sclist(MMAIN, "F10", 0, do_uncut_text, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1064 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1065 | add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0); |
| 1066 | add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1067 | #endif |
| 1068 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1069 | add_to_sclist(MMAIN, "^T", 0, do_spell, 0); |
| 1070 | add_to_sclist(MMAIN, "F12", 0, do_spell, 0); |
Benno Schulenberg | 387b209 | 2014-05-09 15:14:29 +0000 | [diff] [blame] | 1071 | #else |
| 1072 | #ifndef DISABLE_COLOR |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1073 | add_to_sclist(MMAIN, "^T", 0, do_linter, 0); |
| 1074 | add_to_sclist(MMAIN, "F12", 0, do_linter, 0); |
Benno Schulenberg | 387b209 | 2014-05-09 15:14:29 +0000 | [diff] [blame] | 1075 | #endif |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1076 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1077 | add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0); |
| 1078 | add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0); |
| 1079 | add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0); |
| 1080 | add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0); |
| 1081 | add_to_sclist(MMAIN, "F13", 0, do_gotolinecolumn_void, 0); |
| 1082 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0); |
| 1083 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0); |
| 1084 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0); |
| 1085 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0); |
| 1086 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0); |
| 1087 | add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0); |
| 1088 | add_to_sclist(MMAIN|MHELP, "M-\\", 0, do_first_line, 0); |
| 1089 | add_to_sclist(MMAIN|MHELP, "M-|", 0, do_first_line, 0); |
| 1090 | add_to_sclist(MMAIN|MHELP, "M-/", 0, do_last_line, 0); |
| 1091 | add_to_sclist(MMAIN|MHELP, "M-?", 0, do_last_line, 0); |
| 1092 | add_to_sclist(MMAIN|MBROWSER, "M-W", 0, do_research, 0); |
| 1093 | add_to_sclist(MMAIN|MBROWSER, "F16", 0, do_research, 0); |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 1094 | #ifndef NANO_TINY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1095 | add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0); |
| 1096 | add_to_sclist(MMAIN, "^^", 0, do_mark, 0); |
| 1097 | add_to_sclist(MMAIN, "M-A", 0, do_mark, 0); |
| 1098 | add_to_sclist(MMAIN, "F15", 0, do_mark, 0); |
| 1099 | add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0); |
| 1100 | add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0); |
| 1101 | add_to_sclist(MMAIN, "M-}", 0, do_indent_void, 0); |
| 1102 | add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0); |
| 1103 | add_to_sclist(MMAIN, "M-U", 0, do_undo, 0); |
| 1104 | add_to_sclist(MMAIN, "M-E", 0, do_redo, 0); |
Benno Schulenberg | 68a0314 | 2016-12-07 13:10:40 +0100 | [diff] [blame] | 1105 | #endif |
| 1106 | #ifdef ENABLE_WORDCOMPLETION |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 1107 | add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0); |
Benno Schulenberg | c3e4a1f | 2014-03-17 11:47:49 +0000 | [diff] [blame] | 1108 | #endif |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 1109 | #ifdef ENABLE_COMMENT |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1110 | add_to_sclist(MMAIN, "M-3", 0, do_comment, 0); |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 1111 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1112 | add_to_sclist(MMOST, "^B", 0, do_left, 0); |
| 1113 | add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0); |
| 1114 | add_to_sclist(MMOST, "^F", 0, do_right, 0); |
| 1115 | add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0); |
Benno Schulenberg | 33bc848 | 2016-10-29 10:19:28 +0200 | [diff] [blame] | 1116 | #ifdef ENABLE_UTF8 |
Benno Schulenberg | 7a274d6 | 2016-10-12 12:21:44 +0200 | [diff] [blame] | 1117 | if (using_utf8()) { |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1118 | add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0); |
| 1119 | add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0); |
Benno Schulenberg | 33bc848 | 2016-10-29 10:19:28 +0200 | [diff] [blame] | 1120 | } else |
| 1121 | #endif |
| 1122 | { |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1123 | add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0); |
| 1124 | add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0); |
Benno Schulenberg | 7a274d6 | 2016-10-12 12:21:44 +0200 | [diff] [blame] | 1125 | } |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1126 | add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0); |
| 1127 | add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0); |
| 1128 | add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home, 0); |
| 1129 | add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home, 0); |
| 1130 | add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end, 0); |
| 1131 | add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end, 0); |
| 1132 | add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0); |
| 1133 | add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0); |
| 1134 | add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0); |
| 1135 | add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0); |
Benno Schulenberg | 33bc848 | 2016-10-29 10:19:28 +0200 | [diff] [blame] | 1136 | #ifdef ENABLE_UTF8 |
Benno Schulenberg | 7a274d6 | 2016-10-12 12:21:44 +0200 | [diff] [blame] | 1137 | if (using_utf8()) { |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1138 | add_to_sclist(MMAIN, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0); |
| 1139 | add_to_sclist(MMAIN, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0); |
Benno Schulenberg | 33bc848 | 2016-10-29 10:19:28 +0200 | [diff] [blame] | 1140 | } else |
| 1141 | #endif |
| 1142 | { |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1143 | add_to_sclist(MMAIN, "^Up", CONTROL_UP, do_prev_block, 0); |
| 1144 | add_to_sclist(MMAIN, "^Down", CONTROL_DOWN, do_next_block, 0); |
Benno Schulenberg | 7a274d6 | 2016-10-12 12:21:44 +0200 | [diff] [blame] | 1145 | } |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1146 | add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0); |
| 1147 | add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1148 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1149 | add_to_sclist(MMAIN, "M-(", 0, do_para_begin_void, 0); |
| 1150 | add_to_sclist(MMAIN, "M-9", 0, do_para_begin_void, 0); |
| 1151 | add_to_sclist(MMAIN, "M-)", 0, do_para_end_void, 0); |
| 1152 | add_to_sclist(MMAIN, "M-0", 0, do_para_end_void, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1153 | #endif |
| 1154 | #ifndef NANO_TINY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1155 | add_to_sclist(MMAIN, "M--", 0, do_scroll_up, 0); |
| 1156 | add_to_sclist(MMAIN, "M-_", 0, do_scroll_up, 0); |
| 1157 | add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0); |
| 1158 | add_to_sclist(MMAIN, "M-=", 0, do_scroll_down, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1159 | #endif |
| 1160 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1161 | add_to_sclist(MMAIN, "M-<", 0, switch_to_prev_buffer_void, 0); |
| 1162 | add_to_sclist(MMAIN, "M-,", 0, switch_to_prev_buffer_void, 0); |
| 1163 | add_to_sclist(MMAIN, "M->", 0, switch_to_next_buffer_void, 0); |
| 1164 | add_to_sclist(MMAIN, "M-.", 0, switch_to_next_buffer_void, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1165 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1166 | add_to_sclist(MMOST, "M-V", 0, do_verbatim_input, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1167 | #ifndef NANO_TINY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1168 | add_to_sclist(MMAIN, "M-T", 0, do_cut_till_eof, 0); |
| 1169 | add_to_sclist(MMAIN, "M-D", 0, do_wordlinechar_count, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1170 | #endif |
| 1171 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1172 | add_to_sclist(MMAIN|MWHEREIS, "M-J", 0, do_full_justify, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1173 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1174 | add_to_sclist(MMAIN|MHELP, "^L", 0, total_refresh, 0); |
| 1175 | add_to_sclist(MMAIN, "^Z", 0, do_suspend_void, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1176 | |
| 1177 | #ifndef NANO_TINY |
Benno Schulenberg | a6804b5 | 2014-05-09 20:33:49 +0000 | [diff] [blame] | 1178 | /* Group of "Appearance" toggles. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1179 | add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP); |
| 1180 | add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONST_UPDATE); |
| 1181 | add_to_sclist(MMAIN, "M-O", 0, do_toggle_void, MORE_SPACE); |
| 1182 | add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SMOOTH_SCROLL); |
| 1183 | add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP); |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 1184 | #ifdef ENABLE_LINENUMBERS |
| 1185 | add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS); |
| 1186 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1187 | add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1188 | #ifndef DISABLE_COLOR |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1189 | add_to_sclist(MMAIN, "M-Y", 0, do_toggle_void, NO_COLOR_SYNTAX); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1190 | #endif |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1191 | |
Benno Schulenberg | a6804b5 | 2014-05-09 20:33:49 +0000 | [diff] [blame] | 1192 | /* Group of "Editing-behavior" toggles. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1193 | add_to_sclist(MMAIN, "M-H", 0, do_toggle_void, SMART_HOME); |
| 1194 | add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT); |
| 1195 | add_to_sclist(MMAIN, "M-K", 0, do_toggle_void, CUT_TO_END); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1196 | #ifndef DISABLE_WRAPPING |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1197 | add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1198 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1199 | add_to_sclist(MMAIN, "M-Q", 0, do_toggle_void, TABS_TO_SPACES); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1200 | |
Benno Schulenberg | a6804b5 | 2014-05-09 20:33:49 +0000 | [diff] [blame] | 1201 | /* Group of "Peripheral-feature" toggles. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1202 | add_to_sclist(MMAIN, "M-B", 0, do_toggle_void, BACKUP_FILE); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1203 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1204 | add_to_sclist(MMAIN, "M-F", 0, do_toggle_void, MULTIBUFFER); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1205 | #endif |
| 1206 | #ifndef DISABLE_MOUSE |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1207 | add_to_sclist(MMAIN, "M-M", 0, do_toggle_void, USE_MOUSE); |
Benno Schulenberg | d16f9af | 2014-05-09 12:20:20 +0000 | [diff] [blame] | 1208 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1209 | add_to_sclist(MMAIN, "M-N", 0, do_toggle_void, NO_CONVERT); |
| 1210 | add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1211 | #endif /* !NANO_TINY */ |
| 1212 | |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1213 | add_to_sclist(MMAIN, "^Q", 0, xon_complaint, 0); |
| 1214 | add_to_sclist(MMAIN, "^S", 0, xoff_complaint, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1215 | |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1216 | add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1217 | |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1218 | add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0); |
| 1219 | add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0); |
| 1220 | add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0); |
| 1221 | add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0); |
| 1222 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0); |
| 1223 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1224 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1225 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", 0, do_para_begin_void, 0); |
| 1226 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", 0, do_para_end_void, 0); |
Benno Schulenberg | 523598a | 2014-05-03 19:19:31 +0000 | [diff] [blame] | 1227 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1228 | add_to_sclist(MWHEREIS, "^T", 0, do_gotolinecolumn_void, 0); |
| 1229 | add_to_sclist(MGOTOLINE, "^T", 0, gototext_void, 0); |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 1230 | #ifndef DISABLE_HISTORIES |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1231 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^P", 0, get_history_older_void, 0); |
| 1232 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Up", KEY_UP, get_history_older_void, 0); |
| 1233 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^N", 0, get_history_newer_void, 0); |
| 1234 | add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", KEY_DOWN, get_history_newer_void, 0); |
Chris Allegretta | 1b6ed07 | 2008-06-03 08:09:05 +0000 | [diff] [blame] | 1235 | #endif |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1236 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1237 | add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0); |
| 1238 | add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0); |
| 1239 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0); |
| 1240 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, do_first_file, 0); |
| 1241 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, do_last_file, 0); |
| 1242 | add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0); |
| 1243 | add_to_sclist(MBROWSER, "Home", KEY_HOME, do_first_file, 0); |
| 1244 | add_to_sclist(MBROWSER, "End", KEY_END, do_last_file, 0); |
| 1245 | add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0); |
| 1246 | add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0); |
| 1247 | add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0); |
| 1248 | add_to_sclist(MBROWSER, "^L", 0, total_refresh, 0); |
Benno Schulenberg | e34ac8e | 2014-03-17 12:15:23 +0000 | [diff] [blame] | 1249 | #endif |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 1250 | if (ISSET(TEMP_FILE)) |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1251 | add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0); |
| 1252 | add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0); |
| 1253 | add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0); |
Benno Schulenberg | f811846 | 2015-08-13 19:29:55 +0000 | [diff] [blame] | 1254 | if (!ISSET(RESTRICTED)) { |
| 1255 | /* Don't allow Appending, Prepending, nor Backups in restricted mode. */ |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1256 | add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0); |
| 1257 | add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0); |
| 1258 | add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0); |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 1259 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1260 | add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0); |
Benno Schulenberg | d1238c0 | 2014-05-13 20:51:19 +0000 | [diff] [blame] | 1261 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1262 | add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0); |
| 1263 | add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0); |
Benno Schulenberg | f811846 | 2015-08-13 19:29:55 +0000 | [diff] [blame] | 1264 | } |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1265 | add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0); |
Benno Schulenberg | 4a23a17 | 2015-11-08 19:40:13 +0000 | [diff] [blame] | 1266 | /* Allow exiting from the file browser and the help viewer with |
| 1267 | * the same key as they were entered. */ |
| 1268 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1269 | add_to_sclist(MBROWSER, "^T", 0, do_exit, 0); |
Benno Schulenberg | 4a23a17 | 2015-11-08 19:40:13 +0000 | [diff] [blame] | 1270 | #endif |
Benno Schulenberg | 8c5f504 | 2014-05-28 20:31:06 +0000 | [diff] [blame] | 1271 | #ifndef DISABLE_HELP |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1272 | add_to_sclist(MHELP, "^G", 0, do_exit, 0); |
| 1273 | add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0); |
| 1274 | add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0); |
Benno Schulenberg | 8c5f504 | 2014-05-28 20:31:06 +0000 | [diff] [blame] | 1275 | #endif |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 1276 | add_to_sclist(MMOST, "^I", 0, do_tab, 0); |
| 1277 | add_to_sclist(MMOST, "Tab", TAB_CODE, do_tab, 0); |
| 1278 | add_to_sclist(MMOST, "^M", 0, do_enter, 0); |
| 1279 | add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0); |
| 1280 | add_to_sclist(MMOST, "^D", 0, do_delete, 0); |
| 1281 | add_to_sclist(MMOST, "Del", 0, do_delete, 0); |
| 1282 | add_to_sclist(MMOST, "^H", 0, do_backspace, 0); |
| 1283 | add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1284 | |
| 1285 | #ifdef DEBUG |
| 1286 | print_sclist(); |
| 1287 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 1288 | } |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1289 | |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 1290 | #ifndef DISABLE_COLOR |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 1291 | void set_lint_or_format_shortcuts(void) |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 1292 | { |
| 1293 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 1294 | if (openfile->syntax->formatter) { |
| 1295 | replace_scs_for(do_spell, do_formatter); |
| 1296 | replace_scs_for(do_linter, do_formatter); |
| 1297 | } else { |
| 1298 | replace_scs_for(do_spell, do_linter); |
| 1299 | replace_scs_for(do_formatter, do_linter); |
| 1300 | } |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 1301 | #endif |
| 1302 | } |
| 1303 | |
| 1304 | void set_spell_shortcuts(void) |
| 1305 | { |
| 1306 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 1307 | replace_scs_for(do_formatter, do_spell); |
| 1308 | replace_scs_for(do_linter, do_spell); |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 1309 | #endif |
| 1310 | } |
Benno Schulenberg | 34fbb1f | 2016-01-13 20:32:40 +0000 | [diff] [blame] | 1311 | #endif /* !DISABLE_COLOR */ |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 1312 | |
Benno Schulenberg | dd29c56 | 2016-01-04 09:52:43 +0000 | [diff] [blame] | 1313 | const subnfunc *sctofunc(const sc *s) |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1314 | { |
Benno Schulenberg | dd29c56 | 2016-01-04 09:52:43 +0000 | [diff] [blame] | 1315 | subnfunc *f = allfuncs; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1316 | |
Benno Schulenberg | dd29c56 | 2016-01-04 09:52:43 +0000 | [diff] [blame] | 1317 | while (f != NULL && f->scfunc != s->scfunc) |
| 1318 | f = f->next; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1319 | |
| 1320 | return f; |
| 1321 | } |
| 1322 | |
| 1323 | #ifndef NANO_TINY |
Benno Schulenberg | d19be5a | 2014-04-08 18:38:45 +0000 | [diff] [blame] | 1324 | /* Now let's come up with a single (hopefully) function to get a string |
| 1325 | * for each flag. */ |
Chris Allegretta | 5a018f0 | 2009-11-29 06:13:22 +0000 | [diff] [blame] | 1326 | const char *flagtostr(int flag) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1327 | { |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1328 | switch (flag) { |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 1329 | case NO_HELP: |
| 1330 | /* TRANSLATORS: The next seventeen strings are toggle descriptions; |
| 1331 | * they are best kept shorter than 40 characters, but may be longer. */ |
| 1332 | return N_("Help mode"); |
| 1333 | case CONST_UPDATE: |
| 1334 | return N_("Constant cursor position display"); |
| 1335 | case MORE_SPACE: |
| 1336 | return N_("Use of one more line for editing"); |
| 1337 | case SMOOTH_SCROLL: |
| 1338 | return N_("Smooth scrolling"); |
| 1339 | case SOFTWRAP: |
| 1340 | return N_("Soft wrapping of overlong lines"); |
| 1341 | case WHITESPACE_DISPLAY: |
| 1342 | return N_("Whitespace display"); |
| 1343 | case NO_COLOR_SYNTAX: |
| 1344 | return N_("Color syntax highlighting"); |
| 1345 | case SMART_HOME: |
| 1346 | return N_("Smart home key"); |
| 1347 | case AUTOINDENT: |
| 1348 | return N_("Auto indent"); |
| 1349 | case CUT_TO_END: |
| 1350 | return N_("Cut to end"); |
| 1351 | case NO_WRAP: |
| 1352 | return N_("Hard wrapping of overlong lines"); |
| 1353 | case TABS_TO_SPACES: |
| 1354 | return N_("Conversion of typed tabs to spaces"); |
| 1355 | case BACKUP_FILE: |
| 1356 | return N_("Backup files"); |
| 1357 | case MULTIBUFFER: |
Benno Schulenberg | 296152e | 2015-04-18 16:07:53 +0000 | [diff] [blame] | 1358 | return N_("Reading file into separate buffer"); |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 1359 | case USE_MOUSE: |
| 1360 | return N_("Mouse support"); |
| 1361 | case NO_CONVERT: |
| 1362 | return N_("No conversion from DOS/Mac format"); |
| 1363 | case SUSPEND: |
| 1364 | return N_("Suspension"); |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 1365 | case LINE_NUMBERS: |
| 1366 | return N_("Line numbering"); |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 1367 | default: |
| 1368 | return "?????"; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1369 | } |
| 1370 | } |
Benno Schulenberg | e4c34c3 | 2014-03-17 14:15:57 +0000 | [diff] [blame] | 1371 | #endif /* !NANO_TINY */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1372 | |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1373 | #ifndef DISABLE_NANORC |
Benno Schulenberg | 1f934e3 | 2014-04-13 11:56:08 +0000 | [diff] [blame] | 1374 | /* Interpret a function string given in the rc file, and return a |
Benno Schulenberg | d4623f3 | 2014-06-28 14:42:18 +0000 | [diff] [blame] | 1375 | * shortcut struct with the corresponding function filled in. */ |
Benno Schulenberg | 539a4b4 | 2016-01-04 09:12:21 +0000 | [diff] [blame] | 1376 | sc *strtosc(const char *input) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1377 | { |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 1378 | sc *s = nmalloc(sizeof(sc)); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1379 | |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 1380 | #ifndef NANO_TINY |
Rishabh Dave | 1fd2354 | 2016-08-07 00:46:41 +0530 | [diff] [blame] | 1381 | s->toggle = 0; |
Benno Schulenberg | 7b7d2bf | 2016-09-01 09:36:47 +0200 | [diff] [blame] | 1382 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1383 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1384 | #ifndef DISABLE_HELP |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1385 | if (!strcasecmp(input, "help")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1386 | s->scfunc = do_help_void; |
| 1387 | else |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1388 | #endif |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1389 | if (!strcasecmp(input, "cancel")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1390 | s->scfunc = do_cancel; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1391 | else if (!strcasecmp(input, "exit")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1392 | s->scfunc = do_exit; |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 1393 | else if (!strcasecmp(input, "discardbuffer")) |
| 1394 | s->scfunc = discard_buffer; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1395 | else if (!strcasecmp(input, "writeout")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1396 | s->scfunc = do_writeout_void; |
Benno Schulenberg | ee7b095 | 2015-07-25 19:25:50 +0000 | [diff] [blame] | 1397 | #ifndef NANO_TINY |
| 1398 | else if (!strcasecmp(input, "savefile")) |
| 1399 | s->scfunc = do_savefile; |
| 1400 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1401 | else if (!strcasecmp(input, "insert")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1402 | s->scfunc = do_insertfile_void; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1403 | else if (!strcasecmp(input, "whereis")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1404 | s->scfunc = do_search; |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1405 | else if (!strcasecmp(input, "searchagain") || |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1406 | !strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */ |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1407 | s->scfunc = do_research; |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 1408 | #ifndef NANO_TINY |
Benno Schulenberg | 4990f74 | 2015-07-26 09:23:24 +0000 | [diff] [blame] | 1409 | else if (!strcasecmp(input, "findprevious")) |
| 1410 | s->scfunc = do_findprevious; |
| 1411 | else if (!strcasecmp(input, "findnext")) |
| 1412 | s->scfunc = do_findnext; |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 1413 | #endif |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1414 | else if (!strcasecmp(input, "replace")) |
| 1415 | s->scfunc = do_replace; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1416 | else if (!strcasecmp(input, "cut")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1417 | s->scfunc = do_cut_text_void; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1418 | else if (!strcasecmp(input, "uncut")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1419 | s->scfunc = do_uncut_text; |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 1420 | #ifndef NANO_TINY |
Benno Schulenberg | f8507bb | 2014-05-05 19:54:34 +0000 | [diff] [blame] | 1421 | else if (!strcasecmp(input, "cutrestoffile")) |
Benno Schulenberg | 95e77a9 | 2014-06-30 20:39:27 +0000 | [diff] [blame] | 1422 | s->scfunc = do_cut_till_eof; |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 1423 | else if (!strcasecmp(input, "copytext")) |
| 1424 | s->scfunc = do_copy_text; |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1425 | else if (!strcasecmp(input, "mark")) |
| 1426 | s->scfunc = do_mark; |
Benno Schulenberg | 387b209 | 2014-05-09 15:14:29 +0000 | [diff] [blame] | 1427 | #endif |
| 1428 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | 301c4ef | 2014-04-26 19:33:11 +0000 | [diff] [blame] | 1429 | else if (!strcasecmp(input, "tospell") || |
| 1430 | !strcasecmp(input, "speller")) |
| 1431 | s->scfunc = do_spell; |
Benno Schulenberg | 5f655da | 2014-04-27 15:26:25 +0000 | [diff] [blame] | 1432 | #endif |
Benno Schulenberg | 52d7d5f | 2015-03-27 15:34:41 +0000 | [diff] [blame] | 1433 | #ifndef DISABLE_COLOR |
Benno Schulenberg | b455fa3 | 2015-03-25 19:33:00 +0000 | [diff] [blame] | 1434 | else if (!strcasecmp(input, "linter")) |
| 1435 | s->scfunc = do_linter; |
Benno Schulenberg | 52d7d5f | 2015-03-27 15:34:41 +0000 | [diff] [blame] | 1436 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1437 | else if (!strcasecmp(input, "curpos") || |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1438 | !strcasecmp(input, "cursorpos")) /* Deprecated. Remove in 2018. */ |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1439 | s->scfunc = do_cursorpos_void; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1440 | else if (!strcasecmp(input, "gotoline")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1441 | s->scfunc = do_gotolinecolumn_void; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1442 | #ifndef DISABLE_JUSTIFY |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1443 | else if (!strcasecmp(input, "justify")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1444 | s->scfunc = do_justify_void; |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1445 | else if (!strcasecmp(input, "fulljustify")) |
| 1446 | s->scfunc = do_full_justify; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1447 | else if (!strcasecmp(input, "beginpara")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1448 | s->scfunc = do_para_begin_void; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1449 | else if (!strcasecmp(input, "endpara")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1450 | s->scfunc = do_para_end_void; |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1451 | #endif |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 1452 | #ifdef ENABLE_COMMENT |
| 1453 | else if (!strcasecmp(input, "comment")) |
| 1454 | s->scfunc = do_comment; |
| 1455 | #endif |
Benno Schulenberg | 0e01080 | 2016-12-07 13:20:36 +0100 | [diff] [blame] | 1456 | #ifdef ENABLE_WORDCOMPLETION |
| 1457 | else if (!strcasecmp(input, "complete")) |
| 1458 | s->scfunc = complete_a_word; |
| 1459 | #endif |
Chris Allegretta | c656e9d | 2008-03-16 12:55:41 +0000 | [diff] [blame] | 1460 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1461 | else if (!strcasecmp(input, "indent")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1462 | s->scfunc = do_indent_void; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1463 | else if (!strcasecmp(input, "unindent")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1464 | s->scfunc = do_unindent; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1465 | else if (!strcasecmp(input, "scrollup")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1466 | s->scfunc = do_scroll_up; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1467 | else if (!strcasecmp(input, "scrolldown")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1468 | s->scfunc = do_scroll_down; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1469 | else if (!strcasecmp(input, "prevword")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1470 | s->scfunc = do_prev_word_void; |
Benno Schulenberg | 3064db2 | 2014-04-21 12:06:20 +0000 | [diff] [blame] | 1471 | else if (!strcasecmp(input, "nextword")) |
| 1472 | s->scfunc = do_next_word_void; |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 1473 | else if (!strcasecmp(input, "cutwordleft")) |
| 1474 | s->scfunc = do_cut_prev_word; |
| 1475 | else if (!strcasecmp(input, "cutwordright")) |
| 1476 | s->scfunc = do_cut_next_word; |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 1477 | else if (!strcasecmp(input, "prevblock")) |
| 1478 | s->scfunc = do_prev_block; |
| 1479 | else if (!strcasecmp(input, "nextblock")) |
| 1480 | s->scfunc = do_next_block; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1481 | else if (!strcasecmp(input, "findbracket")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1482 | s->scfunc = do_find_bracket; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1483 | else if (!strcasecmp(input, "wordcount")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1484 | s->scfunc = do_wordlinechar_count; |
Chris Allegretta | 70859f4 | 2008-07-13 01:36:06 +0000 | [diff] [blame] | 1485 | else if (!strcasecmp(input, "undo")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1486 | s->scfunc = do_undo; |
Benno Schulenberg | cf8a296 | 2014-06-20 16:03:38 +0000 | [diff] [blame] | 1487 | else if (!strcasecmp(input, "redo")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1488 | s->scfunc = do_redo; |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1489 | #endif |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1490 | else if (!strcasecmp(input, "left") || |
Benno Schulenberg | 3aea69d | 2014-02-28 20:08:59 +0000 | [diff] [blame] | 1491 | !strcasecmp(input, "back")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1492 | s->scfunc = do_left; |
Benno Schulenberg | 47be8c2 | 2014-04-22 19:07:32 +0000 | [diff] [blame] | 1493 | else if (!strcasecmp(input, "right") || |
| 1494 | !strcasecmp(input, "forward")) |
| 1495 | s->scfunc = do_right; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1496 | else if (!strcasecmp(input, "up") || |
Benno Schulenberg | 3aea69d | 2014-02-28 20:08:59 +0000 | [diff] [blame] | 1497 | !strcasecmp(input, "prevline")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1498 | s->scfunc = do_up_void; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1499 | else if (!strcasecmp(input, "down") || |
Benno Schulenberg | 3aea69d | 2014-02-28 20:08:59 +0000 | [diff] [blame] | 1500 | !strcasecmp(input, "nextline")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1501 | s->scfunc = do_down_void; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1502 | else if (!strcasecmp(input, "home")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1503 | s->scfunc = do_home; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1504 | else if (!strcasecmp(input, "end")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1505 | s->scfunc = do_end; |
Benno Schulenberg | 618051c | 2014-04-26 20:16:17 +0000 | [diff] [blame] | 1506 | else if (!strcasecmp(input, "pageup") || |
| 1507 | !strcasecmp(input, "prevpage")) |
| 1508 | s->scfunc = do_page_up; |
| 1509 | else if (!strcasecmp(input, "pagedown") || |
| 1510 | !strcasecmp(input, "nextpage")) |
| 1511 | s->scfunc = do_page_down; |
| 1512 | else if (!strcasecmp(input, "firstline")) |
| 1513 | s->scfunc = do_first_line; |
| 1514 | else if (!strcasecmp(input, "lastline")) |
| 1515 | s->scfunc = do_last_line; |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 1516 | #ifndef DISABLE_MULTIBUFFER |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1517 | else if (!strcasecmp(input, "prevbuf")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1518 | s->scfunc = switch_to_prev_buffer_void; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1519 | else if (!strcasecmp(input, "nextbuf")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1520 | s->scfunc = switch_to_next_buffer_void; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1521 | #endif |
| 1522 | else if (!strcasecmp(input, "verbatim")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1523 | s->scfunc = do_verbatim_input; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1524 | else if (!strcasecmp(input, "tab")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1525 | s->scfunc = do_tab; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1526 | else if (!strcasecmp(input, "enter")) |
Benno Schulenberg | bde996d | 2015-11-11 19:56:35 +0000 | [diff] [blame] | 1527 | s->scfunc = do_enter; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1528 | else if (!strcasecmp(input, "delete")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1529 | s->scfunc = do_delete; |
Chris Allegretta | fa40694 | 2008-07-13 16:44:19 +0000 | [diff] [blame] | 1530 | else if (!strcasecmp(input, "backspace")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1531 | s->scfunc = do_backspace; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1532 | else if (!strcasecmp(input, "refresh")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1533 | s->scfunc = total_refresh; |
Benno Schulenberg | 5a39339 | 2014-05-27 12:38:32 +0000 | [diff] [blame] | 1534 | else if (!strcasecmp(input, "suspend")) |
| 1535 | s->scfunc = do_suspend_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1536 | else if (!strcasecmp(input, "casesens")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1537 | s->scfunc = case_sens_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1538 | else if (!strcasecmp(input, "regexp") || |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1539 | !strcasecmp(input, "regex")) /* Deprecated. Remove in 2018. */ |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1540 | s->scfunc = regexp_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1541 | else if (!strcasecmp(input, "backwards")) |
Benno Schulenberg | 0846583 | 2014-05-04 12:20:51 +0000 | [diff] [blame] | 1542 | s->scfunc = backwards_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1543 | else if (!strcasecmp(input, "flipreplace") || |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1544 | !strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */ |
Benno Schulenberg | a0f66c0 | 2014-06-23 18:30:35 +0000 | [diff] [blame] | 1545 | s->scfunc = flip_replace_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1546 | else if (!strcasecmp(input, "gototext")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1547 | s->scfunc = gototext_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1548 | #ifndef DISABLE_HISTORIES |
| 1549 | else if (!strcasecmp(input, "prevhistory")) |
| 1550 | s->scfunc = get_history_older_void; |
| 1551 | else if (!strcasecmp(input, "nexthistory")) |
| 1552 | s->scfunc = get_history_newer_void; |
| 1553 | #endif |
| 1554 | else if (!strcasecmp(input, "dosformat")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1555 | s->scfunc = dos_format_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1556 | else if (!strcasecmp(input, "macformat")) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1557 | s->scfunc = mac_format_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1558 | else if (!strcasecmp(input, "append")) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1559 | s->scfunc = append_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1560 | else if (!strcasecmp(input, "prepend")) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1561 | s->scfunc = prepend_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1562 | else if (!strcasecmp(input, "backup")) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1563 | s->scfunc = backup_file_void; |
Benno Schulenberg | 04a38da | 2014-06-04 19:15:16 +0000 | [diff] [blame] | 1564 | #ifndef ENABLE_TINY |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1565 | else if (!strcasecmp(input, "flipexecute")) |
Benno Schulenberg | 04a38da | 2014-06-04 19:15:16 +0000 | [diff] [blame] | 1566 | s->scfunc = flip_execute_void; |
Benno Schulenberg | 04a38da | 2014-06-04 19:15:16 +0000 | [diff] [blame] | 1567 | #endif |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 1568 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1569 | else if (!strcasecmp(input, "flipnewbuffer") || |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1570 | !strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */ |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1571 | s->scfunc = new_buffer_void; |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1572 | #endif |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1573 | #ifndef DISABLE_BROWSER |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1574 | else if (!strcasecmp(input, "tofiles") || |
| 1575 | !strcasecmp(input, "browser")) |
Benno Schulenberg | ef16223 | 2014-06-23 20:03:25 +0000 | [diff] [blame] | 1576 | s->scfunc = to_files_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1577 | else if (!strcasecmp(input, "gotodir")) |
Benno Schulenberg | ef16223 | 2014-06-23 20:03:25 +0000 | [diff] [blame] | 1578 | s->scfunc = goto_dir_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1579 | else if (!strcasecmp(input, "firstfile")) |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 1580 | s->scfunc = do_first_file; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1581 | else if (!strcasecmp(input, "lastfile")) |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1582 | s->scfunc = do_last_file; |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 1583 | #endif |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1584 | else { |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 1585 | #ifndef NANO_TINY |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1586 | s->scfunc = do_toggle_void; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1587 | if (!strcasecmp(input, "nohelp")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1588 | s->toggle = NO_HELP; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1589 | else if (!strcasecmp(input, "constupdate")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1590 | s->toggle = CONST_UPDATE; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1591 | else if (!strcasecmp(input, "morespace")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1592 | s->toggle = MORE_SPACE; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1593 | else if (!strcasecmp(input, "smoothscroll")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1594 | s->toggle = SMOOTH_SCROLL; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1595 | else if (!strcasecmp(input, "softwrap")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1596 | s->toggle = SOFTWRAP; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1597 | else if (!strcasecmp(input, "whitespacedisplay")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1598 | s->toggle = WHITESPACE_DISPLAY; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1599 | #ifndef DISABLE_COLOR |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1600 | else if (!strcasecmp(input, "nosyntax")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1601 | s->toggle = NO_COLOR_SYNTAX; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1602 | #endif |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1603 | else if (!strcasecmp(input, "smarthome")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1604 | s->toggle = SMART_HOME; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1605 | else if (!strcasecmp(input, "autoindent")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1606 | s->toggle = AUTOINDENT; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1607 | else if (!strcasecmp(input, "cuttoend")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1608 | s->toggle = CUT_TO_END; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1609 | #ifndef DISABLE_WRAPPING |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1610 | else if (!strcasecmp(input, "nowrap")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1611 | s->toggle = NO_WRAP; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1612 | #endif |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1613 | else if (!strcasecmp(input, "tabstospaces")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1614 | s->toggle = TABS_TO_SPACES; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1615 | else if (!strcasecmp(input, "backupfile")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1616 | s->toggle = BACKUP_FILE; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1617 | #ifndef DISABLE_MULTIBUFFER |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1618 | else if (!strcasecmp(input, "multibuffer")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1619 | s->toggle = MULTIBUFFER; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1620 | #endif |
| 1621 | #ifndef DISABLE_MOUSE |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1622 | else if (!strcasecmp(input, "mouse")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1623 | s->toggle = USE_MOUSE; |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1624 | #endif |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1625 | else if (!strcasecmp(input, "noconvert")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1626 | s->toggle = NO_CONVERT; |
Benno Schulenberg | d48d84a | 2014-06-28 15:34:10 +0000 | [diff] [blame] | 1627 | else if (!strcasecmp(input, "suspendenable")) |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1628 | s->toggle = SUSPEND; |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 1629 | else |
Benno Schulenberg | 0a1e56e | 2014-06-28 15:00:29 +0000 | [diff] [blame] | 1630 | #endif /* !NANO_TINY */ |
Benno Schulenberg | 57d1755 | 2016-09-03 12:14:08 +0200 | [diff] [blame] | 1631 | { |
Benno Schulenberg | b71cf98 | 2014-06-28 15:22:41 +0000 | [diff] [blame] | 1632 | free(s); |
| 1633 | return NULL; |
| 1634 | } |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1635 | } |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1636 | return s; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1637 | } |
| 1638 | |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1639 | /* Interpret a menu name and return the corresponding menu flag. */ |
Benno Schulenberg | 539a4b4 | 2016-01-04 09:12:21 +0000 | [diff] [blame] | 1640 | int strtomenu(const char *input) |
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 | if (!strcasecmp(input, "all")) |
Benno Schulenberg | 4c9573d | 2014-04-16 09:12:13 +0000 | [diff] [blame] | 1643 | return (MMOST|MHELP|MYESNO); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1644 | else if (!strcasecmp(input, "main")) |
| 1645 | return MMAIN; |
| 1646 | else if (!strcasecmp(input, "search")) |
| 1647 | return MWHEREIS; |
| 1648 | else if (!strcasecmp(input, "replace")) |
| 1649 | return MREPLACE; |
Benno Schulenberg | ed9e5d7 | 2016-09-03 20:12:29 +0200 | [diff] [blame] | 1650 | else if (!strcasecmp(input, "replace2") || /* Deprecated. Remove in 2018. */ |
Benno Schulenberg | f803ef5 | 2014-04-13 12:16:37 +0000 | [diff] [blame] | 1651 | !strcasecmp(input, "replacewith")) |
Benno Schulenberg | e167afe | 2014-04-16 09:26:15 +0000 | [diff] [blame] | 1652 | return MREPLACEWITH; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1653 | else if (!strcasecmp(input, "gotoline")) |
| 1654 | return MGOTOLINE; |
| 1655 | else if (!strcasecmp(input, "writeout")) |
| 1656 | return MWRITEFILE; |
| 1657 | else if (!strcasecmp(input, "insert")) |
| 1658 | return MINSERTFILE; |
| 1659 | else if (!strcasecmp(input, "externalcmd") || |
Benno Schulenberg | f803ef5 | 2014-04-13 12:16:37 +0000 | [diff] [blame] | 1660 | !strcasecmp(input, "extcmd")) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1661 | return MEXTCMD; |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1662 | #ifndef DISABLE_HELP |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1663 | else if (!strcasecmp(input, "help")) |
| 1664 | return MHELP; |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1665 | #endif |
| 1666 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | eae9f28 | 2015-03-25 16:20:45 +0000 | [diff] [blame] | 1667 | else if (!strcasecmp(input, "spell")) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1668 | return MSPELL; |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1669 | #endif |
Benno Schulenberg | 3064db2 | 2014-04-21 12:06:20 +0000 | [diff] [blame] | 1670 | else if (!strcasecmp(input, "linter")) |
| 1671 | return MLINTER; |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1672 | #ifndef DISABLE_BROWSER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1673 | else if (!strcasecmp(input, "browser")) |
| 1674 | return MBROWSER; |
| 1675 | else if (!strcasecmp(input, "whereisfile")) |
| 1676 | return MWHEREISFILE; |
| 1677 | else if (!strcasecmp(input, "gotodir")) |
| 1678 | return MGOTODIR; |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1679 | #endif |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 1680 | return -1; |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1681 | } |
Benno Schulenberg | 353dd21 | 2014-05-25 19:47:46 +0000 | [diff] [blame] | 1682 | #endif /* !DISABLE_NANORC */ |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1683 | |
Chris Allegretta | e347efb | 2008-03-09 02:52:40 +0000 | [diff] [blame] | 1684 | |
David Lawrence Ramsey | e6757b9 | 2006-04-19 13:36:56 +0000 | [diff] [blame] | 1685 | #ifdef DEBUG |
| 1686 | /* This function is used to gracefully return all the memory we've used. |
| 1687 | * It should be called just before calling exit(). Practically, the |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1688 | * only effect is to cause a segmentation fault if the various data |
| 1689 | * structures got bolloxed earlier. Thus, we don't bother having this |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1690 | * function unless debugging is turned on. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1691 | void thanks_for_all_the_fish(void) |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1692 | { |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 1693 | delwin(topwin); |
| 1694 | delwin(edit); |
| 1695 | delwin(bottomwin); |
| 1696 | |
Benno Schulenberg | 6f12992 | 2016-06-30 18:02:45 +0200 | [diff] [blame] | 1697 | free(word_chars); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1698 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1699 | free(quotestr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1700 | #ifdef HAVE_REGEX_H |
| 1701 | regfree("ereg); |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1702 | free(quoteerr); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 1703 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 1704 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 1705 | #ifndef NANO_TINY |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1706 | free(backup_dir); |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 1707 | #endif |
Chris Allegretta | 2598c66 | 2002-03-28 01:59:34 +0000 | [diff] [blame] | 1708 | #ifndef DISABLE_OPERATINGDIR |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1709 | free(operating_dir); |
| 1710 | free(full_operating_dir); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1711 | #endif |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1712 | free(answer); |
Benno Schulenberg | 1cf22d4 | 2015-04-21 18:42:11 +0000 | [diff] [blame] | 1713 | free(last_search); |
Benno Schulenberg | e255627 | 2016-04-30 21:22:16 +0200 | [diff] [blame] | 1714 | free(present_path); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1715 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1716 | free(alt_speller); |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1717 | #endif |
Benno Schulenberg | 814a422 | 2016-02-21 20:54:04 +0000 | [diff] [blame] | 1718 | free_filestruct(cutbuffer); |
David Lawrence Ramsey | 5d8d0b1 | 2005-05-26 05:53:29 +0000 | [diff] [blame] | 1719 | /* Free the memory associated with each open file buffer. */ |
Benno Schulenberg | f4f9954 | 2016-02-22 09:02:58 +0000 | [diff] [blame] | 1720 | while (openfile != openfile->next) { |
| 1721 | openfile = openfile->next; |
| 1722 | delete_opennode(openfile->prev); |
| 1723 | } |
| 1724 | delete_opennode(openfile); |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 1725 | #ifndef DISABLE_COLOR |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1726 | free(syntaxstr); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1727 | while (syntaxes != NULL) { |
Benno Schulenberg | 8a244c6 | 2016-03-04 20:22:27 +0000 | [diff] [blame] | 1728 | syntaxtype *sint = syntaxes; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1729 | syntaxes = syntaxes->next; |
Benno Schulenberg | 8a244c6 | 2016-03-04 20:22:27 +0000 | [diff] [blame] | 1730 | |
| 1731 | free(sint->name); |
| 1732 | free(sint->linter); |
| 1733 | free(sint->formatter); |
| 1734 | |
| 1735 | while (sint->extensions != NULL) { |
| 1736 | regexlisttype *item = sint->extensions; |
| 1737 | sint->extensions = sint->extensions->next; |
| 1738 | free(item->full_regex); |
| 1739 | free(item); |
| 1740 | } |
| 1741 | while (sint->headers != NULL) { |
| 1742 | regexlisttype *item = sint->headers; |
| 1743 | sint->headers = sint->headers->next; |
| 1744 | free(item->full_regex); |
| 1745 | free(item); |
| 1746 | } |
| 1747 | while (sint->magics != NULL) { |
| 1748 | regexlisttype *item = sint->magics; |
| 1749 | sint->magics = sint->magics->next; |
| 1750 | free(item->full_regex); |
| 1751 | free(item); |
| 1752 | } |
| 1753 | |
| 1754 | while (sint->color != NULL) { |
| 1755 | colortype *ink = sint->color; |
| 1756 | sint->color = sint->color->next; |
| 1757 | free(ink->start_regex); |
| 1758 | if (ink->start != NULL) { |
| 1759 | regfree(ink->start); |
| 1760 | free(ink->start); |
| 1761 | } |
| 1762 | free(ink->end_regex); |
| 1763 | if (ink->end != NULL) { |
| 1764 | regfree(ink->end); |
| 1765 | free(ink->end); |
| 1766 | } |
| 1767 | free(ink); |
| 1768 | } |
| 1769 | |
| 1770 | free(sint); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 1771 | } |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 1772 | #endif /* !DISABLE_COLOR */ |
Benno Schulenberg | 3f816ee | 2014-06-19 21:01:39 +0000 | [diff] [blame] | 1773 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | 40e4acf | 2005-05-26 06:09:07 +0000 | [diff] [blame] | 1774 | /* Free the search and replace history lists. */ |
Benno Schulenberg | 814a422 | 2016-02-21 20:54:04 +0000 | [diff] [blame] | 1775 | free_filestruct(searchage); |
| 1776 | free_filestruct(replaceage); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 1777 | #endif |
Benno Schulenberg | 814a422 | 2016-02-21 20:54:04 +0000 | [diff] [blame] | 1778 | /* Free the list of functions. */ |
Benno Schulenberg | 24bc59f | 2014-05-13 18:06:09 +0000 | [diff] [blame] | 1779 | while (allfuncs != NULL) { |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 1780 | subnfunc *f = allfuncs; |
| 1781 | allfuncs = allfuncs->next; |
| 1782 | free(f); |
Benno Schulenberg | 24bc59f | 2014-05-13 18:06:09 +0000 | [diff] [blame] | 1783 | } |
Benno Schulenberg | 814a422 | 2016-02-21 20:54:04 +0000 | [diff] [blame] | 1784 | /* Free the list of shortcuts. */ |
Benno Schulenberg | 24bc59f | 2014-05-13 18:06:09 +0000 | [diff] [blame] | 1785 | while (sclist != NULL) { |
Benno Schulenberg | 0b6d6f4 | 2015-03-27 13:46:50 +0000 | [diff] [blame] | 1786 | sc *s = sclist; |
| 1787 | sclist = sclist->next; |
| 1788 | free(s); |
Benno Schulenberg | 24bc59f | 2014-05-13 18:06:09 +0000 | [diff] [blame] | 1789 | } |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 1790 | #ifndef DISABLE_NANORC |
Benno Schulenberg | c32a58a | 2015-06-14 19:14:41 +0000 | [diff] [blame] | 1791 | free(homedir); |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 1792 | #endif |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 1793 | } |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 1794 | #endif /* DEBUG */ |