nano.h 17.4 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/**************************************************************************
2
 *   nano.h  --  This file is part of GNU nano.                           *
Chris Allegretta's avatar
Chris Allegretta committed
3
 *                                                                        *
4
 *   Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.    *
5
 *   Copyright (C) 2014, 2015, 2016 Benno Schulenberg                     *
6
 *                                                                        *
7
8
9
10
 *   GNU nano is free software: you can redistribute it and/or modify     *
 *   it under the terms of the GNU General Public License as published    *
 *   by the Free Software Foundation, either version 3 of the License,    *
 *   or (at your option) any later version.                               *
Chris Allegretta's avatar
Chris Allegretta committed
11
 *                                                                        *
12
13
14
15
 *   GNU nano 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
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
18
 *   along with this program.  If not, see http://www.gnu.org/licenses/.  *
Chris Allegretta's avatar
Chris Allegretta committed
19
20
21
 *                                                                        *
 **************************************************************************/

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

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

29
30
31
#ifdef NEED_XOPEN_SOURCE_EXTENDED
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
32
33
#endif
#endif
34

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

Chris Allegretta's avatar
Chris Allegretta committed
43
44
45
46
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

47
48
49
50
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif

Benno Schulenberg's avatar
Benno Schulenberg committed
51
/* Suppress warnings for __attribute__((warn_unused_result)). */
52
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
53

54
55
/* Macros for flags, indexing each bit in a small array. */
#define FLAGS(flag) flags[((flag) / (sizeof(unsigned) * 8))]
56
#define FLAGMASK(flag) ((unsigned)1 << ((flag) % (sizeof(unsigned) * 8)))
57
58
59
60
#define SET(flag) FLAGS(flag) |= FLAGMASK(flag)
#define UNSET(flag) FLAGS(flag) &= ~FLAGMASK(flag)
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
Chris Allegretta's avatar
Chris Allegretta committed
61

62
/* Macros for character allocation and more. */
Chris Allegretta's avatar
Chris Allegretta committed
63
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
64
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
65
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
66
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
67

68
69
70
71
72
73
74
/* In UTF-8 a character is at most six bytes long. */
#ifdef ENABLE_UTF8
#define MAXCHARLEN 6
#else
#define MAXCHARLEN 1
#endif

David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
75
/* Set a default value for PATH_MAX if there isn't one. */
76
#ifndef PATH_MAX
77
#define PATH_MAX 4096
78
#endif
Chris Allegretta's avatar
Chris Allegretta committed
79

80
81
82
83
84
85
86
#ifdef USE_SLANG
/* Slang support. */
#include <slcurses.h>
/* Slang curses emulation brain damage, part 3: Slang doesn't define the
 * curses equivalents of the Insert or Delete keys. */
#define KEY_DC SL_KEY_DELETE
#define KEY_IC SL_KEY_IC
87
/* Ncurses support. */
88
89
#elif defined(HAVE_NCURSESW_NCURSES_H)
#include <ncursesw/ncurses.h>
90
#elif defined(HAVE_NCURSES_H)
Chris Allegretta's avatar
Chris Allegretta committed
91
#include <ncurses.h>
92
93
#else
/* Curses support. */
94
#include <curses.h>
Chris Allegretta's avatar
Chris Allegretta committed
95
96
#endif /* CURSES_H */

97
98
99
100
#if defined(NCURSES_VERSION_MAJOR) && (NCURSES_VERSION_MAJOR < 6)
#define USING_OLD_NCURSES yes
#endif

101
#ifdef ENABLE_NLS
102
/* Native language support. */
103
104
105
106
107
#ifdef HAVE_LIBINTL_H
#include <libintl.h>
#endif
#define _(string) gettext(string)
#define P_(singular, plural, number) ngettext(singular, plural, number)
108
#else
109
110
#define _(string) (string)
#define P_(singular, plural, number) (number == 1 ? singular : plural)
Chris Allegretta's avatar
Chris Allegretta committed
111
#endif
112
113
#define gettext_noop(string) (string)
#define N_(string) gettext_noop(string)
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
114
	/* Mark a string that will be sent to gettext() later. */
