nano.h 15.7 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-2005 Chris Allegretta                             *
Chris Allegretta's avatar
Chris Allegretta committed
6
7
 *   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 *
8
 *   the Free Software Foundation; either version 2, or (at your option)  *
Chris Allegretta's avatar
Chris Allegretta committed
9
10
 *   any later version.                                                   *
 *                                                                        *
11
12
13
14
 *   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
15
16
17
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
 *   along with this program; if not, write to the Free Software          *
18
19
 *   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA            *
 *   02110-1301, USA.                                                     *
Chris Allegretta's avatar
Chris Allegretta committed
20
21
22
 *                                                                        *
 **************************************************************************/

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

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

30
#ifdef __TANDEM
31
/* Tandem NonStop Kernel. */
32
33
34
35
36
37
#include <floss.h>
#define NANO_ROOT_UID 65535
#else
#define NANO_ROOT_UID 0
#endif

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

42
/* Macros for the flags long. */
Chris Allegretta's avatar
Chris Allegretta committed
43
44
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
45
#define ISSET(bit) ((flags & bit) != 0)
46
#define TOGGLE(bit) flags ^= bit
Chris Allegretta's avatar
Chris Allegretta committed
47

48
/* Macros for character allocation, etc. */
Chris Allegretta's avatar
Chris Allegretta committed
49
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
50
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
51
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
52
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
53
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
54

55
/* Other macros. */
56
#ifdef BROKEN_REGEXEC
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
57
#undef regexec
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
58
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
59
#endif
Chris Allegretta's avatar
Chris Allegretta committed
60

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

66
#ifdef USE_SLANG
67
/* Slang support enabled. */
Chris Allegretta's avatar
Chris Allegretta committed
68
#include <slcurses.h>
69
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
70
 * curses equivalents of the Insert or Delete keys. */
71
#define KEY_DC SL_KEY_DELETE
72
#define KEY_IC SL_KEY_IC
Chris Allegretta's avatar
Chris Allegretta committed
73
74
#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
75
#else /* Uh oh. */
76
#include <curses.h>
Chris Allegretta's avatar
Chris Allegretta committed
77
78
#endif /* CURSES_H */

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

93
#include <stddef.h>
94
95
#include <sys/types.h>
#include <sys/stat.h>
Chris Allegretta's avatar
Chris Allegretta committed
96

97
/* If no snprintf() or vsnprintf(), use the versions from glib. */
Chris Allegretta's avatar
Chris Allegretta committed
98
99
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <glib.h>
100
101
102
103
104
#ifndef HAVE_SNPRINTF
#define snprintf g_snprintf
#endif
#ifndef HAVE_VSNPRINTF
#define vsnprintf g_vsnprintf
Chris Allegretta's avatar
Chris Allegretta committed
105
#endif
106
107
#endif

108
109
110
111
112
113
114
115
116
/* 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
117
118
119
120
121
122
123
124
125
126
127
128
#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
129
130
131
132
133
134
135
#ifndef HAVE_GETDELIM
#define getdelim ngetdelim
#endif
#ifndef HAVE_GETLINE
#define getline ngetline
#endif

Chris Allegretta's avatar
Chris Allegretta committed
136
#define VERMSG "GNU nano " VERSION
Chris Allegretta's avatar
Chris Allegretta committed
137

138
139
/* If we aren't using ncurses, turn the mouse support off, as it's
 * ncurses-specific. */
140
141
142
143
#ifndef NCURSES_MOUSE_VERSION
#define DISABLE_MOUSE 1
#endif

144
145
146
147
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif

148
149
150
151
152
153
154
155
156
157
158
159
160
/* Enumeration types. */
typedef enum {
    NIX_FILE, DOS_FILE, MAC_FILE
} file_format;

typedef enum {
    UP, DOWN
} updown;

typedef enum {
    TOP, CENTER, NONE
} topmidnone;

161
/* Structure types. */
Chris Allegretta's avatar
Chris Allegretta committed
162
163
typedef struct filestruct {
    char *data;
164
165
166
    struct filestruct *next;	/* Next node. */
    struct filestruct *prev;	/* Previous node. */
    int lineno;			/* The line number. */
167
} filestruct;
168

