Chris Allegretta | 11b0011 | 2000-08-06 21:13:45 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 2 | /************************************************************************** |
| 3 | * nano.h * |
| 4 | * * |
David Lawrence Ramsey | d8a1d37 | 2007-10-11 05:01:32 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 * |
| 6 | * Free Software Foundation, Inc. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 7 | * This program is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published by * |
David Lawrence Ramsey | d0035b4 | 2007-08-11 05:17:36 +0000 | [diff] [blame] | 9 | * the Free Software Foundation; either version 3, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 10 | * any later version. * |
| 11 | * * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 12 | * This program is distributed in the hope that it will be useful, but * |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 15 | * General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
| 18 | * along with this program; if not, write to the Free Software * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * |
| 20 | * 02110-1301, USA. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 21 | * * |
| 22 | **************************************************************************/ |
| 23 | |
David Lawrence Ramsey | 24ae56c | 2004-02-27 03:06:28 +0000 | [diff] [blame] | 24 | #ifndef NANO_H |
| 25 | #define NANO_H 1 |
| 26 | |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 27 | #ifdef HAVE_CONFIG_H |
| 28 | #include <config.h> |
| 29 | #endif |
| 30 | |
David Lawrence Ramsey | a619ae6 | 2004-03-04 06:33:52 +0000 | [diff] [blame] | 31 | #ifdef __TANDEM |
David Lawrence Ramsey | 0a4b737 | 2006-07-18 18:28:10 +0000 | [diff] [blame] | 32 | /* Tandem NonStop Kernel support. */ |
David Lawrence Ramsey | a619ae6 | 2004-03-04 06:33:52 +0000 | [diff] [blame] | 33 | #include <floss.h> |
| 34 | #define NANO_ROOT_UID 65535 |
| 35 | #else |
| 36 | #define NANO_ROOT_UID 0 |
| 37 | #endif |
| 38 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 39 | #ifdef HAVE_LIMITS_H |
| 40 | #include <limits.h> |
| 41 | #endif |
| 42 | |
David Lawrence Ramsey | 96dce26 | 2006-06-06 18:41:58 +0000 | [diff] [blame] | 43 | #ifdef HAVE_SYS_PARAM_H |
| 44 | #include <sys/param.h> |
| 45 | #endif |
| 46 | |
David Lawrence Ramsey | 01e13ea | 2005-06-21 04:16:12 +0000 | [diff] [blame] | 47 | /* Macros for flags. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 48 | #define SET(bit) flags |= bit |
| 49 | #define UNSET(bit) flags &= ~bit |
David Lawrence Ramsey | d91ab6e | 2003-09-07 23:57:24 +0000 | [diff] [blame] | 50 | #define ISSET(bit) ((flags & bit) != 0) |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 51 | #define TOGGLE(bit) flags ^= bit |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 52 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 53 | /* Macros for character allocation and more. */ |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 54 | #define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char)) |
Chris Allegretta | f80a59c | 2003-01-30 00:57:33 +0000 | [diff] [blame] | 55 | #define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char)) |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 56 | #define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char)) |
David Lawrence Ramsey | 3db0dc3 | 2005-06-12 15:24:36 +0000 | [diff] [blame] | 57 | #define charset(dest, src, n) memset(dest, src, (n) * sizeof(char)) |
David Lawrence Ramsey | d08348b | 2004-09-18 22:02:21 +0000 | [diff] [blame] | 58 | |
David Lawrence Ramsey | 092af14 | 2005-06-08 01:35:10 +0000 | [diff] [blame] | 59 | /* Set a default value for PATH_MAX if there isn't one. */ |
David Lawrence Ramsey | 3e0c8a6 | 2004-11-04 04:08:18 +0000 | [diff] [blame] | 60 | #ifndef PATH_MAX |
David Lawrence Ramsey | 6e0ed3c | 2005-03-26 04:42:28 +0000 | [diff] [blame] | 61 | #define PATH_MAX 4096 |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 62 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 63 | |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 64 | #ifdef USE_SLANG |
| 65 | /* Slang support. */ |
| 66 | #include <slcurses.h> |
| 67 | /* Slang curses emulation brain damage, part 3: Slang doesn't define the |
| 68 | * curses equivalents of the Insert or Delete keys. */ |
| 69 | #define KEY_DC SL_KEY_DELETE |
| 70 | #define KEY_IC SL_KEY_IC |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 71 | /* Ncurses support. */ |
David Lawrence Ramsey | f78bc85 | 2007-12-18 15:55:48 +0000 | [diff] [blame] | 72 | #elif defined(HAVE_NCURSES_H) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 73 | #include <ncurses.h> |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 74 | #else |
| 75 | /* Curses support. */ |
David Lawrence Ramsey | c97acfb | 2003-09-10 20:08:00 +0000 | [diff] [blame] | 76 | #include <curses.h> |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 77 | #endif /* CURSES_H */ |
| 78 | |
David Lawrence Ramsey | 2ab03f6 | 2002-10-17 02:19:31 +0000 | [diff] [blame] | 79 | #ifdef ENABLE_NLS |
David Lawrence Ramsey | c1c818e | 2006-05-14 18:22:01 +0000 | [diff] [blame] | 80 | /* Native language support. */ |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 81 | #ifdef HAVE_LIBINTL_H |
| 82 | #include <libintl.h> |
| 83 | #endif |
| 84 | #define _(string) gettext(string) |
| 85 | #define P_(singular, plural, number) ngettext(singular, plural, number) |
David Lawrence Ramsey | 2ab03f6 | 2002-10-17 02:19:31 +0000 | [diff] [blame] | 86 | #else |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 87 | #define _(string) (string) |
| 88 | #define P_(singular, plural, number) (number == 1 ? singular : plural) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 89 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 90 | #define gettext_noop(string) (string) |
| 91 | #define N_(string) gettext_noop(string) |
David Lawrence Ramsey | afbcf68 | 2005-03-21 06:33:41 +0000 | [diff] [blame] | 92 | /* Mark a string that will be sent to gettext() later. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 93 | |
David Lawrence Ramsey | fc69321 | 2004-12-23 17:43:27 +0000 | [diff] [blame] | 94 | #include <stddef.h> |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 95 | #include <stdlib.h> |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 96 | #include <sys/types.h> |
| 97 | #include <sys/stat.h> |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 98 | #include <dirent.h> |
| 99 | #ifdef HAVE_REGEX_H |
| 100 | #include <regex.h> |
| 101 | #endif |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 102 | #ifndef NANO_TINY |
| 103 | #include <setjmp.h> |
| 104 | #endif |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 105 | #include <assert.h> |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 106 | |
David Lawrence Ramsey | da50e73 | 2005-07-04 04:22:30 +0000 | [diff] [blame] | 107 | /* If no vsnprintf(), use the version from glib 2.x. */ |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 108 | #ifndef HAVE_VSNPRINTF |
David Lawrence Ramsey | da50e73 | 2005-07-04 04:22:30 +0000 | [diff] [blame] | 109 | #include <glib.h> |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 110 | #define vsnprintf g_vsnprintf |
| 111 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 112 | |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 113 | /* If no isblank(), iswblank(), strcasecmp(), strncasecmp(), |
| 114 | * strcasestr(), strnlen(), getdelim(), or getline(), use the versions |
| 115 | * we have. */ |
| 116 | #ifndef HAVE_ISBLANK |
| 117 | #define isblank nisblank |
| 118 | #endif |
| 119 | #ifndef HAVE_ISWBLANK |
| 120 | #define iswblank niswblank |
| 121 | #endif |
David Lawrence Ramsey | adc30a8 | 2005-03-20 07:24:49 +0000 | [diff] [blame] | 122 | #ifndef HAVE_STRCASECMP |
| 123 | #define strcasecmp nstrcasecmp |
| 124 | #endif |
| 125 | #ifndef HAVE_STRNCASECMP |
| 126 | #define strncasecmp nstrncasecmp |
| 127 | #endif |
| 128 | #ifndef HAVE_STRCASESTR |
| 129 | #define strcasestr nstrcasestr |
| 130 | #endif |
| 131 | #ifndef HAVE_STRNLEN |
| 132 | #define strnlen nstrnlen |
| 133 | #endif |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 134 | #ifndef HAVE_GETDELIM |
| 135 | #define getdelim ngetdelim |
| 136 | #endif |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 137 | #ifndef HAVE_GETLINE |
| 138 | #define getline ngetline |
| 139 | #endif |
| 140 | |
David Lawrence Ramsey | 6e308c0 | 2006-07-19 02:44:56 +0000 | [diff] [blame] | 141 | /* If we aren't using ncurses with mouse support, turn the mouse support |
| 142 | * off, as it's useless then. */ |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 143 | #ifndef NCURSES_MOUSE_VERSION |
| 144 | #define DISABLE_MOUSE 1 |
| 145 | #endif |
David Lawrence Ramsey | 935594b | 2006-07-18 18:16:30 +0000 | [diff] [blame] | 146 | |
David Lawrence Ramsey | 32a3ce4 | 2006-07-18 18:25:56 +0000 | [diff] [blame] | 147 | #if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY) |
| 148 | #define DISABLE_WRAPJUSTIFY 1 |
David Lawrence Ramsey | 935594b | 2006-07-18 18:16:30 +0000 | [diff] [blame] | 149 | #endif |
Chris Allegretta | 6fe6149 | 2001-05-21 12:56:25 +0000 | [diff] [blame] | 150 | |
David Lawrence Ramsey | 3e0c8a6 | 2004-11-04 04:08:18 +0000 | [diff] [blame] | 151 | /* Enumeration types. */ |
| 152 | typedef enum { |
| 153 | NIX_FILE, DOS_FILE, MAC_FILE |
| 154 | } file_format; |
| 155 | |
| 156 | typedef enum { |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 157 | OVERWRITE, APPEND, PREPEND |
| 158 | } append_type; |
| 159 | |
| 160 | typedef enum { |
David Lawrence Ramsey | 6ff22e7 | 2006-07-19 00:14:52 +0000 | [diff] [blame] | 161 | UP_DIR, DOWN_DIR |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 162 | } scroll_dir; |
David Lawrence Ramsey | 3e0c8a6 | 2004-11-04 04:08:18 +0000 | [diff] [blame] | 163 | |
| 164 | typedef enum { |
David Lawrence Ramsey | 5b44f37 | 2005-07-16 22:47:12 +0000 | [diff] [blame] | 165 | CENTER, NONE |
David Lawrence Ramsey | bf0e47d | 2005-08-01 18:27:10 +0000 | [diff] [blame] | 166 | } update_type; |
David Lawrence Ramsey | 3e0c8a6 | 2004-11-04 04:08:18 +0000 | [diff] [blame] | 167 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 168 | typedef enum { |
| 169 | CONTROL, META, FKEY, RAW |
| 170 | } function_type; |
| 171 | |
David Lawrence Ramsey | 8213850 | 2003-12-24 08:03:54 +0000 | [diff] [blame] | 172 | /* Structure types. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 173 | typedef struct filestruct { |
| 174 | char *data; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 175 | /* The text of this line. */ |
| 176 | ssize_t lineno; |
| 177 | /* The number of this line. */ |
| 178 | struct filestruct *next; |
| 179 | /* Next node. */ |
| 180 | struct filestruct *prev; |
| 181 | /* Previous node. */ |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 182 | } filestruct; |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 183 | |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 184 | typedef struct partition { |
| 185 | filestruct *fileage; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 186 | /* The top line of this portion of the file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 187 | filestruct *top_prev; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 188 | /* The line before the top line of this portion of the file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 189 | char *top_data; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 190 | /* The text before the beginning of the top line of this portion |
| 191 | * of the file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 192 | filestruct *filebot; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 193 | /* The bottom line of this portion of the file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 194 | filestruct *bot_next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 195 | /* The line after the bottom line of this portion of the |
| 196 | * file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 197 | char *bot_data; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 198 | /* The text after the end of the bottom line of this portion of |
| 199 | * the file. */ |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 200 | } partition; |
| 201 | |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 202 | #ifdef ENABLE_COLOR |
| 203 | typedef struct colortype { |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 204 | short fg; |
| 205 | /* This syntax's foreground color. */ |
| 206 | short bg; |
| 207 | /* This syntax's background color. */ |
| 208 | bool bright; |
| 209 | /* Is this color A_BOLD? */ |
| 210 | bool icase; |
| 211 | /* Is this regex string case insensitive? */ |
| 212 | int pairnum; |
| 213 | /* The color pair number used for this foreground color and |
| 214 | * background color. */ |
| 215 | char *start_regex; |
| 216 | /* The start (or all) of the regex string. */ |
| 217 | regex_t *start; |
| 218 | /* The compiled start (or all) of the regex string. */ |
| 219 | char *end_regex; |
| 220 | /* The end (if any) of the regex string. */ |
| 221 | regex_t *end; |
| 222 | /* The compiled end (if any) of the regex string. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 223 | struct colortype *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 224 | /* Next set of colors. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 225 | } colortype; |
| 226 | |
| 227 | typedef struct exttype { |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 228 | char *ext_regex; |
| 229 | /* The extensions that match this syntax. */ |
| 230 | regex_t *ext; |
| 231 | /* The compiled extensions that match this syntax. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 232 | struct exttype *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 233 | /* Next set of extensions. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 234 | } exttype; |
| 235 | |
| 236 | typedef struct syntaxtype { |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 237 | char *desc; |
| 238 | /* The name of this syntax. */ |
| 239 | exttype *extensions; |
| 240 | /* The list of extensions that this syntax applies to. */ |
| 241 | colortype *color; |
| 242 | /* The colors used in this syntax. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 243 | struct syntaxtype *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 244 | /* Next syntax. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 245 | } syntaxtype; |
| 246 | #endif /* ENABLE_COLOR */ |
| 247 | |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 248 | typedef struct openfilestruct { |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 249 | char *filename; |
| 250 | /* The current file's name. */ |
| 251 | filestruct *fileage; |
| 252 | /* The current file's first line. */ |
| 253 | filestruct *filebot; |
| 254 | /* The current file's last line. */ |
| 255 | filestruct *edittop; |
| 256 | /* The current top of the edit window. */ |
| 257 | filestruct *current; |
| 258 | /* The current file's current line. */ |
| 259 | size_t totsize; |
| 260 | /* The current file's total number of characters. */ |
| 261 | size_t current_x; |
| 262 | /* The current file's x-coordinate position. */ |
| 263 | size_t placewewant; |
| 264 | /* The current file's place we want. */ |
| 265 | ssize_t current_y; |
| 266 | /* The current file's y-coordinate position. */ |
| 267 | bool modified; |
| 268 | /* Whether the current file has been modified. */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 269 | #ifndef NANO_TINY |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 270 | bool mark_set; |
| 271 | /* Whether the mark is on in the current file. */ |
| 272 | filestruct *mark_begin; |
| 273 | /* The current file's beginning marked line, if any. */ |
| 274 | size_t mark_begin_x; |
| 275 | /* The current file's beginning marked line's x-coordinate |
| 276 | * position, if any. */ |
| 277 | file_format fmt; |
| 278 | /* The current file's format. */ |
| 279 | struct stat *current_stat; |
| 280 | /* The current file's stat. */ |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 281 | #endif |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 282 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 283 | colortype *colorstrings; |
| 284 | /* The current file's associated colors. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 285 | #endif |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 286 | struct openfilestruct *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 287 | /* Next node. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 288 | struct openfilestruct *prev; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 289 | /* Previous node. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 290 | } openfilestruct; |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 291 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 292 | typedef struct shortcut { |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 293 | const char *desc; |
| 294 | /* The function's description, e.g. "Page Up". */ |
| 295 | #ifndef DISABLE_HELP |
| 296 | const char *help; |
| 297 | /* The help file entry text for this function. */ |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 298 | bool blank_after; |
| 299 | /* Whether there should be a blank line after the help entry |
| 300 | * text for this function. */ |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 301 | #endif |
| 302 | /* Note: Key values that aren't used should be set to |
| 303 | * NANO_NO_KEY. */ |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 304 | int ctrlval; |
| 305 | /* The special sentinel key or control key we want bound, if |
| 306 | * any. */ |
| 307 | int metaval; |
| 308 | /* The meta key we want bound, if any. */ |
| 309 | int funcval; |
| 310 | /* The function key we want bound, if any. */ |
| 311 | int miscval; |
| 312 | /* The other meta key we want bound, if any. */ |
| 313 | bool viewok; |
| 314 | /* Is this function allowed when in view mode? */ |
| 315 | void (*func)(void); |
| 316 | /* The function to call when we get this key. */ |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 317 | struct shortcut *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 318 | /* Next shortcut. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 319 | } shortcut; |
| 320 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 321 | #ifndef NANO_TINY |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 322 | typedef struct toggle { |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 323 | int val; |
| 324 | /* The sequence to toggle the key. We should only need one. */ |
| 325 | const char *desc; |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 326 | /* The description of the toggle, e.g. "Cut to end"; we'll |
| 327 | * append Enabled or Disabled to it. */ |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 328 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 329 | bool blank_after; |
| 330 | /* Whether there should be a blank line after the description of |
| 331 | * the toggle. */ |
David Lawrence Ramsey | bd28ee4 | 2006-07-25 21:13:30 +0000 | [diff] [blame] | 332 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 333 | long flag; |
| 334 | /* Which flag actually gets toggled. */ |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 335 | struct toggle *next; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 336 | /* Next toggle. */ |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 337 | } toggle; |
David Lawrence Ramsey | 6d9aa08 | 2004-11-03 14:58:04 +0000 | [diff] [blame] | 338 | #endif |
Chris Allegretta | 756f220 | 2000-09-01 13:32:47 +0000 | [diff] [blame] | 339 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 340 | #ifdef ENABLE_NANORC |
| 341 | typedef struct rcoption { |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 342 | const char *name; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 343 | /* The name of the rcfile option. */ |
David Lawrence Ramsey | ec721c8 | 2004-07-07 15:20:52 +0000 | [diff] [blame] | 344 | long flag; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 345 | /* The flag associated with it, if any. */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 346 | } rcoption; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 347 | |
David Lawrence Ramsey | 6d9aa08 | 2004-11-03 14:58:04 +0000 | [diff] [blame] | 348 | #endif |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 349 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 350 | typedef struct sc { |
| 351 | char *keystr; |
| 352 | /* The shortcut key for a function, ASCII version */ |
| 353 | function_type type; |
| 354 | /* What kind of function key is it for convenience later */ |
| 355 | int seq; |
| 356 | /* The actual sequence to check on the the type is determined */ |
| 357 | int menu; |
| 358 | /* What list does this apply to */ |
| 359 | void (*scfunc)(void); |
| 360 | /* The function we're going to run */ |
| 361 | int toggle; |
| 362 | /* If a toggle, what we're toggling */ |
| 363 | bool execute; |
| 364 | /* Whether to execute the function in question or just return |
| 365 | so the sequence can be caught by the calling code */ |
| 366 | struct sc *next; |
| 367 | /* Next in the list */ |
| 368 | } sc; |
| 369 | |
| 370 | typedef struct subnfunc { |
| 371 | void (*scfunc)(void); |
| 372 | /* What function is this */ |
| 373 | int menus; |
| 374 | /* In what menus does this function applu */ |
| 375 | const char *desc; |
| 376 | /* The function's description, e.g. "Page Up". */ |
| 377 | #ifndef DISABLE_HELP |
| 378 | const char *help; |
| 379 | /* The help file entry text for this function. */ |
| 380 | bool blank_after; |
| 381 | /* Whether there should be a blank line after the help entry |
| 382 | * text for this function. */ |
| 383 | #endif |
| 384 | bool viewok; |
| 385 | /* Is this function allowed when in view mode? */ |
| 386 | long toggle; |
| 387 | /* If this is a toggle, if nonzero what toggle to set */ |
| 388 | struct subnfunc *next; |
| 389 | /* next item in the list */ |
| 390 | } subnfunc; |
| 391 | |
| 392 | |
David Lawrence Ramsey | 0f476b9 | 2005-05-22 04:16:36 +0000 | [diff] [blame] | 393 | /* Bitwise flags so that we can save space (or, more correctly, not |
| 394 | * waste it). */ |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 395 | #define CASE_SENSITIVE (1<<0) |
| 396 | #define CONST_UPDATE (1<<1) |
| 397 | #define NO_HELP (1<<2) |
| 398 | #define NOFOLLOW_SYMLINKS (1<<3) |
| 399 | #define SUSPEND (1<<4) |
| 400 | #define NO_WRAP (1<<5) |
| 401 | #define AUTOINDENT (1<<6) |
| 402 | #define VIEW_MODE (1<<7) |
| 403 | #define USE_MOUSE (1<<8) |
| 404 | #define USE_REGEXP (1<<9) |
| 405 | #define TEMP_FILE (1<<10) |
| 406 | #define CUT_TO_END (1<<11) |
| 407 | #define BACKWARDS_SEARCH (1<<12) |
| 408 | #define MULTIBUFFER (1<<13) |
| 409 | #define SMOOTH_SCROLL (1<<14) |
| 410 | #define REBIND_DELETE (1<<15) |
| 411 | #define REBIND_KEYPAD (1<<16) |
| 412 | #define NO_CONVERT (1<<17) |
| 413 | #define BACKUP_FILE (1<<18) |
| 414 | #define NO_COLOR_SYNTAX (1<<19) |
| 415 | #define PRESERVE (1<<20) |
| 416 | #define HISTORYLOG (1<<21) |
| 417 | #define RESTRICTED (1<<22) |
| 418 | #define SMART_HOME (1<<23) |
| 419 | #define WHITESPACE_DISPLAY (1<<24) |
| 420 | #define MORE_SPACE (1<<25) |
| 421 | #define TABS_TO_SPACES (1<<26) |
| 422 | #define QUICK_BLANK (1<<27) |
| 423 | #define WORD_BOUNDS (1<<28) |
| 424 | #define NO_NEWLINES (1<<29) |
| 425 | #define BOLD_TEXT (1<<30) |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 426 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 427 | /* Flags for which menus in which a given function should be present */ |
| 428 | #define MMAIN (1<<0) |
| 429 | #define MWHEREIS (1<<1) |
| 430 | #define MREPLACE (1<<2) |
| 431 | #define MREPLACE2 (1<<3) |
| 432 | #define MGOTOLINE (1<<4) |
| 433 | #define MWRITEFILE (1<<5) |
| 434 | #define MINSERTFILE (1<<6) |
| 435 | #define MEXTCMD (1<<7) |
| 436 | #define MHELP (1<<8) |
| 437 | #define MSPELL (1<<9) |
| 438 | #define MBROWSER (1<<10) |
| 439 | #define MWHEREISFILE (1<<11) |
| 440 | #define MGOTODIR (1<<12) |
Chris Allegretta | cc59383 | 2008-03-19 02:32:48 +0000 | [diff] [blame] | 441 | #define MYESNO (1<<13) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 442 | /* This really isnt all but close enough */ |
| 443 | #define MALL (MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR|MHELP) |
| 444 | |
David Lawrence Ramsey | 0f476b9 | 2005-05-22 04:16:36 +0000 | [diff] [blame] | 445 | /* Control key sequences. Changing these would be very, very bad. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 446 | #define NANO_CONTROL_SPACE 0 |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 447 | #define NANO_CONTROL_A 1 |
| 448 | #define NANO_CONTROL_B 2 |
| 449 | #define NANO_CONTROL_C 3 |
| 450 | #define NANO_CONTROL_D 4 |
| 451 | #define NANO_CONTROL_E 5 |
| 452 | #define NANO_CONTROL_F 6 |
| 453 | #define NANO_CONTROL_G 7 |
| 454 | #define NANO_CONTROL_H 8 |
| 455 | #define NANO_CONTROL_I 9 |
| 456 | #define NANO_CONTROL_J 10 |
| 457 | #define NANO_CONTROL_K 11 |
| 458 | #define NANO_CONTROL_L 12 |
| 459 | #define NANO_CONTROL_M 13 |
| 460 | #define NANO_CONTROL_N 14 |
| 461 | #define NANO_CONTROL_O 15 |
| 462 | #define NANO_CONTROL_P 16 |
| 463 | #define NANO_CONTROL_Q 17 |
| 464 | #define NANO_CONTROL_R 18 |
| 465 | #define NANO_CONTROL_S 19 |
| 466 | #define NANO_CONTROL_T 20 |
| 467 | #define NANO_CONTROL_U 21 |
| 468 | #define NANO_CONTROL_V 22 |
| 469 | #define NANO_CONTROL_W 23 |
| 470 | #define NANO_CONTROL_X 24 |
| 471 | #define NANO_CONTROL_Y 25 |
| 472 | #define NANO_CONTROL_Z 26 |
David Lawrence Ramsey | 4d7c260 | 2003-08-17 02:48:43 +0000 | [diff] [blame] | 473 | #define NANO_CONTROL_3 27 |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 474 | #define NANO_CONTROL_4 28 |
| 475 | #define NANO_CONTROL_5 29 |
| 476 | #define NANO_CONTROL_6 30 |
| 477 | #define NANO_CONTROL_7 31 |
David Lawrence Ramsey | 4d7c260 | 2003-08-17 02:48:43 +0000 | [diff] [blame] | 478 | #define NANO_CONTROL_8 127 |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 479 | |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 480 | /* Meta key sequences. */ |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 481 | #define NANO_META_SPACE ' ' |
| 482 | #define NANO_META_LPARENTHESIS '(' |
| 483 | #define NANO_META_RPARENTHESIS ')' |
| 484 | #define NANO_META_PLUS '+' |
| 485 | #define NANO_META_COMMA ',' |
| 486 | #define NANO_META_MINUS '-' |
| 487 | #define NANO_META_PERIOD '.' |
| 488 | #define NANO_META_SLASH '/' |
| 489 | #define NANO_META_0 '0' |
| 490 | #define NANO_META_6 '6' |
| 491 | #define NANO_META_9 '9' |
| 492 | #define NANO_META_LCARET '<' |
| 493 | #define NANO_META_EQUALS '=' |
| 494 | #define NANO_META_RCARET '>' |
| 495 | #define NANO_META_QUESTION '?' |
| 496 | #define NANO_META_BACKSLASH '\\' |
| 497 | #define NANO_META_RBRACKET ']' |
| 498 | #define NANO_META_CARET '^' |
| 499 | #define NANO_META_UNDERSCORE '_' |
| 500 | #define NANO_META_A 'a' |
| 501 | #define NANO_META_B 'b' |
| 502 | #define NANO_META_C 'c' |
| 503 | #define NANO_META_D 'd' |
| 504 | #define NANO_META_E 'e' |
| 505 | #define NANO_META_F 'f' |
| 506 | #define NANO_META_G 'g' |
| 507 | #define NANO_META_H 'h' |
| 508 | #define NANO_META_I 'i' |
| 509 | #define NANO_META_J 'j' |
| 510 | #define NANO_META_K 'k' |
| 511 | #define NANO_META_L 'l' |
| 512 | #define NANO_META_M 'm' |
| 513 | #define NANO_META_N 'n' |
| 514 | #define NANO_META_O 'o' |
| 515 | #define NANO_META_P 'p' |
| 516 | #define NANO_META_Q 'q' |
| 517 | #define NANO_META_R 'r' |
| 518 | #define NANO_META_S 's' |
| 519 | #define NANO_META_T 't' |
| 520 | #define NANO_META_U 'u' |
| 521 | #define NANO_META_V 'v' |
| 522 | #define NANO_META_W 'w' |
| 523 | #define NANO_META_X 'x' |
| 524 | #define NANO_META_Y 'y' |
| 525 | #define NANO_META_Z 'z' |
| 526 | #define NANO_META_LCURLYBRACKET '{' |
| 527 | #define NANO_META_PIPE '|' |
| 528 | #define NANO_META_RCURLYBRACKET '}' |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 529 | |
David Lawrence Ramsey | 8213850 | 2003-12-24 08:03:54 +0000 | [diff] [blame] | 530 | /* Some semi-changeable keybindings; don't play with these unless you're |
David Lawrence Ramsey | 0a25808 | 2004-04-23 18:02:37 +0000 | [diff] [blame] | 531 | * sure you know what you're doing. Assume ERR is defined as -1. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 532 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 533 | /* No key at all. */ |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 534 | #define NANO_NO_KEY -2 |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 535 | |
David Lawrence Ramsey | f427694 | 2003-12-24 03:33:09 +0000 | [diff] [blame] | 536 | /* Normal keys. */ |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 537 | #define NANO_XON_KEY NANO_CONTROL_Q |
| 538 | #define NANO_XOFF_KEY NANO_CONTROL_S |
| 539 | #define NANO_CANCEL_KEY NANO_CONTROL_C |
| 540 | #define NANO_EXIT_KEY NANO_CONTROL_X |
| 541 | #define NANO_EXIT_FKEY KEY_F(2) |
| 542 | #define NANO_INSERTFILE_KEY NANO_CONTROL_R |
| 543 | #define NANO_INSERTFILE_FKEY KEY_F(5) |
| 544 | #define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X |
| 545 | #define NANO_WRITEOUT_KEY NANO_CONTROL_O |
| 546 | #define NANO_WRITEOUT_FKEY KEY_F(3) |
| 547 | #define NANO_GOTOLINE_KEY NANO_CONTROL_7 |
| 548 | #define NANO_GOTOLINE_FKEY KEY_F(13) |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 549 | #define NANO_GOTOLINE_METAKEY NANO_META_G |
David Lawrence Ramsey | 0ec909c | 2006-05-06 15:07:26 +0000 | [diff] [blame] | 550 | #define NANO_GOTODIR_KEY NANO_CONTROL_7 |
| 551 | #define NANO_GOTODIR_FKEY KEY_F(13) |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 552 | #define NANO_GOTODIR_METAKEY NANO_META_G |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 553 | #define NANO_TOGOTOLINE_KEY NANO_CONTROL_T |
| 554 | #define NANO_HELP_KEY NANO_CONTROL_G |
| 555 | #define NANO_HELP_FKEY KEY_F(1) |
| 556 | #define NANO_WHEREIS_KEY NANO_CONTROL_W |
| 557 | #define NANO_WHEREIS_FKEY KEY_F(6) |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 558 | #define NANO_WHEREIS_NEXT_KEY NANO_META_W |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 559 | #define NANO_WHEREIS_NEXT_FKEY KEY_F(16) |
| 560 | #define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 561 | #define NANO_REGEXP_KEY NANO_META_R |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 562 | #define NANO_REPLACE_KEY NANO_CONTROL_4 |
| 563 | #define NANO_REPLACE_FKEY KEY_F(14) |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 564 | #define NANO_REPLACE_METAKEY NANO_META_R |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 565 | #define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R |
| 566 | #define NANO_PREVPAGE_KEY NANO_CONTROL_Y |
| 567 | #define NANO_PREVPAGE_FKEY KEY_F(7) |
| 568 | #define NANO_NEXTPAGE_KEY NANO_CONTROL_V |
| 569 | #define NANO_NEXTPAGE_FKEY KEY_F(8) |
| 570 | #define NANO_CUT_KEY NANO_CONTROL_K |
| 571 | #define NANO_CUT_FKEY KEY_F(9) |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 572 | #define NANO_COPY_KEY NANO_META_CARET |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 573 | #define NANO_COPY_METAKEY NANO_META_6 |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 574 | #define NANO_UNCUT_KEY NANO_CONTROL_U |
| 575 | #define NANO_UNCUT_FKEY KEY_F(10) |
| 576 | #define NANO_CURSORPOS_KEY NANO_CONTROL_C |
| 577 | #define NANO_CURSORPOS_FKEY KEY_F(11) |
| 578 | #define NANO_SPELL_KEY NANO_CONTROL_T |
| 579 | #define NANO_SPELL_FKEY KEY_F(12) |
| 580 | #define NANO_FIRSTLINE_KEY NANO_PREVPAGE_KEY |
| 581 | #define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 582 | #define NANO_FIRSTLINE_METAKEY NANO_META_BACKSLASH |
| 583 | #define NANO_FIRSTLINE_METAKEY2 NANO_META_PIPE |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 584 | #define NANO_FIRSTFILE_KEY NANO_FIRSTLINE_KEY |
| 585 | #define NANO_FIRSTFILE_FKEY NANO_FIRSTLINE_FKEY |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 586 | #define NANO_FIRSTFILE_METAKEY NANO_FIRSTLINE_METAKEY |
| 587 | #define NANO_FIRSTFILE_METAKEY2 NANO_FIRSTLINE_METAKEY2 |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 588 | #define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY |
| 589 | #define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 590 | #define NANO_LASTLINE_METAKEY NANO_META_SLASH |
| 591 | #define NANO_LASTLINE_METAKEY2 NANO_META_QUESTION |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 592 | #define NANO_LASTFILE_KEY NANO_LASTLINE_KEY |
| 593 | #define NANO_LASTFILE_FKEY NANO_LASTLINE_FKEY |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 594 | #define NANO_LASTFILE_METAKEY NANO_LASTLINE_METAKEY |
| 595 | #define NANO_LASTFILE_METAKEY2 NANO_LASTLINE_METAKEY2 |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 596 | #define NANO_REFRESH_KEY NANO_CONTROL_L |
| 597 | #define NANO_JUSTIFY_KEY NANO_CONTROL_J |
| 598 | #define NANO_JUSTIFY_FKEY KEY_F(4) |
| 599 | #define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY |
| 600 | #define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY |
| 601 | #define NANO_PREVLINE_KEY NANO_CONTROL_P |
| 602 | #define NANO_NEXTLINE_KEY NANO_CONTROL_N |
| 603 | #define NANO_FORWARD_KEY NANO_CONTROL_F |
| 604 | #define NANO_BACK_KEY NANO_CONTROL_B |
| 605 | #define NANO_MARK_KEY NANO_CONTROL_6 |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 606 | #define NANO_MARK_METAKEY NANO_META_A |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 607 | #define NANO_MARK_FKEY KEY_F(15) |
| 608 | #define NANO_HOME_KEY NANO_CONTROL_A |
| 609 | #define NANO_END_KEY NANO_CONTROL_E |
| 610 | #define NANO_DELETE_KEY NANO_CONTROL_D |
| 611 | #define NANO_BACKSPACE_KEY NANO_CONTROL_H |
| 612 | #define NANO_TAB_KEY NANO_CONTROL_I |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 613 | #define NANO_INDENT_KEY NANO_META_RCURLYBRACKET |
| 614 | #define NANO_UNINDENT_KEY NANO_META_LCURLYBRACKET |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 615 | #define NANO_SUSPEND_KEY NANO_CONTROL_Z |
| 616 | #define NANO_ENTER_KEY NANO_CONTROL_M |
| 617 | #define NANO_TOFILES_KEY NANO_CONTROL_T |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 618 | #define NANO_APPEND_KEY NANO_META_A |
| 619 | #define NANO_PREPEND_KEY NANO_META_P |
| 620 | #define NANO_PREVFILE_KEY NANO_META_LCARET |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 621 | #define NANO_PREVFILE_METAKEY NANO_META_COMMA |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 622 | #define NANO_NEXTFILE_KEY NANO_META_RCARET |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 623 | #define NANO_NEXTFILE_METAKEY NANO_META_PERIOD |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 624 | #define NANO_BRACKET_KEY NANO_META_RBRACKET |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 625 | #define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 626 | #define NANO_PREVWORD_KEY NANO_META_SPACE |
| 627 | #define NANO_WORDCOUNT_KEY NANO_META_D |
| 628 | #define NANO_SCROLLUP_KEY NANO_META_MINUS |
| 629 | #define NANO_SCROLLDOWN_KEY NANO_META_PLUS |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 630 | #define NANO_SCROLLUP_METAKEY NANO_META_UNDERSCORE |
| 631 | #define NANO_SCROLLDOWN_METAKEY NANO_META_EQUALS |
| 632 | #define NANO_CUTTILLEND_METAKEY NANO_META_T |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 633 | #define NANO_PARABEGIN_KEY NANO_CONTROL_W |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 634 | #define NANO_PARABEGIN_METAKEY NANO_META_LPARENTHESIS |
| 635 | #define NANO_PARABEGIN_METAKEY2 NANO_META_9 |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 636 | #define NANO_PARAEND_KEY NANO_CONTROL_O |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 637 | #define NANO_PARAEND_METAKEY NANO_META_RPARENTHESIS |
| 638 | #define NANO_PARAEND_METAKEY2 NANO_META_0 |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 639 | #define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U |
David Lawrence Ramsey | 5a8182e | 2006-11-21 04:20:53 +0000 | [diff] [blame] | 640 | #define NANO_FULLJUSTIFY_METAKEY NANO_META_J |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 641 | #define NANO_VERBATIM_KEY NANO_META_V |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 642 | |
David Lawrence Ramsey | e313f5b | 2006-04-20 22:29:02 +0000 | [diff] [blame] | 643 | /* Toggles do not exist if NANO_TINY is defined. */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 644 | #ifndef NANO_TINY |
David Lawrence Ramsey | e313f5b | 2006-04-20 22:29:02 +0000 | [diff] [blame] | 645 | |
| 646 | /* No toggle at all. */ |
David Lawrence Ramsey | 58fabec | 2006-04-26 17:39:41 +0000 | [diff] [blame] | 647 | #define TOGGLE_NO_KEY -2 |
David Lawrence Ramsey | e313f5b | 2006-04-20 22:29:02 +0000 | [diff] [blame] | 648 | |
| 649 | /* Normal toggles. */ |
David Lawrence Ramsey | 292f7ef | 2006-11-21 04:15:04 +0000 | [diff] [blame] | 650 | #define TOGGLE_NOHELP_KEY NANO_META_X |
| 651 | #define TOGGLE_CONST_KEY NANO_META_C |
| 652 | #define TOGGLE_MORESPACE_KEY NANO_META_O |
| 653 | #define TOGGLE_SMOOTH_KEY NANO_META_S |
| 654 | #define TOGGLE_WHITESPACE_KEY NANO_META_P |
| 655 | #define TOGGLE_SYNTAX_KEY NANO_META_Y |
| 656 | #define TOGGLE_SMARTHOME_KEY NANO_META_H |
| 657 | #define TOGGLE_AUTOINDENT_KEY NANO_META_I |
| 658 | #define TOGGLE_CUTTOEND_KEY NANO_META_K |
| 659 | #define TOGGLE_WRAP_KEY NANO_META_L |
| 660 | #define TOGGLE_TABSTOSPACES_KEY NANO_META_Q |
| 661 | #define TOGGLE_BACKUP_KEY NANO_META_B |
| 662 | #define TOGGLE_MULTIBUFFER_KEY NANO_META_F |
| 663 | #define TOGGLE_MOUSE_KEY NANO_META_M |
| 664 | #define TOGGLE_NOCONVERT_KEY NANO_META_N |
| 665 | #define TOGGLE_SUSPEND_KEY NANO_META_Z |
| 666 | #define TOGGLE_CASE_KEY NANO_META_C |
| 667 | #define TOGGLE_BACKWARDS_KEY NANO_META_B |
| 668 | #define TOGGLE_DOS_KEY NANO_META_D |
| 669 | #define TOGGLE_MAC_KEY NANO_META_M |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 670 | #endif /* !NANO_TINY */ |
Chris Allegretta | 658399a | 2001-06-14 02:54:22 +0000 | [diff] [blame] | 671 | |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 672 | #define VIEW TRUE |
| 673 | #define NOVIEW FALSE |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 674 | |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 675 | /* The maximum number of entries displayed in the main shortcut list. */ |
| 676 | #define MAIN_VISIBLE 12 |
| 677 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 678 | /* The minimum editor window columns and rows required for nano to work |
David Lawrence Ramsey | 3d12f0f | 2005-10-26 23:14:59 +0000 | [diff] [blame] | 679 | * correctly. */ |
| 680 | #define MIN_EDITOR_COLS 4 |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 681 | #define MIN_EDITOR_ROWS 1 |
Chris Allegretta | f8f2d58 | 2003-02-10 02:43:48 +0000 | [diff] [blame] | 682 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 683 | /* The default number of characters from the end of the line where |
| 684 | * wrapping occurs. */ |
Chris Allegretta | e61e830 | 2001-01-14 05:18:27 +0000 | [diff] [blame] | 685 | #define CHARS_FROM_EOL 8 |
| 686 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 687 | /* The default width of a tab in spaces. */ |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 688 | #define WIDTH_OF_TAB 8 |
| 689 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 690 | /* The maximum number of search/replace history strings saved, not |
| 691 | * counting the blank lines at their ends. */ |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 692 | #define MAX_SEARCH_HISTORY 100 |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 693 | |
David Lawrence Ramsey | 9149325 | 2006-03-19 19:25:29 +0000 | [diff] [blame] | 694 | /* The maximum number of bytes buffered at one time. */ |
David Lawrence Ramsey | 5b2f17e | 2005-04-19 21:47:01 +0000 | [diff] [blame] | 695 | #define MAX_BUF_SIZE 128 |
| 696 | |
Chris Allegretta | d865da1 | 2002-07-29 23:46:38 +0000 | [diff] [blame] | 697 | #endif /* !NANO_H */ |