Chris Allegretta's avatar
Chris Allegretta committed
115

116
#include <stddef.h>
117
#include <stdlib.h>
118
119
#include <sys/types.h>
#include <sys/stat.h>
120
121
#include <dirent.h>
#include <regex.h>
122
#include <signal.h>
123
#include <assert.h>
Chris Allegretta's avatar
Chris Allegretta committed
124

125
126
/* If we aren't using an ncurses with mouse support, exclude any
 * mouse routines, as they are useless then. */
127
#ifndef NCURSES_MOUSE_VERSION
128
#undef ENABLE_MOUSE
129
#endif
130

131
132
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
133
#endif
134

135
136
137
138
139
/* Enumeration types. */
typedef enum {
    NIX_FILE, DOS_FILE, MAC_FILE
} file_format;

140
141
142
143
typedef enum {
    HUSH, MILD, ALERT
} message_type;

144
145
typedef enum {
    OVERWRITE, APPEND, PREPEND
146
} kind_of_writing_type;
147

148
149
150
151
typedef enum {
    SOFTMARK, HARDMARK
} mark_type;

152
typedef enum {
153
    UPWARD, DOWNWARD
154
} scroll_dir;
155
156

typedef enum {
157
    CENTERING, FLOWING, STATIONARY
158
} update_type;
159

160
typedef enum {
161
    ADD, DEL, BACK, CUT, CUT_TO_EOF, REPLACE,
162
163
#ifndef DISABLE_WRAPPING
    SPLIT_BEGIN, SPLIT_END,
164
#endif
165
#ifdef ENABLE_COMMENT
166
    COMMENT, UNCOMMENT, PREFLIGHT,
167
#endif
168
    JOIN, PASTE, INSERT, ENTER, OTHER
169
170
} undo_type;

171
/* Structure types. */
172
#ifndef DISABLE_COLOR
173
typedef struct colortype {
174
    short fg;
175
	/* This syntax's foreground color. */
176
    short bg;
177
178
179
180
181
182
	/* This syntax's background color. */
    bool bright;
	/* Is this color A_BOLD? */
    int pairnum;
	/* The color pair number used for this foreground color and
	 * background color. */
183
184
    int attributes;
	/* Pair number and brightness composed into ready-to-use attributes. */
185
186
    int rex_flags;
	/* The regex compilation flags (with or without REG_ICASE). */
187
188
189
190
191
192
193
194
    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. */
195
    struct colortype *next;
196
	/* Next set of colors. */
197
    int id;
Benno Schulenberg's avatar
Benno Schulenberg committed
198
	/* Basic id for assigning to lines later. */
199
200
} colortype;

201
typedef struct regexlisttype {
202
203
    char *full_regex;
	/* A regex string to match things that imply a certain syntax. */
204
    struct regexlisttype *next;
205
	/* The next regex. */
206
} regexlisttype;
207
208

typedef struct syntaxtype {
209
    char *name;
210
	/* The name of this syntax. */
211
    regexlisttype *extensions;
212
	/* The list of extensions that this syntax applies to. */
213
    regexlisttype *headers;
214
	/* The list of headerlines that this syntax applies to. */
215
    regexlisttype *magics;
216
	/* The list of libmagic results that this syntax applies to. */
217
    char *linter;
218
	/* The command with which to lint this type of file. */
219
    char *formatter;
220
        /* The formatting command (for programming languages mainly). */
221
#ifdef ENABLE_COMMENT
222
223
    char *comment;
	/* The line comment prefix (and postfix) for this type of file. */
224
#endif
225
226
    colortype *color;
	/* The colors and their regexes used in this syntax. */
227
    int nmultis;
228
	/* How many multiline regex strings this syntax has. */
229
    struct syntaxtype *next;
230
	/* Next syntax. */
231
} syntaxtype;
232