169
#ifdef ENABLE_MULTIBUFFER
170
171
typedef struct openfilestruct {
    char *filename;
172
173
174
#ifndef NANO_SMALL
    struct stat originalfilestat;
#endif
175
176
177
178
179
180
181
182
    struct openfilestruct *next;
				/* Next node. */
    struct openfilestruct *prev;
				/* Previous node. */
    filestruct *fileage;	/* Current file. */
    filestruct *filebot;	/* Current file's last line. */
    filestruct *edittop;	/* Current top of edit window. */
    filestruct *current;	/* Current file's line. */
Chris Allegretta's avatar
Chris Allegretta committed
183
#ifndef NANO_SMALL
184
    filestruct *mark_beginbuf;
185
186
				/* Current file's beginning marked
				 * line. */
187
    size_t mark_beginx;		/* Current file's beginning marked
188
				 * line's x-coordinate position. */
Chris Allegretta's avatar
Chris Allegretta committed
189
#endif
190
    size_t current_x;		/* Current file's x-coordinate
191
				 * position. */
192
193
    size_t placewewant;		/* Current file's place we want. */
    int totlines;		/* Current file's total number of
194
				 * lines. */
195
196
    size_t totsize;		/* Current file's total size. */
    unsigned long flags;	/* Current file's flags: modification
197
198
				 * status (and marking status, if
				 * available). */
199
    file_format fmt;		/* Current file's format. */
200
} openfilestruct;
201
202
#endif

203
204
205
206
207
208
209
210
211
typedef struct partition {
    filestruct *fileage;
    filestruct *top_prev;
    char *top_data;
    filestruct *filebot;
    filestruct *bot_next;
    char *bot_data;
} partition;

Chris Allegretta's avatar
Chris Allegretta committed
212
typedef struct shortcut {
213
    /* Key values that aren't used should be set to NANO_NO_KEY. */
214
    int ctrlval;	/* Special sentinel key or control key we want
215
			 * bound. */
216
217
218
    int metaval;	/* Meta key we want bound. */
    int funcval;	/* Function key we want bound. */
    int miscval;	/* Other Meta key we want bound. */
219
    bool viewok;	/* Is this function legal in view mode? */
220
    void (*func)(void);	/* Function to call when we catch this key. */
221
    const char *desc;	/* Description, e.g. "Page Up". */
222
#ifndef DISABLE_HELP
223
    const char *help;	/* Help file entry text. */
224
#endif
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
225
    struct shortcut *next;
Chris Allegretta's avatar
Chris Allegretta committed
226
227
} shortcut;

Chris Allegretta's avatar
Chris Allegretta committed
228
#ifndef NANO_SMALL
229
typedef struct toggle {
230
231
   int val;		/* Sequence to toggle the key.  Should only need
			 * one. */
232
   const char *desc;	/* Description for when toggle is, uh, toggled,
233
234
			 * e.g. "Cut to end"; we'll append Enabled or
			 * Disabled. */
235
   long flag;		/* What flag actually gets toggled. */
236
   struct toggle *next;
237
} toggle;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
238
#endif
239

240
241
#ifdef ENABLE_NANORC
typedef struct rcoption {
242
   const char *name;
243
   long flag;
244
} rcoption;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
245
#endif
246

247
248
#ifdef ENABLE_COLOR
typedef struct colortype {
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
249
250
    int fg;			/* Foreground color. */
    int bg;			/* Background color. */
251
    int bright;			/* Is this color A_BOLD? */
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
252
253
254
255
256
    int pairnum;		/* Color pair number used for this
				 * foreground/background. */
    regex_t start;		/* Start (or all) of the regex
				 * string. */
    regex_t *end;		/* End (if any) of the regex string. */
257
258
259
    struct colortype *next;
} colortype;

260
typedef struct exttype {
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
261
262
    regex_t val;		/* The extensions that match this
				 * syntax. */
263
264
265
266
    struct exttype *next;
} exttype;

