nano.h 18.9 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/* $Id$ */
Chris Allegretta's avatar
Chris Allegretta committed
2
3
4
/**************************************************************************
 *   nano.h                                                               *
 *                                                                        *
5
 *   Copyright (C) 1999-2004 Chris Allegretta                             *
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
6
 *   Copyright (C) 2005-2006 David Lawrence Ramsey                        *
Chris Allegretta's avatar
Chris Allegretta committed
7
8
 *   This program is free software; you can redistribute it and/or modify *
 *   it under the terms of the GNU General Public License as published by *
9
 *   the Free Software Foundation; either version 2, or (at your option)  *
Chris Allegretta's avatar
Chris Allegretta committed
10
11
 *   any later version.                                                   *
 *                                                                        *
12
13
14
15
 *   This program is distributed in the hope that it will be useful, but  *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    *
 *   General Public License for more details.                             *
Chris Allegretta's avatar
Chris Allegretta committed
16
17
18
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
19
20
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA            *
 *   02110-1301, USA.                                                     *
Chris Allegretta's avatar
Chris Allegretta committed
21
22
23
 *                                                                        *
 **************************************************************************/

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
24
25
26
#ifndef NANO_H
#define NANO_H 1

27
28
29
30
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

31
#ifdef __TANDEM
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
32
/* Tandem NonStop Kernel support. */
33
34
35
36
37
38
#include <floss.h>
#define NANO_ROOT_UID 65535
#else
#define NANO_ROOT_UID 0
#endif

Chris Allegretta's avatar
Chris Allegretta committed
39
40
41
42
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

43
44
45
46
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
47
/* Macros for flags. */
Chris Allegretta's avatar
Chris Allegretta committed
48
49
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
50
#define ISSET(bit) ((flags & bit) != 0)
51
#define TOGGLE(bit) flags ^= bit
Chris Allegretta's avatar
Chris Allegretta committed
52

53
/* Macros for character allocation, etc. */
Chris Allegretta's avatar
Chris Allegretta committed
54
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
55
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
56
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
57
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
58

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
59
/* Set a default value for PATH_MAX if there isn't one. */
60
#ifndef PATH_MAX
61
#define PATH_MAX 4096
62
#endif
Chris Allegretta's avatar
Chris Allegretta committed
63

64
#ifdef USE_SLANG
65
/* Slang support. */
Chris Allegretta's avatar
Chris Allegretta committed
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
71
/* Ncurses support. */
Chris Allegretta's avatar
Chris Allegretta committed
72
73
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
74
75
#else
/* Curses support. */
76
#include <curses.h>
Chris Allegretta's avatar
Chris Allegretta committed
77
78
#endif /* CURSES_H */

79
#ifdef ENABLE_NLS
80
/* Native language support. */
81
82
83
84
85
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#define _(string) gettext(string)
#define P_(singular, plural, number) ngettext(singular, plural, number)
86
#else
87
88
#define _(string) (string)
#define P_(singular, plural, number) (number == 1 ? singular : plural)
Chris Allegretta's avatar
Chris Allegretta committed
89
#endif
90
91
#define gettext_noop(string) (string)
#define N_(string) gettext_noop(string)
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
92
	/* Mark a string that will be sent to gettext() later. */
Chris Allegretta's avatar
Chris Allegretta committed
93

94
#include <stddef.h>
95
#include <stdlib.h>
96
97
#include <sys/types.h>
#include <sys/stat.h>
98
99
100
101
#include <dirent.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
102
103
104
#ifndef NANO_TINY
#include <setjmp.h>
#endif
105
#include <assert.h>
Chris Allegretta's avatar
Chris Allegretta committed
106

107
/* If no vsnprintf(), use the version from glib 2.x. */
108
#ifndef HAVE_VSNPRINTF
109
#include <glib.h>
110
#define vsnprintf g_vsnprintf
Chris Allegretta's avatar
Chris Allegretta committed
111
#endif
112

113
114
115
116
117
118
119
120
121
/* If no isblank(), iswblank(), strcasecmp(), strncasecmp(),
 * strcasestr(), strnlen(), getdelim(), or getline(), use the versions
 * we have. */