233
234
235
236
237
238
typedef struct lintstruct {
    ssize_t lineno;
	/* Line number of the error. */
    ssize_t colno;
	/* Column # of the error. */
    char *msg;
Benno Schulenberg's avatar
Benno Schulenberg committed
239
	/* Error message text. */
240
    char *filename;
Benno Schulenberg's avatar
Benno Schulenberg committed
241
	/* Filename. */
242
243
244
    struct lintstruct *next;
	/* Next error. */
    struct lintstruct *prev;
Benno Schulenberg's avatar
Benno Schulenberg committed
245
	/* Previous error. */
246
247
} lintstruct;

248
/* Flags that indicate how a multiline regex applies to a line. */
249
#define CNONE		(1<<1)
250
	/* Yay, regex doesn't apply to this line at all! */
251
#define CBEGINBEFORE	(1<<2)
Benno Schulenberg's avatar
Benno Schulenberg committed
252
	/* Regex starts on an earlier line, ends on this one. */
253
#define CENDAFTER	(1<<3)
Benno Schulenberg's avatar
Benno Schulenberg committed
254
	/* Regex starts on this line and ends on a later one. */
255
#define CWHOLELINE	(1<<4)
Benno Schulenberg's avatar
Benno Schulenberg committed
256
	/* Whole line engulfed by the regex, start < me, end > me. */
257
#define CSTARTENDHERE	(1<<5)
Benno Schulenberg's avatar
Benno Schulenberg committed
258
	/* Regex starts and ends within this line. */
259
260
#define CWOULDBE	(1<<6)
	/* An unpaired start match on or before this line. */
261
#endif /* !DISABLE_COLOR */
262

263
/* More structure types. */
264
265
266
267
268
269
270
271
272
typedef struct filestruct {
    char *data;
	/* The text of this line. */
    ssize_t lineno;
	/* The number of this line. */
    struct filestruct *next;
	/* Next node. */
    struct filestruct *prev;
	/* Previous node. */
273
#ifndef DISABLE_COLOR
Benno Schulenberg's avatar
Benno Schulenberg committed
274
275
    short *multidata;
	/* Array of which multi-line regexes apply to this line. */
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#endif
} filestruct;

typedef struct partition {
    filestruct *fileage;
	/* The top line of this portion of the file. */
    filestruct *top_prev;
	/* The line before the top line of this portion of the file. */
    char *top_data;
	/* The text before the beginning of the top line of this portion
	 * of the file. */
    filestruct *filebot;
	/* The bottom line of this portion of the file. */
    filestruct *bot_next;
	/* The line after the bottom line of this portion of the
	 * file. */
    char *bot_data;
	/* The text after the end of the bottom line of this portion of
	 * the file. */
} partition;

297
#ifndef NANO_TINY
298
299
300
301
302
303
304
305
typedef struct undo_group {
    ssize_t top_line;
	/* First line of group. */
    ssize_t bottom_line;
	/* Last line of group. */
    struct undo_group *next;
} undo_group;

306
typedef struct undo {
307
    ssize_t lineno;
308
    undo_type type;
Benno Schulenberg's avatar
Benno Schulenberg committed
309
	/* What type of undo this was. */
310
    size_t begin;
Benno Schulenberg's avatar
Benno Schulenberg committed
311
	/* Where did this action begin or end. */
312
    char *strdata;
Benno Schulenberg's avatar
Benno Schulenberg committed
313
	/* String type data we will use for copying the affected line back. */
314
315
316
317
    size_t wassize;
	/* The file size before the action. */
    size_t newsize;
	/* The file size after the action. */
318
    int xflags;
Benno Schulenberg's avatar
Benno Schulenberg committed
319
	/* Some flag data we need. */
320
321
    undo_group *grouping;
	/* Undo info specific to groups of lines. */
322

Benno Schulenberg's avatar
Benno Schulenberg committed
323
    /* Cut-specific stuff we need. */
324
    filestruct *cutbuffer;
Benno Schulenberg's avatar
Benno Schulenberg committed
325
	/* Copy of the cutbuffer. */
326
    filestruct *cutbottom;
Benno Schulenberg's avatar
Benno Schulenberg committed
327
	/* Copy of cutbottom. */
328
    ssize_t mark_begin_lineno;
329
	/* Mostly the line number of the current line; sometimes something else. */
330
    size_t mark_begin_x;
331
	/* The x position corresponding to the above line number. */
332
    struct undo *next;
333
	/* A pointer to the undo item of the preceding action. */
334
} undo;
335
#endif /* !NANO_TINY */
336