typedef struct syntaxtype {
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
267
268
269
270
    char *desc;			/* Name of this syntax type. */
    exttype *extensions;	/* List of extensions that this syntax
				 * applies to. */
    colortype *color;		/* Color struct for this syntax. */
271
272
    struct syntaxtype *next;
} syntaxtype;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
273
#endif
274

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
275
276
/* Bitwise flags so that we can save space (or, more correctly, not
 * waste it). */
Chris Allegretta's avatar
Chris Allegretta committed
277
#define MODIFIED		(1<<0)
278
279
280
281
282
283
284
285
286
287
288
#define CASE_SENSITIVE		(1<<1)
#define MARK_ISSET		(1<<2)
#define CONSTUPDATE		(1<<3)
#define NO_HELP			(1<<4)
#define NOFOLLOW_SYMLINKS	(1<<5)
#define SUSPEND			(1<<6)
#define NO_WRAP			(1<<7)
#define AUTOINDENT		(1<<8)
#define VIEW_MODE		(1<<9)
#define USE_MOUSE		(1<<10)
#define USE_REGEXP		(1<<11)
289
#define TEMP_FILE		(1<<12)
290
291
292
#define CUT_TO_END		(1<<13)
#define REVERSE_SEARCH		(1<<14)
#define MULTIBUFFER		(1<<15)
293
294
295
296
297
298
#define SMOOTHSCROLL		(1<<16)
#define DISABLE_CURPOS		(1<<17)	/* Damn, we still need it. */
#define REBIND_DELETE		(1<<18)
#define NO_CONVERT		(1<<19)
#define BACKUP_FILE		(1<<20)
#define NO_RCFILE		(1<<21)
299
#define NO_COLOR_SYNTAX		(1<<22)
300
#define PRESERVE		(1<<23)
301
302
303
304
305
#define HISTORYLOG		(1<<24)
#define RESTRICTED		(1<<25)
#define SMART_HOME		(1<<26)
#define WHITESPACE_DISPLAY	(1<<27)
#define MORE_SPACE		(1<<28)
306
307
#define TABS_TO_SPACES		(1<<29)
#define NO_UTF8			(1<<30)
Chris Allegretta's avatar
Chris Allegretta committed
308

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
309
/* Control key sequences.  Changing these would be very, very bad. */
Chris Allegretta's avatar
Chris Allegretta committed
310
#define NANO_CONTROL_SPACE 0
Chris Allegretta's avatar
Chris Allegretta committed
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#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
337
#define NANO_CONTROL_3 27
Chris Allegretta's avatar
Chris Allegretta committed
338
339
340
341
#define NANO_CONTROL_4 28
#define NANO_CONTROL_5 29
#define NANO_CONTROL_6 30
#define NANO_CONTROL_7 31
342
#define NANO_CONTROL_8 127
Chris Allegretta's avatar
Chris Allegretta committed
343

344
345
#define NANO_ALT_9 '9'
#define NANO_ALT_0 '0'
Chris Allegretta's avatar
Chris Allegretta committed
346
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
#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'
372
373
#define NANO_ALT_PERIOD '.'
#define NANO_ALT_COMMA ','
374
375
#define NANO_ALT_LPAREN '('
#define NANO_ALT_RPAREN ')'
376
377
#define NANO_ALT_LCARAT '<'
#define NANO_ALT_RCARAT '>'
378
#define NANO_ALT_RBRACKET ']'
379
#define NANO_ALT_SPACE ' '
Chris Allegretta's avatar
Chris Allegretta committed
380

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

David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
384
/* No key at all. */
385
#define NANO_NO_KEY		-2
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
386
387

/* Normal keys. */
388
389
#define NANO_XON_KEY		NANO_CONTROL_Q
#define NANO_XOFF_KEY		NANO_CONTROL_S
390
#define NANO_CANCEL_KEY		NANO_CONTROL_C
David Lawrence Ramsey's avatar
   