#ifndef HAVE_ISBLANK
#define isblank nisblank
#endif
#ifndef HAVE_ISWBLANK
#define iswblank niswblank
#endif
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef HAVE_STRCASECMP
#define strcasecmp nstrcasecmp
#endif
#ifndef HAVE_STRNCASECMP
#define strncasecmp nstrncasecmp
#endif
#ifndef HAVE_STRCASESTR
#define strcasestr nstrcasestr
#endif
#ifndef HAVE_STRNLEN
#define strnlen nstrnlen
#endif
134
135
136
137
138
139
140
#ifndef HAVE_GETDELIM
#define getdelim ngetdelim
#endif
#ifndef HAVE_GETLINE
#define getline ngetline
#endif

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
141
142
/* If we aren't using ncurses with mouse support, turn the mouse support
 * off, as it's useless then. */
143
144
145
#ifndef NCURSES_MOUSE_VERSION
#define DISABLE_MOUSE 1
#endif
146

147
148
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
149
#endif
150

151
152
153
154
155
/* Enumeration types. */
typedef enum {
    NIX_FILE, DOS_FILE, MAC_FILE
} file_format;

156
157
158
159
typedef enum {
    OVERWRITE, APPEND, PREPEND
} append_type;

160
typedef enum {
161
    UP_DIR, DOWN_DIR
162
} scroll_dir;
163
164

typedef enum {
165
    CENTER, NONE
166
} update_type;
167

168
/* Structure types. */
Chris Allegretta's avatar
Chris Allegretta committed
169
170
typedef struct filestruct {
    char *data;
171
172
173
174
175
176
177
	/* The text of this line. */
    ssize_t lineno;
	/* The number of this line. */
    struct filestruct *next;
	/* Next node. */
    struct filestruct *prev;
	/* Previous node. */
178
} filestruct;
179

180
181
typedef struct partition {
    filestruct *fileage;
182
	/* The top line of this portion of the file. */
183
    filestruct *top_prev;
184
	/* The line before the top line of this portion of the file. */
185
    char *top_data;
186
187
	/* The text before the beginning of the top line of this portion
	 * of the file. */
188
    filestruct *filebot;
189
	/* The bottom line of this portion of the file. */
190
    filestruct *bot_next;
191
192
	/* The line after the bottom line of this portion of the
	 * file. */
193
    char *bot_data;
194
195
	/* The text after the end of the bottom line of this portion of
	 * the file. */
196
197
} partition;

198
199
#ifdef ENABLE_COLOR
typedef struct colortype {
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
    short fg;
	/* This syntax's foreground color. */
    short bg;
	/* This syntax's background color. */
    bool bright;
	/* Is this color A_BOLD? */
    bool icase;
	/* Is this regex string case insensitive? */
    int pairnum;
	/* The color pair number used for this foreground color and
	 * background color. */
    char *start_regex;
	/* The start (or all) of the regex string. */
    regex_t *start;
	/* The compiled start (or all) of the regex string. */
    char *end_regex;
	/* The end (if any) of the regex string. */
    regex_t *end;
	/* The compiled end (if any) of the regex string. */
219
    struct colortype *next;
220
	/* Next set of colors. */
221
222
223
} colortype;

typedef struct exttype {
224
225
226
227
    char *ext_regex;
	/* The extensions that match this syntax. */
    regex_t *ext;
	/* The compiled extensions that match this syntax. */
228
    struct exttype *next;
229
	/* Next set of extensions. */
230
231
232
} exttype;

typedef struct syntaxtype {
233
234
235
236
237
238
    char *desc;
	/* The name of this syntax. */
    exttype *extensions;
	/* The list of extensions that this syntax applies to. */
    colortype *color;
	/* The colors used in this syntax. */
239
    struct syntaxtype *next;
240
	/* Next syntax. */
241
242
243
} syntaxtype;
#endif /* ENABLE_COLOR */