337
#ifndef DISABLE_HISTORIES
338
339
typedef struct poshiststruct {
    char *filename;
340
	/* The file. */
341
    ssize_t lineno;
Benno Schulenberg's avatar
Benno Schulenberg committed
342
	/* Line number we left off on. */
343
    ssize_t xno;
Benno Schulenberg's avatar
Benno Schulenberg committed
344
	/* x position in the file we left off on. */
345
346
    struct poshiststruct *next;
} poshiststruct;
347
#endif
348

349
typedef struct openfilestruct {
350
    char *filename;
351
	/* The file's name. */
352
    filestruct *fileage;
353
	/* The file's first line. */
354
    filestruct *filebot;
355
	/* The file's last line. */
356
    filestruct *edittop;
357
	/* The current top of the edit window for this file. */
358
    filestruct *current;
359
	/* The current line for this file. */
360
    size_t totsize;
361
	/* The file's total number of characters. */
362
363
364
    size_t firstcolumn;
	/* The starting column of the top line of the edit window.
	 * When not in softwrap mode, it's always zero. */
365
    size_t current_x;
366
	/* The file's x-coordinate position. */
367
    size_t placewewant;
368
	/* The file's x position we would like. */
369
    ssize_t current_y;
370
	/* The file's y-coordinate position. */
371
    bool modified;
372
	/* Whether the file has been modified. */
373
374
    struct stat *current_stat;
	/* The file's current stat information. */
375
#ifndef NANO_TINY
376
    bool mark_set;
377
	/* Whether the mark is on in this file. */
378
    filestruct *mark_begin;
379
	/* The file's line where the mark is, if any. */
380
    size_t mark_begin_x;
381
	/* The file's mark's x-coordinate position, if any. */
382
383
    mark_type kind_of_mark;
	/* Whether this is a soft or a hard mark. */
384
    file_format fmt;
385
	/* The file's format. */
386
    undo *undotop;
387
	/* The top of the undo list. */
388
    undo *current_undo;
Benno Schulenberg's avatar
Benno Schulenberg committed
389
	/* The current (i.e. next) level of undo. */
390
    undo_type last_action;
391
	/* The type of the last action the user performed. */
392
    char *lock_filename;
393
	/* The path of the lockfile, if we created one. */
394
#endif
395
#ifndef DISABLE_COLOR
396
    syntaxtype *syntax;
Benno Schulenberg's avatar
Benno Schulenberg committed
397
	/* The  syntax struct for this file, if any. */
398
    colortype *colorstrings;
399
	/* The file's associated colors. */
400
#endif
401
    struct openfilestruct *next;
402
	/* The next open file, if any. */
403
    struct openfilestruct *prev;
404
	/* The preceding open file, if any. */
405
} openfilestruct;
406

407
#ifdef ENABLE_NANORC
408
typedef struct rcoption {
409
    const char *name;
410
	/* The name of the rcfile option. */
411
    long flag;
412
	/* The flag associated with it, if any. */
413
} rcoption;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
414
#endif
415