David Lawrence Ramsey committed
391
392
#define NANO_EXIT_KEY		NANO_CONTROL_X
#define NANO_EXIT_FKEY		KEY_F(2)
393
394
395
#define NANO_INSERTFILE_KEY	NANO_CONTROL_R
#define NANO_INSERTFILE_FKEY	KEY_F(5)
#define NANO_TOOTHERINSERT_KEY	NANO_CONTROL_X
Chris Allegretta's avatar
Chris Allegretta committed
396
397
#define NANO_WRITEOUT_KEY	NANO_CONTROL_O
#define NANO_WRITEOUT_FKEY	KEY_F(3)
398
399
400
401
#define NANO_GOTOLINE_KEY	NANO_CONTROL_7
#define NANO_GOTOLINE_FKEY	KEY_F(13)
#define NANO_GOTOLINE_ALTKEY	NANO_ALT_G
#define NANO_TOGOTOLINE_KEY	NANO_CONTROL_T
Chris Allegretta's avatar
Chris Allegretta committed
402
403
404
405
#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)
406
#define NANO_WHEREIS_NEXT_KEY	NANO_ALT_W
407
#define NANO_WHEREIS_NEXT_FKEY	KEY_F(16)
408
#define NANO_TOOTHERWHEREIS_KEY	NANO_CONTROL_T
409
#define NANO_REGEXP_KEY		NANO_ALT_R
Chris Allegretta's avatar
Chris Allegretta committed
410
411
412
#define NANO_REPLACE_KEY	NANO_CONTROL_4
#define NANO_REPLACE_FKEY	KEY_F(14)
#define NANO_ALT_REPLACE_KEY	NANO_ALT_R
413
#define NANO_TOOTHERSEARCH_KEY	NANO_CONTROL_R
Chris Allegretta's avatar
Chris Allegretta committed
414
415
416
417
418
419
420
421
422
423
424
425
426
#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_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
427
#define NANO_FIRSTLINE_FKEY	NANO_PREVPAGE_FKEY
Chris Allegretta's avatar
Chris Allegretta committed
428
#define NANO_LASTLINE_KEY	NANO_NEXTPAGE_KEY
429
#define NANO_LASTLINE_FKEY	NANO_NEXTPAGE_FKEY
Chris Allegretta's avatar
Chris Allegretta committed
430
431
432
#define NANO_REFRESH_KEY	NANO_CONTROL_L
#define NANO_JUSTIFY_KEY	NANO_CONTROL_J
#define NANO_JUSTIFY_FKEY	KEY_F(4)
433
434
#define NANO_UNJUSTIFY_KEY	NANO_UNCUT_KEY	/* Same key as uncut. */
#define NANO_UNJUSTIFY_FKEY	NANO_UNCUT_FKEY	/* Same key as uncut. */
435
436
#define NANO_PREVLINE_KEY	NANO_CONTROL_P
#define NANO_NEXTLINE_KEY	NANO_CONTROL_N
Chris Allegretta's avatar
Chris Allegretta committed
437
438
439
#define NANO_FORWARD_KEY	NANO_CONTROL_F
#define NANO_BACK_KEY		NANO_CONTROL_B
#define NANO_MARK_KEY		NANO_CONTROL_6
440
#define NANO_MARK_ALTKEY	NANO_ALT_A
441
#define NANO_MARK_FKEY		KEY_F(15)
Chris Allegretta's avatar
Chris Allegretta committed
442
443
444
445
446
447
448
#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
#define NANO_SUSPEND_KEY	NANO_CONTROL_Z
#define NANO_ENTER_KEY		NANO_CONTROL_M
Chris Allegretta's avatar
Chris Allegretta committed
449
#define NANO_TOFILES_KEY	NANO_CONTROL_T
450
#define NANO_APPEND_KEY		NANO_ALT_A
451
#define NANO_PREPEND_KEY	NANO_ALT_P
452
453
#define NANO_OPENPREV_KEY	NANO_ALT_LCARAT
#define NANO_OPENNEXT_KEY	NANO_ALT_RCARAT
454
455
#define NANO_OPENPREV_ALTKEY	NANO_ALT_COMMA
#define NANO_OPENNEXT_ALTKEY	NANO_ALT_PERIOD
456
#define NANO_BRACKET_KEY	NANO_ALT_RBRACKET
457
458
#define NANO_NEXTWORD_KEY	NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY	NANO_ALT_SPACE
459
#define NANO_WORDCOUNT_KEY	NANO_ALT_D
460
461
#define NANO_CUTTILLEND_KEY	NANO_CONTROL_X
#define NANO_CUTTILLEND_ALTKEY	NANO_ALT_T
462
#define NANO_PARABEGIN_KEY	NANO_CONTROL_W
463
464
#define NANO_PARABEGIN_ALTKEY1	NANO_ALT_LPAREN
#define NANO_PARABEGIN_ALTKEY2	NANO_ALT_9
465
#define NANO_PARAEND_KEY	NANO_CONTROL_O
466
467
#define NANO_PARAEND_ALTKEY1	NANO_ALT_RPAREN
#define NANO_PARAEND_ALTKEY2	NANO_ALT_0
468
#define NANO_FULLJUSTIFY_KEY	NANO_CONTROL_U
469
#define NANO_FULLJUSTIFY_ALTKEY	NANO_ALT_J
470
#define NANO_VERBATIM_KEY	NANO_ALT_V
Chris Allegretta's avatar
Chris Allegretta committed
471