244
typedef struct openfilestruct {
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
    char *filename;
	/* The current file's name. */
    filestruct *fileage;
	/* The current file's first line. */
    filestruct *filebot;
	/* The current file's last line. */
    filestruct *edittop;
	/* The current top of the edit window. */
    filestruct *current;
	/* The current file's current line. */
    size_t totsize;
	/* The current file's total number of characters. */
    size_t current_x;
	/* The current file's x-coordinate position. */
    size_t placewewant;
	/* The current file's place we want. */
    ssize_t current_y;
	/* The current file's y-coordinate position. */
    bool modified;
	/* Whether the current file has been modified. */
265
#ifndef NANO_TINY
266
267
268
269
270
271
272
273
274
275
276
    bool mark_set;
	/* Whether the mark is on in the current file. */
    filestruct *mark_begin;
	/* The current file's beginning marked line, if any. */
    size_t mark_begin_x;
	/* The current file's beginning marked line's x-coordinate
	 * position, if any. */
    file_format fmt;
	/* The current file's format. */
    struct stat *current_stat;
	/* The current file's stat. */
277
278
#endif
#ifdef ENABLE_COLOR
279
280
    colortype *colorstrings;
	/* The current file's associated colors. */
281
#endif
282
    struct openfilestruct *next;
283
	/* Next node. */
284
    struct openfilestruct *prev;
285
	/* Previous node. */
286
} openfilestruct;
287

Chris Allegretta's avatar
Chris Allegretta committed
288
typedef struct shortcut {
289
290
291
292
293
294
295
296
    const char *desc;
	/* The function's description, e.g. "Page Up". */
#ifndef DISABLE_HELP
    const char *help;
	/* The help file entry text for this function. */
    bool blank_after;
	/* Whether there should be a blank line after the help entry
	 * text for this function. */
297
298
299
#endif
    /* Note: Key values that aren't used should be set to
     * NANO_NO_KEY. */
300
301
302
303
304
305
306
307
308
309
310
311
312
    int ctrlval;
	/* The special sentinel key or control key we want bound, if
	 * any. */
    int metaval;
	/* The meta key we want bound, if any. */
    int funcval;
	/* The function key we want bound, if any. */
    int miscval;
	/* The other meta key we want bound, if any. */
    bool viewok;
	/* Is this function allowed when in view mode? */
    void (*func)(void);
	/* The function to call when we get this key. */
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
313
    struct shortcut *next;
314
	/* Next shortcut. */
Chris Allegretta's avatar
Chris Allegretta committed
315
316
} shortcut;

317
#ifndef NANO_TINY
318
typedef struct toggle {
319
320
321
   int val;
	/* The sequence to toggle the key.  We should only need one. */
   const char *desc;
322
323
	/* The description of the toggle, e.g. "Cut to end"; we'll
	 * append Enabled or Disabled to it. */
324
#ifndef DISABLE_HELP
325
326
327
   bool blank_after;
	/* Whether there should be a blank line after the description of
	 * the toggle. */
328
#endif
329
330
   long flag;
	/* Which flag actually gets toggled. */
331
   struct toggle *next;
332
	/* Next toggle. */
333
} toggle;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
334
#endif
335

336
337
#ifdef ENABLE_NANORC
typedef struct rcoption {
338
   const char *name;
339
	/* The name of the rcfile option. */
340
   long flag;
341
	/* The flag associated with it, if any. */
342
} rcoption;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
343
#endif
344

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
345
346
/* Bitwise flags so that we can save space (or, more correctly, not
 * waste it). */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