416
typedef struct sc {
417
    const char *keystr;
418
	/* The string that describes a keystroke, like "^C" or "M-R". */
419
420
    bool meta;
	/* Whether this is a Meta keystroke. */
421
422
    int keycode;
	/* The integer that, together with meta, identifies the keystroke. */
423
424
    int menus;
	/* Which menus this applies to. */
425
    void (*scfunc)(void);
426
	/* The function we're going to run. */
427
#ifndef NANO_TINY
428
    int toggle;
429
	/* If a toggle, what we're toggling. */
430
431
432
    int ordinal;
	/* The how-manieth toggle this is, in order to be able to
	 * keep them in sequence. */
433
#endif
434
    struct sc *next;
435
	/* Next in the list. */
436
437
438
} sc;

typedef struct subnfunc {
439
    void (*scfunc)(void);
440
	/* The actual function to call. */
441
    int menus;
Benno Schulenberg's avatar
Benno Schulenberg committed
442
	/* In what menus this function applies. */
443
    const char *desc;
444
	/* The function's short description, for example "Where Is". */
445
#ifdef ENABLE_HELP
446
    const char *help;
447
	/* The help-screen text for this function. */
448
    bool blank_after;
449
450
	/* Whether there should be a blank line after the help text
	 * for this function. */
451
452
#endif
    bool viewok;
453
	/* Is this function allowed when in view mode? */
454
    long toggle;
455
	/* If this is a toggle, which toggle to affect. */
456
    struct subnfunc *next;
Benno Schulenberg's avatar
Benno Schulenberg committed
457
	/* Next item in the list. */
458
459
} subnfunc;

460
#ifdef ENABLE_WORDCOMPLETION
461
462
463
464
465
466
typedef struct completion_word {
    char *word;
    struct completion_word *next;
} completion_word;
#endif

467
468
469
470
/* The elements of the interface that can be colored differently. */
enum
{
    TITLE_BAR = 0,
471
    LINE_NUMBER,
472
    SELECTED_TEXT,
473
474
475
476
477
    STATUS_BAR,
    KEY_COMBO,
    FUNCTION_TAG,
    NUMBER_OF_ELEMENTS
};
478

479
/* Enumeration used in the flags array.  See the definition of FLAGMASK. */
480
481
enum
{
482
    DONTUSE,
483
    CASE_SENSITIVE,
484
    CONSTANT_SHOW,
485
486
487
488
489
490
491
492
    NO_HELP,
    SUSPEND,
    NO_WRAP,
    AUTOINDENT,
    VIEW_MODE,
    USE_MOUSE,
    USE_REGEXP,
    TEMP_FILE,
493
    CUT_FROM_CURSOR,
494
495
496
497
498
499
500
    BACKWARDS_SEARCH,
    MULTIBUFFER,
    SMOOTH_SCROLL,
    REBIND_DELETE,
    REBIND_KEYPAD,
    NO_CONVERT,
    BACKUP_FILE,
501
    INSECURE_BACKUP,
502
503
504
505
506
507
508
509
510
511
512
513
514
    NO_COLOR_SYNTAX,
    PRESERVE,
    HISTORYLOG,
    RESTRICTED,
    SMART_HOME,
    WHITESPACE_DISPLAY,
    MORE_SPACE,
    TABS_TO_SPACES,
    QUICK_BLANK,
    WORD_BOUNDS,
    NO_NEWLINES,
    BOLD_TEXT,
    QUIET,
515
    SOFTWRAP,
516
    POS_HISTORY,
517
    LOCKING,
518
    NOREAD_MODE,
519
    MAKE_IT_UNIX,
520
    JUSTIFY_TRIM,
521
    SHOW_CURSOR,
522
    LINE_NUMBERS,
523
524
    NO_PAUSES,
    AT_BLANKS
525
};
Chris Allegretta's avatar
Chris Allegretta committed
526