Chris Allegretta's avatar
Chris Allegretta committed
472
473
#ifndef NANO_SMALL
/* Toggles do not exist with NANO_SMALL. */
474
475
476
477
478
479
#define TOGGLE_CONST_KEY	NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY	NANO_ALT_I
#define TOGGLE_SUSPEND_KEY	NANO_ALT_Z
#define TOGGLE_NOHELP_KEY	NANO_ALT_X
#define TOGGLE_MOUSE_KEY	NANO_ALT_M
#define TOGGLE_CUTTOEND_KEY	NANO_ALT_K
480
#define TOGGLE_WRAP_KEY		NANO_ALT_L
481
#define TOGGLE_BACKWARDS_KEY	NANO_ALT_B
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
482
#define TOGGLE_CASE_KEY		NANO_ALT_C
483
#define TOGGLE_MULTIBUFFER_KEY	NANO_ALT_F
484
#define TOGGLE_DOS_KEY		NANO_ALT_D
485
#define TOGGLE_MAC_KEY		NANO_ALT_M
486
#define TOGGLE_SMOOTH_KEY	NANO_ALT_S
487
#define TOGGLE_NOCONVERT_KEY	NANO_ALT_N
488
#define TOGGLE_BACKUP_KEY	NANO_ALT_B
489
#define TOGGLE_SYNTAX_KEY	NANO_ALT_Y
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
490
#define TOGGLE_SMARTHOME_KEY	NANO_ALT_H
491
#define TOGGLE_WHITESPACE_KEY	NANO_ALT_P
492
#define TOGGLE_MORESPACE_KEY	NANO_ALT_O
493
#define TOGGLE_TABSTOSPACES_KEY	NANO_ALT_E
Chris Allegretta's avatar
Chris Allegretta committed
494
#endif /* !NANO_SMALL */
495

496
#define MAIN_VISIBLE 12
Chris Allegretta's avatar
Chris Allegretta committed
497

498
499
#define VIEW TRUE
#define NOVIEW FALSE
Chris Allegretta's avatar
Chris Allegretta committed
500

501
/* Minimum editor window rows required for nano to work correctly. */
502
#define MIN_EDITOR_ROWS 1
503

Chris Allegretta's avatar
Chris Allegretta committed
504
/* Default number of characters from end-of-line where text wrapping
505
 * occurs. */
506
507
#define CHARS_FROM_EOL 8

508
509
510
/* Default width of a tab. */
#define WIDTH_OF_TAB 8

511
512
/* Maximum number of search/replace history strings saved, not counting
 * the blank lines at their ends. */
513
#define MAX_SEARCH_HISTORY 100
Chris Allegretta's avatar
Chris Allegretta committed
514

515
516
517
/* Maximum number of bytes we read from a file at one time. */
#define MAX_BUF_SIZE 128

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