2000-08-06 21:13:45 +00:00
|
|
|
/* $Id$ */
|
2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* nano.h *
|
|
|
|
* *
|
2005-01-01 07:43:32 +00:00
|
|
|
* Copyright (C) 1999-2005 Chris Allegretta *
|
2000-06-06 05:53:49 +00:00
|
|
|
* 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 *
|
2001-10-24 11:33:54 +00:00
|
|
|
* the Free Software Foundation; either version 2, or (at your option) *
|
2000-06-06 05:53:49 +00:00
|
|
|
* any later version. *
|
|
|
|
* *
|
2005-05-15 19:57:17 +00:00
|
|
|
* 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. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software *
|
2005-05-15 19:57:17 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
|
|
|
|
* 02110-1301, USA. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
|
|
|
**************************************************************************/
|
|
|
|
|
2004-02-27 03:06:28 +00:00
|
|
|
#ifndef NANO_H
|
|
|
|
#define NANO_H 1
|
|
|
|
|
2005-04-15 18:07:26 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2004-03-04 06:33:52 +00:00
|
|
|
#ifdef __TANDEM
|
2005-04-15 18:07:26 +00:00
|
|
|
/* Tandem NonStop Kernel. */
|
2004-03-04 06:33:52 +00:00
|
|
|
#include <floss.h>
|
|
|
|
#define NANO_ROOT_UID 65535
|
|
|
|
#else
|
|
|
|
#define NANO_ROOT_UID 0
|
|
|
|
#endif
|
|
|
|
|
2000-06-06 05:53:49 +00:00
|
|
|
#ifdef HAVE_LIMITS_H
|
|
|
|
#include <limits.h>
|
|
|
|
#endif
|
|
|
|
|
2005-06-21 04:16:12 +00:00
|
|
|
/* Macros for flags. */
|
2000-06-06 05:53:49 +00:00
|
|
|
#define SET(bit) flags |= bit
|
|
|
|
#define UNSET(bit) flags &= ~bit
|
2003-09-07 23:57:24 +00:00
|
|
|
#define ISSET(bit) ((flags & bit) != 0)
|
2001-06-14 02:54:22 +00:00
|
|
|
#define TOGGLE(bit) flags ^= bit
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-06-12 15:24:36 +00:00
|
|
|
/* Macros for character allocation, etc. */
|
2003-01-13 01:35:15 +00:00
|
|
|
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
2003-01-30 00:57:33 +00:00
|
|
|
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
2003-09-16 01:16:49 +00:00
|
|
|
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
2005-06-12 15:24:36 +00:00
|
|
|
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
2004-09-18 22:02:21 +00:00
|
|
|
|
2005-03-21 07:24:47 +00:00
|
|
|
/* Other macros. */
|
2003-03-11 03:50:40 +00:00
|
|
|
#ifdef BROKEN_REGEXEC
|
2005-01-07 19:02:47 +00:00
|
|
|
#undef regexec
|
2005-03-21 06:33:41 +00:00
|
|
|
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
|
2003-03-11 03:50:40 +00:00
|
|
|
#endif
|
2003-01-13 01:35:15 +00:00
|
|
|
|
2005-06-08 01:35:10 +00:00
|
|
|
/* Set a default value for PATH_MAX if there isn't one. */
|
2004-11-04 04:08:18 +00:00
|
|
|
#ifndef PATH_MAX
|
2005-03-26 04:42:28 +00:00
|
|
|
#define PATH_MAX 4096
|
2002-06-28 22:45:14 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-09-10 20:08:00 +00:00
|
|
|
#ifdef USE_SLANG
|
2004-05-18 01:20:36 +00:00
|
|
|
/* Slang support enabled. */
|
2000-06-06 05:53:49 +00:00
|
|
|
#include <slcurses.h>
|
2004-05-19 16:04:27 +00:00
|
|
|
/* Slang curses emulation brain damage, part 2: Slang doesn't define the
|
2004-05-18 01:20:36 +00:00
|
|
|
* curses equivalents of the Insert or Delete keys. */
|
2002-12-22 16:30:00 +00:00
|
|
|
#define KEY_DC SL_KEY_DELETE
|
2003-09-07 05:32:24 +00:00
|
|
|
#define KEY_IC SL_KEY_IC
|
2000-06-06 05:53:49 +00:00
|
|
|
#elif defined(HAVE_NCURSES_H)
|
|
|
|
#include <ncurses.h>
|
2003-12-24 08:03:54 +00:00
|
|
|
#else /* Uh oh. */
|
2003-09-10 20:08:00 +00:00
|
|
|
#include <curses.h>
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif /* CURSES_H */
|
|
|
|
|
2002-10-17 02:19:31 +00:00
|
|
|
#ifdef ENABLE_NLS
|
2005-01-17 05:06:55 +00:00
|
|
|
#ifdef HAVE_LIBINTL_H
|
|
|
|
#include <libintl.h>
|
|
|
|
#endif
|
|
|
|
#define _(string) gettext(string)
|
|
|
|
#define P_(singular, plural, number) ngettext(singular, plural, number)
|
2002-10-17 02:19:31 +00:00
|
|
|
#else
|
2005-01-17 05:06:55 +00:00
|
|
|
#define _(string) (string)
|
|
|
|
#define P_(singular, plural, number) (number == 1 ? singular : plural)
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2004-07-12 03:10:30 +00:00
|
|
|
#define gettext_noop(string) (string)
|
|
|
|
#define N_(string) gettext_noop(string)
|
2005-03-21 06:33:41 +00:00
|
|
|
/* Mark a string that will be sent to gettext() later. */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2004-12-23 17:43:27 +00:00
|
|
|
#include <stddef.h>
|
2002-06-28 22:45:14 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-07-04 04:22:30 +00:00
|
|
|
/* If no vsnprintf(), use the version from glib 2.x. */
|
2005-01-16 18:49:19 +00:00
|
|
|
#ifndef HAVE_VSNPRINTF
|
2005-07-04 04:22:30 +00:00
|
|
|
#include <glib.h>
|
2005-01-16 18:49:19 +00:00
|
|
|
#define vsnprintf g_vsnprintf
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2003-03-11 03:50:40 +00:00
|
|
|
|
2005-06-12 17:48:46 +00:00
|
|
|
/* 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
|
2005-03-20 07:24:49 +00:00
|
|
|
#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
|
2004-08-17 05:23:38 +00:00
|
|
|
#ifndef HAVE_GETDELIM
|
|
|
|
#define getdelim ngetdelim
|
|
|
|
#endif
|
|
|
|
#ifndef HAVE_GETLINE
|
|
|
|
#define getline ngetline
|
|
|
|
#endif
|
|
|
|
|
2001-02-14 14:28:27 +00:00
|
|
|
#define VERMSG "GNU nano " VERSION
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-12-24 08:03:54 +00:00
|
|
|
/* If we aren't using ncurses, turn the mouse support off, as it's
|
|
|
|
* ncurses-specific. */
|
2003-10-03 20:26:25 +00:00
|
|
|
#ifndef NCURSES_MOUSE_VERSION
|
|
|
|
#define DISABLE_MOUSE 1
|
|
|
|
#endif
|
|
|
|
|
2001-05-21 12:56:25 +00:00
|
|
|
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
|
|
|
|
#define DISABLE_WRAPJUSTIFY 1
|
|
|
|
#endif
|
|
|
|
|
2004-11-04 04:08:18 +00:00
|
|
|
/* Enumeration types. */
|
|
|
|
typedef enum {
|
|
|
|
NIX_FILE, DOS_FILE, MAC_FILE
|
|
|
|
} file_format;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
UP, DOWN
|
|
|
|
} updown;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
TOP, CENTER, NONE
|
|
|
|
} topmidnone;
|
|
|
|
|
2003-12-24 08:03:54 +00:00
|
|
|
/* Structure types. */
|
2000-06-06 05:53:49 +00:00
|
|
|
typedef struct filestruct {
|
|
|
|
char *data;
|
2003-12-24 08:03:54 +00:00
|
|
|
struct filestruct *next; /* Next node. */
|
|
|
|
struct filestruct *prev; /* Previous node. */
|
2005-06-28 06:25:34 +00:00
|
|
|
ssize_t lineno; /* The line number. */
|
2002-04-10 02:31:20 +00:00
|
|
|
} filestruct;
|
2001-07-11 02:08:33 +00:00
|
|
|
|
2002-04-10 02:31:20 +00:00
|
|
|
typedef struct openfilestruct {
|
2005-07-08 20:09:16 +00:00
|
|
|
char *filename; /* Current file's name. */
|
|
|
|
filestruct *fileage; /* Current file's first line. */
|
2004-11-25 04:39:07 +00:00
|
|
|
filestruct *filebot; /* Current file's last line. */
|
|
|
|
filestruct *edittop; /* Current top of edit window. */
|
|
|
|
filestruct *current; /* Current file's line. */
|
2005-07-08 20:09:16 +00:00
|
|
|
size_t current_x; /* Current file's x-coordinate
|
|
|
|
* position. */
|
|
|
|
ssize_t current_y; /* Current file's y-coordinate
|
|
|
|
* position. */
|
|
|
|
size_t placewewant; /* Current file's place we want. */
|
2002-05-11 03:04:44 +00:00
|
|
|
#ifndef NANO_SMALL
|
2004-11-25 04:39:07 +00:00
|
|
|
filestruct *mark_beginbuf;
|
2003-12-24 08:03:54 +00:00
|
|
|
/* Current file's beginning marked
|
|
|
|
* line. */
|
2004-11-25 04:39:07 +00:00
|
|
|
size_t mark_beginx; /* Current file's beginning marked
|
2003-12-24 08:03:54 +00:00
|
|
|
* line's x-coordinate position. */
|
2002-05-11 03:04:44 +00:00
|
|
|
#endif
|
2005-06-28 06:25:34 +00:00
|
|
|
size_t totlines; /* Current file's total number of
|
2003-12-24 08:03:54 +00:00
|
|
|
* lines. */
|
2005-01-27 20:49:07 +00:00
|
|
|
size_t totsize; /* Current file's total size. */
|
2005-07-08 20:09:16 +00:00
|
|
|
bool modified; /* Current file's modification
|
|
|
|
* status. */
|
|
|
|
#ifndef NANO_SMALL
|
|
|
|
bool mark_set; /* Current file's marking status. */
|
2004-11-25 04:39:07 +00:00
|
|
|
file_format fmt; /* Current file's format. */
|
2005-07-08 20:09:16 +00:00
|
|
|
struct stat originalfilestat;
|
|
|
|
/* Current file's stat. */
|
2001-07-11 02:08:33 +00:00
|
|
|
#endif
|
2005-07-08 20:09:16 +00:00
|
|
|
struct openfilestruct *next;
|
|
|
|
/* Next node. */
|
|
|
|
struct openfilestruct *prev;
|
|
|
|
/* Previous node. */
|
|
|
|
} openfilestruct;
|
2001-07-11 02:08:33 +00:00
|
|
|
|
2004-11-03 22:03:41 +00:00
|
|
|
typedef struct partition {
|
|
|
|
filestruct *fileage;
|
|
|
|
filestruct *top_prev;
|
|
|
|
char *top_data;
|
|
|
|
filestruct *filebot;
|
|
|
|
filestruct *bot_next;
|
|
|
|
char *bot_data;
|
|
|
|
} partition;
|
|
|
|
|
2000-06-06 05:53:49 +00:00
|
|
|
typedef struct shortcut {
|
2003-12-24 08:03:54 +00:00
|
|
|
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
2004-03-19 21:46:34 +00:00
|
|
|
int ctrlval; /* Special sentinel key or control key we want
|
2003-12-24 08:03:54 +00:00
|
|
|
* bound. */
|
2004-03-19 21:46:34 +00:00
|
|
|
int metaval; /* Meta key we want bound. */
|
|
|
|
int funcval; /* Function key we want bound. */
|
|
|
|
int miscval; /* Other Meta key we want bound. */
|
2005-01-08 06:04:19 +00:00
|
|
|
bool viewok; /* Is this function legal in view mode? */
|
2004-07-02 14:31:03 +00:00
|
|
|
void (*func)(void); /* Function to call when we catch this key. */
|
2003-12-24 08:03:54 +00:00
|
|
|
const char *desc; /* Description, e.g. "Page Up". */
|
2002-04-23 10:56:06 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2003-12-24 08:03:54 +00:00
|
|
|
const char *help; /* Help file entry text. */
|
2002-04-23 10:56:06 +00:00
|
|
|
#endif
|
2003-12-24 03:33:09 +00:00
|
|
|
struct shortcut *next;
|
2000-06-06 05:53:49 +00:00
|
|
|
} shortcut;
|
|
|
|
|
2002-07-19 01:08:59 +00:00
|
|
|
#ifndef NANO_SMALL
|
2000-09-01 13:32:47 +00:00
|
|
|
typedef struct toggle {
|
2003-12-24 08:03:54 +00:00
|
|
|
int val; /* Sequence to toggle the key. Should only need
|
|
|
|
* one. */
|
2002-04-23 10:56:06 +00:00
|
|
|
const char *desc; /* Description for when toggle is, uh, toggled,
|
2004-01-09 23:04:55 +00:00
|
|
|
* e.g. "Cut to end"; we'll append Enabled or
|
|
|
|
* Disabled. */
|
2004-07-07 15:20:52 +00:00
|
|
|
long flag; /* What flag actually gets toggled. */
|
2002-02-15 19:17:02 +00:00
|
|
|
struct toggle *next;
|
2000-09-01 13:32:47 +00:00
|
|
|
} toggle;
|
2004-11-03 14:58:04 +00:00
|
|
|
#endif
|
2000-09-01 13:32:47 +00:00
|
|
|
|
2001-04-18 04:28:54 +00:00
|
|
|
#ifdef ENABLE_NANORC
|
|
|
|
typedef struct rcoption {
|
2002-09-13 18:14:04 +00:00
|
|
|
const char *name;
|
2004-07-07 15:20:52 +00:00
|
|
|
long flag;
|
2001-04-18 04:28:54 +00:00
|
|
|
} rcoption;
|
2004-11-03 14:58:04 +00:00
|
|
|
#endif
|
2001-04-18 04:28:54 +00:00
|
|
|
|
2001-11-29 02:42:27 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
typedef struct colortype {
|
2005-03-22 02:50:24 +00:00
|
|
|
int fg; /* Foreground color. */
|
|
|
|
int bg; /* Background color. */
|
2005-06-26 22:32:51 +00:00
|
|
|
bool bright; /* Is this color A_BOLD? */
|
2005-03-22 02:50:24 +00:00
|
|
|
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. */
|
2001-11-29 02:42:27 +00:00
|
|
|
struct colortype *next;
|
|
|
|
} colortype;
|
|
|
|
|
2002-05-04 03:47:33 +00:00
|
|
|
typedef struct exttype {
|
2005-03-22 02:50:24 +00:00
|
|
|
regex_t val; /* The extensions that match this
|
|
|
|
* syntax. */
|
2002-05-04 03:47:33 +00:00
|
|
|
struct exttype *next;
|
|
|
|
} exttype;
|
|
|
|
|
|
|
|
typedef struct syntaxtype {
|
2005-03-22 02:50:24 +00:00
|
|
|
char *desc; /* Name of this syntax type. */
|
|
|
|
exttype *extensions; /* List of extensions that this syntax
|
|
|
|
* applies to. */
|
|
|
|
colortype *color; /* Color struct for this syntax. */
|
2002-05-04 03:47:33 +00:00
|
|
|
struct syntaxtype *next;
|
|
|
|
} syntaxtype;
|
2004-11-03 14:58:04 +00:00
|
|
|
#endif
|
2001-11-29 02:42:27 +00:00
|
|
|
|
2005-05-22 04:16:36 +00:00
|
|
|
/* Bitwise flags so that we can save space (or, more correctly, not
|
|
|
|
* waste it). */
|
2005-07-08 20:09:16 +00:00
|
|
|
#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 NO_CONVERT (1<<16)
|
|
|
|
#define BACKUP_FILE (1<<17)
|
|
|
|
#define NO_RCFILE (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 USE_UTF8 (1<<28)
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-05-22 04:16:36 +00:00
|
|
|
/* Control key sequences. Changing these would be very, very bad. */
|
2002-07-19 01:08:59 +00:00
|
|
|
#define NANO_CONTROL_SPACE 0
|
2000-06-06 05:53:49 +00:00
|
|
|
#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
|
2003-08-17 02:48:43 +00:00
|
|
|
#define NANO_CONTROL_3 27
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_CONTROL_4 28
|
|
|
|
#define NANO_CONTROL_5 29
|
|
|
|
#define NANO_CONTROL_6 30
|
|
|
|
#define NANO_CONTROL_7 31
|
2003-08-17 02:48:43 +00:00
|
|
|
#define NANO_CONTROL_8 127
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2004-09-11 21:41:13 +00:00
|
|
|
#define NANO_ALT_9 '9'
|
|
|
|
#define NANO_ALT_0 '0'
|
2000-06-06 05:53:49 +00:00
|
|
|
#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'
|
2002-04-05 23:33:09 +00:00
|
|
|
#define NANO_ALT_PERIOD '.'
|
|
|
|
#define NANO_ALT_COMMA ','
|
2004-09-11 21:41:13 +00:00
|
|
|
#define NANO_ALT_LPAREN '('
|
|
|
|
#define NANO_ALT_RPAREN ')'
|
2002-01-02 14:30:33 +00:00
|
|
|
#define NANO_ALT_LCARAT '<'
|
|
|
|
#define NANO_ALT_RCARAT '>'
|
2003-11-28 19:47:42 +00:00
|
|
|
#define NANO_ALT_RBRACKET ']'
|
2002-06-28 22:45:14 +00:00
|
|
|
#define NANO_ALT_SPACE ' '
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-12-24 08:03:54 +00:00
|
|
|
/* Some semi-changeable keybindings; don't play with these unless you're
|
2004-04-23 18:02:37 +00:00
|
|
|
* sure you know what you're doing. Assume ERR is defined as -1. */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-12-24 03:33:09 +00:00
|
|
|
/* No key at all. */
|
2004-04-23 18:02:37 +00:00
|
|
|
#define NANO_NO_KEY -2
|
2003-12-24 03:33:09 +00:00
|
|
|
|
|
|
|
/* Normal keys. */
|
2004-07-01 18:59:52 +00:00
|
|
|
#define NANO_XON_KEY NANO_CONTROL_Q
|
|
|
|
#define NANO_XOFF_KEY NANO_CONTROL_S
|
2004-09-30 22:07:21 +00:00
|
|
|
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
2003-12-24 03:33:09 +00:00
|
|
|
#define NANO_EXIT_KEY NANO_CONTROL_X
|
|
|
|
#define NANO_EXIT_FKEY KEY_F(2)
|
2004-09-30 22:07:21 +00:00
|
|
|
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
|
|
|
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
|
|
|
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
|
|
|
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
2004-09-30 22:07:21 +00:00
|
|
|
#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
|
2000-06-06 05:53:49 +00:00
|
|
|
#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)
|
2003-08-23 21:11:06 +00:00
|
|
|
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
2004-11-01 22:40:02 +00:00
|
|
|
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
2004-09-30 22:07:21 +00:00
|
|
|
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
2005-06-03 20:51:39 +00:00
|
|
|
#define NANO_REGEXP_KEY NANO_ALT_R
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
|
|
|
#define NANO_REPLACE_FKEY KEY_F(14)
|
|
|
|
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
2004-09-30 22:07:21 +00:00
|
|
|
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
2000-06-06 05:53:49 +00:00
|
|
|
#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
|
2004-03-04 19:30:53 +00:00
|
|
|
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
2004-03-04 19:30:53 +00:00
|
|
|
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
|
|
|
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
|
|
|
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
2004-01-29 04:16:23 +00:00
|
|
|
#define NANO_UNJUSTIFY_KEY NANO_UNCUT_KEY /* Same key as uncut. */
|
|
|
|
#define NANO_UNJUSTIFY_FKEY NANO_UNCUT_FKEY /* Same key as uncut. */
|
2004-01-23 19:26:17 +00:00
|
|
|
#define NANO_PREVLINE_KEY NANO_CONTROL_P
|
|
|
|
#define NANO_NEXTLINE_KEY NANO_CONTROL_N
|
2000-06-06 05:53:49 +00:00
|
|
|
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
|
|
|
#define NANO_BACK_KEY NANO_CONTROL_B
|
|
|
|
#define NANO_MARK_KEY NANO_CONTROL_6
|
2004-09-30 22:07:21 +00:00
|
|
|
#define NANO_MARK_ALTKEY NANO_ALT_A
|
2004-11-01 22:40:02 +00:00
|
|
|
#define NANO_MARK_FKEY KEY_F(15)
|
2000-06-06 05:53:49 +00:00
|
|
|
#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
|
2001-01-03 07:11:47 +00:00
|
|
|
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
2001-06-14 02:54:22 +00:00
|
|
|
#define NANO_APPEND_KEY NANO_ALT_A
|
2002-04-16 03:15:47 +00:00
|
|
|
#define NANO_PREPEND_KEY NANO_ALT_P
|
2005-07-08 20:09:16 +00:00
|
|
|
#define NANO_PREVFILE_KEY NANO_ALT_LCARAT
|
|
|
|
#define NANO_NEXTFILE_KEY NANO_ALT_RCARAT
|
|
|
|
#define NANO_PREVFILE_ALTKEY NANO_ALT_COMMA
|
|
|
|
#define NANO_NEXTFILE_ALTKEY NANO_ALT_PERIOD
|
2003-11-28 19:47:42 +00:00
|
|
|
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
2002-06-28 22:45:14 +00:00
|
|
|
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
|
|
|
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
2005-06-12 22:31:03 +00:00
|
|
|
#define NANO_WORDCOUNT_KEY NANO_ALT_D
|
2005-01-01 07:43:32 +00:00
|
|
|
#define NANO_CUTTILLEND_KEY NANO_CONTROL_X
|
|
|
|
#define NANO_CUTTILLEND_ALTKEY NANO_ALT_T
|
2003-09-04 20:25:29 +00:00
|
|
|
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
2004-09-11 21:41:13 +00:00
|
|
|
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
|
|
|
|
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
2003-09-04 20:25:29 +00:00
|
|
|
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
2004-09-11 21:41:13 +00:00
|
|
|
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
|
|
|
|
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
2004-07-23 12:30:40 +00:00
|
|
|
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
2004-09-11 21:41:13 +00:00
|
|
|
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
2003-11-28 19:47:42 +00:00
|
|
|
#define NANO_VERBATIM_KEY NANO_ALT_V
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2002-07-19 01:08:59 +00:00
|
|
|
#ifndef NANO_SMALL
|
|
|
|
/* Toggles do not exist with NANO_SMALL. */
|
2000-09-01 13:32:47 +00:00
|
|
|
#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
|
2003-08-23 21:11:06 +00:00
|
|
|
#define TOGGLE_WRAP_KEY NANO_ALT_L
|
2001-06-14 02:54:22 +00:00
|
|
|
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
|
2002-08-21 16:10:37 +00:00
|
|
|
#define TOGGLE_CASE_KEY NANO_ALT_C
|
2003-11-28 19:47:42 +00:00
|
|
|
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
2001-09-22 00:42:10 +00:00
|
|
|
#define TOGGLE_DOS_KEY NANO_ALT_D
|
2004-10-24 17:20:31 +00:00
|
|
|
#define TOGGLE_MAC_KEY NANO_ALT_M
|
2001-09-22 19:02:04 +00:00
|
|
|
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
2002-02-15 19:17:02 +00:00
|
|
|
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
2002-06-28 22:45:14 +00:00
|
|
|
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
2002-10-13 18:43:45 +00:00
|
|
|
#define TOGGLE_SYNTAX_KEY NANO_ALT_Y
|
2004-05-22 20:15:20 +00:00
|
|
|
#define TOGGLE_SMARTHOME_KEY NANO_ALT_H
|
2004-05-29 16:25:30 +00:00
|
|
|
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
2005-01-17 05:06:55 +00:00
|
|
|
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
2005-06-21 17:44:01 +00:00
|
|
|
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
2002-07-19 01:08:59 +00:00
|
|
|
#endif /* !NANO_SMALL */
|
2000-09-01 13:32:47 +00:00
|
|
|
|
2001-06-14 02:54:22 +00:00
|
|
|
#define MAIN_VISIBLE 12
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2004-07-01 18:59:52 +00:00
|
|
|
#define VIEW TRUE
|
|
|
|
#define NOVIEW FALSE
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-12-24 08:03:54 +00:00
|
|
|
/* Minimum editor window rows required for nano to work correctly. */
|
2005-01-19 19:52:42 +00:00
|
|
|
#define MIN_EDITOR_ROWS 1
|
2003-02-10 02:43:48 +00:00
|
|
|
|
2003-01-13 01:35:15 +00:00
|
|
|
/* Default number of characters from end-of-line where text wrapping
|
2003-12-24 08:03:54 +00:00
|
|
|
* occurs. */
|
2001-01-14 05:18:27 +00:00
|
|
|
#define CHARS_FROM_EOL 8
|
|
|
|
|
2004-09-05 21:40:31 +00:00
|
|
|
/* Default width of a tab. */
|
|
|
|
#define WIDTH_OF_TAB 8
|
|
|
|
|
2005-05-23 16:30:06 +00:00
|
|
|
/* Maximum number of search/replace history strings saved, not counting
|
|
|
|
* the blank lines at their ends. */
|
2003-01-05 20:41:21 +00:00
|
|
|
#define MAX_SEARCH_HISTORY 100
|
2003-01-13 01:35:15 +00:00
|
|
|
|
2005-04-19 21:47:01 +00:00
|
|
|
/* Maximum number of bytes we read from a file at one time. */
|
|
|
|
#define MAX_BUF_SIZE 128
|
|
|
|
|
2002-07-29 23:46:38 +00:00
|
|
|
#endif /* !NANO_H */
|