#define CASE_SENSITIVE			(1<<0)
#define CONST_UPDATE			(1<<1)
#define NO_HELP				(1<<2)
#define NOFOLLOW_SYMLINKS		(1<<3)
#define SUSPEND				(1<<4)
#define NO_WRAP				(1<<5)
#define AUTOINDENT			(1<<6)
#define VIEW_MODE			(1<<7)
#define USE_MOUSE			(1<<8)
#define USE_REGEXP			(1<<9)
#define TEMP_FILE			(1<<10)
#define CUT_TO_END			(1<<11)
#define BACKWARDS_SEARCH		(1<<12)
#define MULTIBUFFER			(1<<13)
#define SMOOTH_SCROLL			(1<<14)
#define REBIND_DELETE			(1<<15)
#define REBIND_KEYPAD			(1<<16)
#define NO_CONVERT			(1<<17)
#define BACKUP_FILE			(1<<18)
#define NO_COLOR_SYNTAX			(1<<19)
#define PRESERVE			(1<<20)
#define HISTORYLOG			(1<<21)
#define RESTRICTED			(1<<22)
#define SMART_HOME			(1<<23)
#define WHITESPACE_DISPLAY		(1<<24)
#define MORE_SPACE			(1<<25)
#define TABS_TO_SPACES			(1<<26)
#define QUICK_BLANK			(1<<27)
#define WORD_BOUNDS			(1<<28)
#define NO_NEWLINES			(1<<29)
#define BOLD_TEXT			(1<<30)
Chris Allegretta's avatar
Chris Allegretta committed
378

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
379
/* Control key sequences.  Changing these would be very, very bad. */
Chris Allegretta's avatar
Chris Allegretta committed
380
#define NANO_CONTROL_SPACE 0
Chris Allegretta's avatar
Chris Allegretta committed
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
#define NANO_CONTROL_A 1
#define NANO_CONTROL_B 2
#define NANO_CONTROL_C 3
#define NANO_CONTROL_D 4
#define NANO_CONTROL_E 5
#define NANO_CONTROL_F 6
#define NANO_CONTROL_G 7
#define NANO_CONTROL_H 8
#define NANO_CONTROL_I 9
#define NANO_CONTROL_J 10
#define NANO_CONTROL_K 11
#define NANO_CONTROL_L 12
#define NANO_CONTROL_M 13
#define NANO_CONTROL_N 14
#define NANO_CONTROL_O 15
#define NANO_CONTROL_P 16
#define NANO_CONTROL_Q 17
#define NANO_CONTROL_R 18
#define NANO_CONTROL_S 19
#define NANO_CONTROL_T 20
#define NANO_CONTROL_U 21
#define NANO_CONTROL_V 22
#define NANO_CONTROL_W 23
#define NANO_CONTROL_X 24
#define NANO_CONTROL_Y 25
#define NANO_CONTROL_Z 26
407
#define NANO_CONTROL_3 27
Chris Allegretta's avatar
Chris Allegretta committed
408
409
410
411
#define NANO_CONTROL_4 28
#define NANO_CONTROL_5 29
#define NANO_CONTROL_6 30
#define NANO_CONTROL_7 31
412
#define NANO_CONTROL_8 127
Chris Allegretta's avatar
Chris Allegretta committed
413

414
/* Meta key sequences. */
415
#define NANO_ALT_SPACE ' '
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
416
417
#define NANO_ALT_LPARENTHESIS '('
#define NANO_ALT_RPARENTHESIS ')'
418
#define NANO_ALT_PLUS '+'
419
#define NANO_ALT_COMMA ','
420
#define NANO_ALT_MINUS '-'
421
#define NANO_ALT_PERIOD '.'
422
#define NANO_ALT_SLASH '/'
423
#define NANO_ALT_0 '0'
424
#define NANO_ALT_6 '6'
425
#define NANO_ALT_9 '9'
426
#define NANO_ALT_LCARET '<'
427
#define NANO_ALT_EQUALS '='
428
#define NANO_ALT_RCARET '>'
429
#define NANO_ALT_QUESTION '?'
430
#define NANO_ALT_BACKSLASH '\\'
431
#define NANO_ALT_RBRACKET ']'
432
#define NANO_ALT_CARET '^'
433
#define NANO_ALT_UNDERSCORE '_'
Chris Allegretta's avatar
Chris Allegretta committed
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
#define NANO_ALT_A 'a'
#define NANO_ALT_B 'b'
#define NANO_ALT_C 'c'
#define NANO_ALT_D 'd'
#define NANO_ALT_E 'e'
#define NANO_ALT_F 'f'
#define NANO_ALT_G 'g'
#define NANO_ALT_H 'h'
#define NANO_ALT_I 'i'
#define NANO_ALT_J 'j'
#define NANO_ALT_K 'k'
#define NANO_ALT_L 'l'
#define NANO_ALT_M 'm'
#define NANO_ALT_N 'n'
#define NANO_ALT_O 'o'
#define NANO_ALT_P 'p'
#define NANO_ALT_Q 'q'
#define NANO_ALT_R 'r'
#define NANO_ALT_S 's'
#define NANO_ALT_T 't'
#define NANO_ALT_U 'u'
#define NANO_ALT_V 'v'
#define NANO_ALT_W 'w'
#define NANO_ALT_X 'x'
#define NANO_ALT_Y 'y'
#define NANO_ALT_Z 'z'
460
#define NANO_ALT_LCURLYBRACKET '{'
461
#define NANO_ALT_PIPE '|'
462
#define NANO_ALT_RCURLYBRACKET '}'
Chris Allegretta's avatar
Chris Allegretta committed
463