Benno Schulenberg's avatar
Benno Schulenberg committed
527
/* Flags for the menus in which a given function should be present. */
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
#define MMAIN			(1<<0)
#define MWHEREIS		(1<<1)
#define MREPLACE		(1<<2)
#define MREPLACEWITH		(1<<3)
#define MGOTOLINE		(1<<4)
#define MWRITEFILE		(1<<5)
#define MINSERTFILE		(1<<6)
#define MEXTCMD			(1<<7)
#define MHELP			(1<<8)
#define MSPELL			(1<<9)
#define MBROWSER		(1<<10)
#define MWHEREISFILE		(1<<11)
#define MGOTODIR		(1<<12)
#define MYESNO			(1<<13)
#define MLINTER			(1<<14)
543
#define MFINDINHELP		(1<<15)
544
/* This is an abbreviation for all menus except Help and YesNo. */
545
#define MMOST  (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
546
		MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
547
548
549
550
551
#ifndef NANO_TINY
#define MSOME  MMOST
#else
#define MSOME  MMAIN|MBROWSER
#endif
552

553
554
555
556
/* Basic control codes. */
#define TAB_CODE  0x09
#define ESC_CODE  0x1B
#define DEL_CODE  0x7F
Chris Allegretta's avatar
Chris Allegretta committed
557

558
559
560
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
#define CONTROL_LEFT 0x401
#define CONTROL_RIGHT 0x402
561
562
#define CONTROL_UP 0x403
#define CONTROL_DOWN 0x404
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
#define CONTROL_HOME 0x405
#define CONTROL_END 0x406
#define SHIFT_CONTROL_LEFT 0x411
#define SHIFT_CONTROL_RIGHT 0x412
#define SHIFT_CONTROL_UP 0x413
#define SHIFT_CONTROL_DOWN 0x414
#define SHIFT_CONTROL_HOME 0x415
#define SHIFT_CONTROL_END 0x416
#define ALT_LEFT 0x421
#define ALT_RIGHT 0x422
#define ALT_UP 0x423
#define ALT_DOWN 0x424
#define SHIFT_ALT_LEFT 0x431
#define SHIFT_ALT_RIGHT 0x432
#define SHIFT_ALT_UP 0x433
#define SHIFT_ALT_DOWN 0x434
#define SHIFT_HOME 0x455
#define SHIFT_END 0x456
#define SHIFT_PAGEUP 0x457
#define SHIFT_PAGEDOWN 0x458
583

584
585
586
587
588
589
590
591
592
#ifdef USE_SLANG
#ifdef ENABLE_UTF8
#define KEY_BAD 0xFF  /* Clipped error code. */
#endif
#define KEY_FLUSH 0x91  /* User-definable control code. */
#else
#define KEY_FLUSH KEY_F0  /* Nonexistent function key. */
#endif

593
#ifndef NANO_TINY
594
595
596
/* An imaginary key for when we get a SIGWINCH (window resize). */
#define KEY_WINCH -2

597
598
/* Some extra flags for the undo function. */
#define WAS_FINAL_BACKSPACE	(1<<1)
599
600
601
602
#define WAS_WHOLE_LINE		(1<<2)
/* The flags for the mark need to be the highest. */
#define MARK_WAS_SET		(1<<3)
#define WAS_MARKED_FORWARD	(1<<4)
603
604
#endif /* !NANO_TINY */

605
/* The maximum number of entries displayed in the main shortcut list. */
606
#define MAIN_VISIBLE (((COLS + 40) / 20) * 2)
607

608
609
/* The default number of characters from the end of the line where
 * wrapping occurs. */
610
611
#define CHARS_FROM_EOL 8

612
/* The default width of a tab in spaces. */
613
614
#define WIDTH_OF_TAB 8

615
616
617
/* The default comment character when a syntax does not specify any. */
#define GENERAL_COMMENT_CHARACTER "#"

618
619
/* The maximum number of search/replace history strings saved, not
 * counting the blank lines at their ends. */
620
#define MAX_SEARCH_HISTORY 100
Chris Allegretta's avatar
Chris Allegretta committed
621

622
/* The maximum number of bytes buffered at one time. */
623
624
#define MAX_BUF_SIZE 128

625
626
627
/* The largest size_t number that doesn't have the high bit set. */
#define HIGHEST_POSITIVE ((~(size_t)0) >> 1)

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