464
/* Some semi-changeable keybindings; don't play with these unless you're
465
 * sure you know what you're doing.  Assume ERR is defined as -1. */
Chris Allegretta's avatar
Chris Allegretta committed
466

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
467
/* No key at all. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
468
#define NANO_NO_KEY			-2
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
469
470

/* Normal keys. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
471
472
473
474
475
476
477
478
479
480
481
482
483
#define NANO_XON_KEY			NANO_CONTROL_Q
#define NANO_XOFF_KEY			NANO_CONTROL_S
#define NANO_CANCEL_KEY			NANO_CONTROL_C
#define NANO_EXIT_KEY			NANO_CONTROL_X
#define NANO_EXIT_FKEY			KEY_F(2)
#define NANO_INSERTFILE_KEY		NANO_CONTROL_R
#define NANO_INSERTFILE_FKEY		KEY_F(5)
#define NANO_TOOTHERINSERT_KEY		NANO_CONTROL_X
#define NANO_WRITEOUT_KEY		NANO_CONTROL_O
#define NANO_WRITEOUT_FKEY		KEY_F(3)
#define NANO_GOTOLINE_KEY		NANO_CONTROL_7
#define NANO_GOTOLINE_FKEY		KEY_F(13)
#define NANO_GOTOLINE_ALTKEY		NANO_ALT_G
484
485
486
#define NANO_GOTODIR_KEY		NANO_CONTROL_7
#define NANO_GOTODIR_FKEY		KEY_F(13)
#define NANO_GOTODIR_ALTKEY		NANO_ALT_G
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
#define NANO_TOGOTOLINE_KEY		NANO_CONTROL_T
#define NANO_HELP_KEY			NANO_CONTROL_G
#define NANO_HELP_FKEY			KEY_F(1)
#define NANO_WHEREIS_KEY		NANO_CONTROL_W
#define NANO_WHEREIS_FKEY		KEY_F(6)
#define NANO_WHEREIS_NEXT_KEY		NANO_ALT_W
#define NANO_WHEREIS_NEXT_FKEY		KEY_F(16)
#define NANO_TOOTHERWHEREIS_KEY		NANO_CONTROL_T
#define NANO_REGEXP_KEY			NANO_ALT_R
#define NANO_REPLACE_KEY		NANO_CONTROL_4
#define NANO_REPLACE_FKEY		KEY_F(14)
#define NANO_ALT_REPLACE_KEY		NANO_ALT_R
#define NANO_TOOTHERSEARCH_KEY		NANO_CONTROL_R
#define NANO_PREVPAGE_KEY		NANO_CONTROL_Y
#define NANO_PREVPAGE_FKEY		KEY_F(7)
#define NANO_NEXTPAGE_KEY		NANO_CONTROL_V
#define NANO_NEXTPAGE_FKEY		KEY_F(8)
#define NANO_CUT_KEY			NANO_CONTROL_K
#define NANO_CUT_FKEY			KEY_F(9)
#define NANO_COPY_KEY			NANO_ALT_CARET
#define NANO_COPY_ALTKEY		NANO_ALT_6
#define NANO_UNCUT_KEY			NANO_CONTROL_U
#define NANO_UNCUT_FKEY			KEY_F(10)
#define NANO_CURSORPOS_KEY		NANO_CONTROL_C
#define NANO_CURSORPOS_FKEY		KEY_F(11)
#define NANO_SPELL_KEY			NANO_CONTROL_T
#define NANO_SPELL_FKEY			KEY_F(12)
#define NANO_FIRSTLINE_KEY		NANO_PREVPAGE_KEY
#define NANO_FIRSTLINE_FKEY		NANO_PREVPAGE_FKEY
#define NANO_FIRSTLINE_ALTKEY		NANO_ALT_BACKSLASH
#define NANO_FIRSTLINE_ALTKEY2		NANO_ALT_PIPE
#define NANO_FIRSTFILE_KEY		NANO_FIRSTLINE_KEY
#define NANO_FIRSTFILE_FKEY		NANO_FIRSTLINE_FKEY
#define NANO_FIRSTFILE_ALTKEY		NANO_FIRSTLINE_ALTKEY
#define NANO_FIRSTFILE_ALTKEY2		NANO_FIRSTLINE_ALTKEY2
#define NANO_LASTLINE_KEY		NANO_NEXTPAGE_KEY
#define NANO_LASTLINE_FKEY		NANO_NEXTPAGE_FKEY
#define NANO_LASTLINE_ALTKEY		NANO_ALT_SLASH
#define NANO_LASTLINE_ALTKEY2		NANO_ALT_QUESTION
#define NANO_LASTFILE_KEY		NANO_LASTLINE_KEY
#define NANO_LASTFILE_FKEY		NANO_LASTLINE_FKEY
#define NANO_LASTFILE_ALTKEY		NANO_LASTLINE_ALTKEY
#define NANO_LASTFILE_ALTKEY2		NANO_LASTLINE_ALTKEY2
#define NANO_REFRESH_KEY		NANO_CONTROL_L
#define NANO_JUSTIFY_KEY		NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY		KEY_F(4)
#define NANO_UNJUSTIFY_KEY		NANO_UNCUT_KEY
#define NANO_UNJUSTIFY_FKEY		NANO_UNCUT_FKEY
#define NANO_PREVLINE_KEY		NANO_CONTROL_P
#define NANO_NEXTLINE_KEY		NANO_CONTROL_N
#define NANO_FORWARD_KEY		NANO_CONTROL_F
#define NANO_BACK_KEY			NANO_CONTROL_B
#define NANO_MARK_KEY			NANO_CONTROL_6
#define NANO_MARK_ALTKEY		NANO_ALT_A
#define NANO_MARK_FKEY			KEY_F(15)
#define NANO_HOME_KEY			NANO_CONTROL_A
#define NANO_END_KEY			NANO_CONTROL_E
#define NANO_DELETE_KEY			NANO_CONTROL_D
#define NANO_BACKSPACE_KEY		NANO_CONTROL_H
#define NANO_TAB_KEY			NANO_CONTROL_I
547
548
#define NANO_INDENT_KEY			NANO_ALT_RCURLYBRACKET
#define NANO_UNINDENT_KEY		NANO_ALT_LCURLYBRACKET
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
549
550
551
552
553
554
555
#define NANO_SUSPEND_KEY		NANO_CONTROL_Z
#define NANO_ENTER_KEY			NANO_CONTROL_M
#define NANO_TOFILES_KEY		NANO_CONTROL_T
#define NANO_APPEND_KEY			NANO_ALT_A
#define NANO_PREPEND_KEY		NANO_ALT_P
#define NANO_PREVFILE_KEY		NANO_ALT_LCARET
#define NANO_PREVFILE_ALTKEY		NANO_ALT_COMMA
556
#define NANO_NEXTFILE_KEY		NANO_ALT_RCARET
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
557
#define NANO_NEXTFILE_ALTKEY		NANO_ALT_PERIOD
558
#define NANO_BRACKET_KEY		NANO_ALT_RBRACKET
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
559
560
561
562
563
564
565
566
567
#define NANO_NEXTWORD_KEY		NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY		NANO_ALT_SPACE
#define NANO_WORDCOUNT_KEY		NANO_ALT_D
#define NANO_SCROLLUP_KEY		NANO_ALT_MINUS
#define NANO_SCROLLDOWN_KEY		NANO_ALT_PLUS
#define NANO_SCROLLUP_ALTKEY		NANO_ALT_UNDERSCORE
#define NANO_SCROLLDOWN_ALTKEY		NANO_ALT_EQUALS
#define NANO_CUTTILLEND_ALTKEY		NANO_ALT_T
#define NANO_PARABEGIN_KEY		NANO_CONTROL_W
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
568
#define NANO_PARABEGIN_ALTKEY		NANO_ALT_LPARENTHESIS
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
569
570
#define NANO_PARABEGIN_ALTKEY2		NANO_ALT_9
#define NANO_PARAEND_KEY		NANO_CONTROL_O
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
571
#define NANO_PARAEND_ALTKEY		NANO_ALT_RPARENTHESIS
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
572
573
574
575
#define NANO_PARAEND_ALTKEY2		NANO_ALT_0
#define NANO_FULLJUSTIFY_KEY		NANO_CONTROL_U
#define NANO_FULLJUSTIFY_ALTKEY		NANO_ALT_J
#define NANO_VERBATIM_KEY		NANO_ALT_V
Chris Allegretta's avatar
Chris Allegretta committed
576

577
/* Toggles do not exist if NANO_TINY is defined. */
578
#ifndef NANO_TINY
579
580

/* No toggle at all. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
581
#define TOGGLE_NO_KEY			-2
582
583

/* Normal toggles. */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
#define TOGGLE_NOHELP_KEY		NANO_ALT_X
#define TOGGLE_CONST_KEY		NANO_ALT_C
#define TOGGLE_MORESPACE_KEY		NANO_ALT_O
#define TOGGLE_SMOOTH_KEY		NANO_ALT_S
#define TOGGLE_WHITESPACE_KEY		NANO_ALT_P
#define TOGGLE_SYNTAX_KEY		NANO_ALT_Y
#define TOGGLE_SMARTHOME_KEY		NANO_ALT_H
#define TOGGLE_AUTOINDENT_KEY		NANO_ALT_I
#define TOGGLE_CUTTOEND_KEY		NANO_ALT_K
#define TOGGLE_WRAP_KEY			NANO_ALT_L
#define TOGGLE_TABSTOSPACES_KEY		NANO_ALT_Q
#define TOGGLE_BACKUP_KEY		NANO_ALT_B
#define TOGGLE_MULTIBUFFER_KEY		NANO_ALT_F
#define TOGGLE_MOUSE_KEY		NANO_ALT_M
#define TOGGLE_NOCONVERT_KEY		NANO_ALT_N
#define TOGGLE_SUSPEND_KEY		NANO_ALT_Z
#define TOGGLE_CASE_KEY			NANO_ALT_C
#define TOGGLE_BACKWARDS_KEY		NANO_ALT_B
#define TOGGLE_DOS_KEY			NANO_ALT_D
#define TOGGLE_MAC_KEY			NANO_ALT_M
604
#endif /* !NANO_TINY */
605

606
607
#define VIEW TRUE
#define NOVIEW FALSE
Chris Allegretta's avatar
Chris Allegretta committed
608

609
610
611
/* The maximum number of entries displayed in the main shortcut list. */
#define MAIN_VISIBLE 12

612
/* The minimum editor window columns and rows required for nano to work
613
614
 * correctly. */
#define MIN_EDITOR_COLS 4
615
#define MIN_EDITOR_ROWS 1
616

617
618
/* The default number of characters from the end of the line where
 * wrapping occurs. */
619
620
#define CHARS_FROM_EOL 8

621
/* The default width of a tab in spaces. */
622
623
#define WIDTH_OF_TAB 8

624
625
/* The maximum number of search/replace history strings saved, not
 * counting the blank lines at their ends. */
626
#define MAX_SEARCH_HISTORY 100
Chris Allegretta's avatar
Chris Allegretta committed
627

628
/* The maximum number of bytes buffered at one time. */
629
630
#define MAX_BUF_SIZE 128

Chris Allegretta's avatar
Chris Allegretta committed
631
#endif /* !NANO_H */