2008-07-10 20:13:04 +00:00
|
|
|
/* $Id$ */
|
2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* global.c *
|
|
|
|
* *
|
2007-10-11 05:01:32 +00:00
|
|
|
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
|
|
|
* Free Software Foundation, Inc. *
|
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 *
|
2007-08-11 05:17:36 +00:00
|
|
|
* the Free Software Foundation; either version 3, 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
|
|
|
* *
|
|
|
|
**************************************************************************/
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#include <ctype.h>
|
2008-03-12 04:44:14 +00:00
|
|
|
#include <string.h>
|
2008-03-05 07:34:01 +00:00
|
|
|
#include <strings.h>
|
|
|
|
#include "assert.h"
|
2000-06-06 05:53:49 +00:00
|
|
|
#include "proto.h"
|
|
|
|
|
2006-05-10 13:41:53 +00:00
|
|
|
/* Global variables. */
|
|
|
|
#ifndef NANO_TINY
|
2006-05-10 15:15:06 +00:00
|
|
|
sigjmp_buf jump_buf;
|
2006-11-27 07:28:52 +00:00
|
|
|
/* Used to return to either main() or the unjustify routine in
|
2006-05-10 13:41:53 +00:00
|
|
|
* do_justify() after a SIGWINCH. */
|
2006-05-10 15:15:06 +00:00
|
|
|
bool jump_buf_main = FALSE;
|
|
|
|
/* Have we set jump_buf so that we return to main() after a
|
|
|
|
* SIGWINCH? */
|
2006-05-10 13:41:53 +00:00
|
|
|
#endif
|
|
|
|
|
2003-10-03 20:26:25 +00:00
|
|
|
#ifndef DISABLE_WRAPJUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
ssize_t fill = 0;
|
|
|
|
/* The column where we will wrap lines. */
|
2005-07-24 19:57:51 +00:00
|
|
|
ssize_t wrap_at = -CHARS_FROM_EOL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The position where we will wrap lines. fill is equal to this
|
|
|
|
* if it's greater than zero, and equal to (COLS + this) if it
|
|
|
|
* isn't. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *last_search = NULL;
|
|
|
|
/* The last string we searched for. */
|
|
|
|
char *last_replace = NULL;
|
|
|
|
/* The last replacement string we searched for. */
|
|
|
|
|
|
|
|
long flags = 0;
|
|
|
|
/* Our flag containing the states of all global options. */
|
|
|
|
WINDOW *topwin;
|
|
|
|
/* The top portion of the window, where we display the version
|
|
|
|
* number of nano, the name of the current file, and whether the
|
|
|
|
* current file has been modified. */
|
|
|
|
WINDOW *edit;
|
2006-07-28 17:06:27 +00:00
|
|
|
/* The middle portion of the window, i.e. the edit window, where
|
2005-12-08 07:09:08 +00:00
|
|
|
* we display the current file we're editing. */
|
|
|
|
WINDOW *bottomwin;
|
|
|
|
/* The bottom portion of the window, where we display statusbar
|
|
|
|
* messages, the statusbar prompt, and a list of shortcuts. */
|
|
|
|
int editwinrows = 0;
|
|
|
|
/* How many rows does the edit window take up? */
|
|
|
|
|
|
|
|
filestruct *cutbuffer = NULL;
|
|
|
|
/* The buffer where we store cut text. */
|
2004-11-23 04:08:28 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
filestruct *jusbuffer = NULL;
|
|
|
|
/* The buffer where we store unjustified text. */
|
2004-11-23 04:08:28 +00:00
|
|
|
#endif
|
2005-12-08 07:09:08 +00:00
|
|
|
partition *filepart = NULL;
|
|
|
|
/* The partition where we store a portion of the current
|
|
|
|
* file. */
|
2005-07-08 19:57:25 +00:00
|
|
|
openfilestruct *openfile = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The list of all open file buffers. */
|
2001-07-11 02:08:33 +00:00
|
|
|
|
2006-01-06 21:51:10 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
char *matchbrackets = NULL;
|
|
|
|
/* The opening and closing brackets that can be found by bracket
|
|
|
|
* searches. */
|
|
|
|
#endif
|
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
2005-12-08 07:09:08 +00:00
|
|
|
char *whitespace = NULL;
|
|
|
|
/* The characters used when displaying the first characters of
|
|
|
|
* tabs and spaces. */
|
|
|
|
int whitespace_len[2];
|
|
|
|
/* The length of these characters. */
|
2004-05-29 16:47:52 +00:00
|
|
|
#endif
|
|
|
|
|
2002-03-03 22:36:36 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
char *punct = NULL;
|
|
|
|
/* The closing punctuation that can end sentences. */
|
|
|
|
char *brackets = NULL;
|
|
|
|
/* The closing brackets that can follow closing punctuation and
|
|
|
|
* can end sentences. */
|
|
|
|
char *quotestr = NULL;
|
|
|
|
/* The quoting string. The default value is set in main(). */
|
2004-07-30 03:54:34 +00:00
|
|
|
#ifdef HAVE_REGEX_H
|
2005-12-08 07:09:08 +00:00
|
|
|
regex_t quotereg;
|
|
|
|
/* The compiled regular expression from the quoting string. */
|
|
|
|
int quoterc;
|
2006-05-22 18:30:09 +00:00
|
|
|
/* Whether it was compiled successfully. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *quoteerr = NULL;
|
|
|
|
/* The error message, if it didn't. */
|
2004-07-30 03:54:34 +00:00
|
|
|
#else
|
2005-12-08 07:09:08 +00:00
|
|
|
size_t quotelen;
|
|
|
|
/* The length of the quoting string in bytes. */
|
2002-07-19 01:08:59 +00:00
|
|
|
#endif
|
2004-02-28 16:24:31 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
char *answer = NULL;
|
2007-01-01 05:15:32 +00:00
|
|
|
/* The answer string used by the statusbar prompt. */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
ssize_t tabsize = -1;
|
|
|
|
/* The width of a tab in spaces. The default value is set in
|
|
|
|
* main(). */
|
2000-08-03 22:51:21 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
char *backup_dir = NULL;
|
|
|
|
/* The directory where we store backup files. */
|
|
|
|
#endif
|
2001-09-19 03:19:43 +00:00
|
|
|
#ifndef DISABLE_OPERATINGDIR
|
2005-12-08 07:09:08 +00:00
|
|
|
char *operating_dir = NULL;
|
|
|
|
/* The relative path to the operating directory, which we can't
|
|
|
|
* move outside of. */
|
|
|
|
char *full_operating_dir = NULL;
|
|
|
|
/* The full path to it. */
|
2001-09-19 03:19:43 +00:00
|
|
|
#endif
|
|
|
|
|
2001-04-18 04:28:54 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2005-12-08 07:09:08 +00:00
|
|
|
char *alt_speller = NULL;
|
|
|
|
/* The command to use for the alternate spell checker. */
|
2001-04-18 04:28:54 +00:00
|
|
|
#endif
|
|
|
|
|
2001-04-30 11:28:46 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2002-12-22 16:30:00 +00:00
|
|
|
syntaxtype *syntaxes = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The global list of color syntaxes. */
|
2002-12-22 16:30:00 +00:00
|
|
|
char *syntaxstr = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The color syntax name specified on the command line. */
|
2001-04-30 11:28:46 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
const shortcut *currshortcut;
|
|
|
|
/* The current shortcut list we're using. */
|
2008-03-05 07:34:01 +00:00
|
|
|
int currmenu;
|
|
|
|
/* The currently loaded menu */
|
|
|
|
|
|
|
|
sc *sclist = NULL;
|
|
|
|
/* New shortcut key struct */
|
|
|
|
subnfunc *allfuncs = NULL;
|
|
|
|
/* New struct for the function list */
|
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *search_history = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The search string history list. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *searchage = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The top of the search string history list. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *searchbot = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The bottom of the search string history list. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *replace_history = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The replace string history list. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *replaceage = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The top of the replace string history list. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *replacebot = NULL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The bottom of the replace string history list. */
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
|
|
|
|
2006-05-10 13:41:53 +00:00
|
|
|
/* Regular expressions. */
|
2000-09-06 13:39:17 +00:00
|
|
|
#ifdef HAVE_REGEX_H
|
2005-12-08 07:09:08 +00:00
|
|
|
regex_t search_regexp;
|
|
|
|
/* The compiled regular expression to use in searches. */
|
|
|
|
regmatch_t regmatches[10];
|
|
|
|
/* The match positions for parenthetical subexpressions, 10
|
|
|
|
* maximum, used in regular expression searches. */
|
2002-07-19 01:08:59 +00:00
|
|
|
#endif
|
2002-03-24 23:19:32 +00:00
|
|
|
|
2006-04-12 15:27:40 +00:00
|
|
|
int reverse_attr = A_REVERSE;
|
|
|
|
/* The curses attribute we use for reverse video. */
|
2003-02-03 03:32:08 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
char *homedir = NULL;
|
2006-05-14 18:22:01 +00:00
|
|
|
/* The user's home directory, from $HOME or /etc/passwd. */
|
2004-08-17 05:23:38 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
/* Return the number of entries in the shortcut list s for a given menu. */
|
|
|
|
size_t length_of_list(int menu)
|
2002-02-15 19:17:02 +00:00
|
|
|
{
|
2008-03-05 07:34:01 +00:00
|
|
|
subnfunc *f;
|
2004-07-01 18:59:52 +00:00
|
|
|
size_t i = 0;
|
2002-09-13 18:14:04 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
for (f = allfuncs; f != NULL; f = f->next)
|
2008-03-13 08:23:52 +00:00
|
|
|
if ((f->menus & menu) != 0
|
|
|
|
#ifndef DISABLE_HELP
|
|
|
|
&& strlen(f->help) > 0
|
|
|
|
#endif
|
|
|
|
) {
|
2008-03-05 07:34:01 +00:00
|
|
|
i++;
|
|
|
|
}
|
2002-02-15 19:17:02 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
/* Set type of function based on the string */
|
|
|
|
function_type strtokeytype(char *str)
|
|
|
|
{
|
2008-03-11 03:03:53 +00:00
|
|
|
if (str[0] == 'M' || str[0] == 'm')
|
2008-03-05 07:34:01 +00:00
|
|
|
return META;
|
2008-03-11 03:03:53 +00:00
|
|
|
else if (str[0] == '^')
|
2008-03-05 07:34:01 +00:00
|
|
|
return CONTROL;
|
2008-03-11 03:03:53 +00:00
|
|
|
else if (str[0] == 'F' || str[0] == 'F')
|
2008-03-05 07:34:01 +00:00
|
|
|
return FKEY;
|
2008-03-11 03:03:53 +00:00
|
|
|
else
|
2008-03-05 07:34:01 +00:00
|
|
|
return RAW;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add a string to the new function list strict.
|
|
|
|
Does not allow updates, yet anyway */
|
|
|
|
void add_to_funcs(void *func, int menus, const char *desc, const char *help,
|
|
|
|
bool blank_after, bool viewok)
|
|
|
|
{
|
|
|
|
subnfunc *f;
|
|
|
|
|
|
|
|
if (allfuncs == NULL) {
|
|
|
|
allfuncs = nmalloc(sizeof(subnfunc));
|
|
|
|
f = allfuncs;
|
|
|
|
} else {
|
|
|
|
for (f = allfuncs; f->next != NULL; f = f->next)
|
|
|
|
;
|
|
|
|
f->next = (subnfunc *)nmalloc(sizeof(subnfunc));
|
|
|
|
f = f->next;
|
|
|
|
}
|
|
|
|
f->next = NULL;
|
|
|
|
f->scfunc = func;
|
|
|
|
f->menus = menus;
|
|
|
|
f->desc = desc;
|
|
|
|
f->viewok = viewok;
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
f->help = help;
|
|
|
|
f->blank_after = blank_after;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "Added func \"%s\"", f->desc);
|
2002-06-28 22:45:14 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const sc *first_sc_for(int menu, void *func) {
|
|
|
|
const sc *s;
|
2008-03-09 05:07:37 +00:00
|
|
|
const sc *metasc = NULL;
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
for (s = sclist; s != NULL; s = s->next) {
|
|
|
|
if ((s->menu & menu) && s->scfunc == func) {
|
2008-03-09 05:07:37 +00:00
|
|
|
/* try to use a meta sequence as a last resort. Otherwise
|
|
|
|
we will run into problems when we try and handle things like
|
|
|
|
the arrow keys, home, etc, if for some reason the user bound
|
|
|
|
them to a meta sequence first *shrug* */
|
|
|
|
if (s->type == META) {
|
|
|
|
metasc = s;
|
|
|
|
continue;
|
|
|
|
} /* otherwise it was something else, use it */
|
2008-03-05 07:34:01 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-09 05:07:37 +00:00
|
|
|
/* If we're here we may have found only meta sequences, if so use one */
|
|
|
|
if (metasc)
|
2008-03-11 03:03:53 +00:00
|
|
|
return metasc;
|
2008-03-09 05:07:37 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef DEBUG
|
2008-03-09 02:52:40 +00:00
|
|
|
fprintf(stderr, "Whoops, returning null given func %ld in menu %d\n", (long) func, menu);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
/* Otherwise... */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Add a string to the new shortcut list implementation
|
|
|
|
Allows updates to existing entries in the list */
|
|
|
|
void add_to_sclist(int menu, char *scstring, void *func, int toggle, int execute)
|
2000-06-06 05:53:49 +00:00
|
|
|
{
|
2008-03-05 07:34:01 +00:00
|
|
|
sc *s;
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
if (sclist == NULL) {
|
|
|
|
sclist = nmalloc(sizeof(sc));
|
|
|
|
s = sclist;
|
|
|
|
s->next = NULL;
|
2002-02-15 19:17:02 +00:00
|
|
|
} else {
|
2008-03-05 07:34:01 +00:00
|
|
|
for (s = sclist; s->next != NULL; s = s->next)
|
|
|
|
if (s->menu == menu && s->keystr == scstring)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (s->menu != menu || s->keystr != scstring) { /* i.e. this is not a replace... */
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "No match found...\n");
|
|
|
|
#endif
|
|
|
|
s->next = (sc *)nmalloc(sizeof(sc));
|
|
|
|
s = s->next;
|
|
|
|
s->next = NULL;
|
|
|
|
}
|
2002-02-15 19:17:02 +00:00
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
s->type = strtokeytype(scstring);
|
|
|
|
s->menu = menu;
|
|
|
|
s->toggle = toggle;
|
|
|
|
s->keystr = scstring;
|
|
|
|
s->scfunc = func;
|
|
|
|
s->execute = execute;
|
|
|
|
assign_keyinfo(s);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "list val = %d\n", (int) s->menu);
|
|
|
|
fprintf(stderr, "Hey, set sequence to %d for shortcut \"%s\"\n", s->seq, scstring);
|
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
/* Return the given menu's first shortcut sequence, or the default value
|
|
|
|
(2nd arg). Assumes currmenu for the menu to check*/
|
|
|
|
int sc_seq_or (void *func, int defaultval)
|
|
|
|
{
|
|
|
|
const sc *s = first_sc_for(currmenu, func);
|
|
|
|
|
|
|
|
if (s)
|
|
|
|
return s->seq;
|
|
|
|
/* else */
|
|
|
|
return defaultval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
/* Assign the info to the shortcut struct
|
|
|
|
Assumes keystr is already assigned, naturally */
|
|
|
|
void assign_keyinfo(sc *s)
|
|
|
|
{
|
|
|
|
if (s->type == CONTROL) {
|
|
|
|
assert(strlen(s->keystr) > 1);
|
|
|
|
s->seq = s->keystr[1] - 64;
|
|
|
|
} else if (s->type == META) {
|
|
|
|
assert(strlen(s->keystr) > 2);
|
|
|
|
s->seq = tolower((int) s->keystr[2]);
|
|
|
|
} else if (s->type == FKEY) {
|
|
|
|
assert(strlen(s->keystr) > 1);
|
|
|
|
s->seq = KEY_F0 + atoi(&s->keystr[1]);
|
|
|
|
} else /* raw */
|
|
|
|
s->seq = (int) s->keystr[0];
|
2008-03-05 17:15:33 +00:00
|
|
|
|
|
|
|
/* Override some keys which don't bind as nicely as we'd like */
|
|
|
|
if (s->type == CONTROL && (!strcasecmp(&s->keystr[1], "space")))
|
|
|
|
s->seq = 0;
|
|
|
|
else if (s->type == META && (!strcasecmp(&s->keystr[2], "space")))
|
|
|
|
s->seq = (int) ' ';
|
2008-03-11 03:03:53 +00:00
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kup")))
|
|
|
|
s->seq = KEY_UP;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kdown")))
|
|
|
|
s->seq = KEY_DOWN;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kleft")))
|
|
|
|
s->seq = KEY_LEFT;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kright")))
|
|
|
|
s->seq = KEY_RIGHT;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kinsert")))
|
|
|
|
s->seq = KEY_IC;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kdel")))
|
|
|
|
s->seq = KEY_DC;
|
2008-03-12 04:44:14 +00:00
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kbsp")))
|
|
|
|
s->seq = KEY_BACKSPACE;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kenter")))
|
|
|
|
s->seq = KEY_ENTER;
|
2008-03-11 03:03:53 +00:00
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kpup")))
|
|
|
|
s->seq = KEY_PPAGE;
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kpdown")))
|
|
|
|
s->seq = KEY_NPAGE;
|
|
|
|
#ifdef KEY_HOME
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "khome")))
|
|
|
|
s->seq = KEY_HOME;
|
|
|
|
#endif
|
|
|
|
#ifdef KEY_END
|
|
|
|
else if (s->type == RAW && (!strcasecmp(s->keystr, "kend")))
|
|
|
|
s->seq = KEY_END;
|
|
|
|
#endif
|
2008-03-05 17:15:33 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
void print_sclist(void)
|
|
|
|
{
|
|
|
|
sc *s;
|
|
|
|
const subnfunc *f;
|
|
|
|
|
|
|
|
for (s = sclist; s->next != NULL; s = s->next) {
|
|
|
|
f = sctofunc(s);
|
|
|
|
if (f)
|
2008-03-09 02:52:40 +00:00
|
|
|
fprintf(stderr, "Shortcut \"%s\", function: %s, menus %d\n", s->keystr, f->desc, f->menus);
|
2008-03-05 07:34:01 +00:00
|
|
|
else
|
|
|
|
fprintf(stderr, "Hmm, didnt find a func for \"%s\"\n", s->keystr);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Stuff we need to make at least static here so we can access it below */
|
|
|
|
const char *cancel_msg = N_("Cancel");
|
|
|
|
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
const char *case_sens_msg = N_("Case Sens");
|
|
|
|
const char *backwards_msg = N_("Backwards");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_REGEX_H
|
|
|
|
const char *regexp_msg = N_("Regexp");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Stuff we want to just stun out if we're in TINY mode */
|
|
|
|
#ifdef NANO_TINY
|
|
|
|
const char *gototext_msg = "";
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *do_para_begin_msg = "";
|
|
|
|
const char *do_para_end_msg = "";
|
2008-03-05 07:34:01 +00:00
|
|
|
const char *case_sens_msg = "";
|
|
|
|
const char *backwards_msg = "";
|
|
|
|
const char *do_cut_till_end = "";
|
|
|
|
const char *dos_format_msg = "";
|
|
|
|
const char *mac_format_msg = "";
|
|
|
|
const char *append_msg = "";
|
|
|
|
const char *prepend_msg = "";
|
|
|
|
const char *backup_file_msg = "";
|
|
|
|
const char *to_files_msg = "";
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *first_file_msg = "";
|
|
|
|
const char *whereis_next_msg = "";
|
|
|
|
const char *last_file_msg = "";
|
|
|
|
const char *new_buffer_msg = "";
|
|
|
|
const char *goto_dir_msg;
|
2008-03-13 08:23:52 +00:00
|
|
|
const char *ext_cmd_msg = "";
|
2008-03-09 02:52:40 +00:00
|
|
|
|
|
|
|
#else
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next five strings at most 10 characters. */
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *prev_history_msg = N_("PrevHstory");
|
2008-03-05 07:34:01 +00:00
|
|
|
const char *next_history_msg = N_("NextHstory");
|
|
|
|
const char *replace_msg = N_("Replace");
|
|
|
|
const char *no_replace_msg = N_("No Replace");
|
|
|
|
const char *gototext_msg = N_("Go To Text");
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next three strings at most 12 characters. */
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *whereis_next_msg = N_("WhereIs Next");
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
|
|
|
const char *first_file_msg = N_("First File");
|
|
|
|
const char *last_file_msg = N_("Last File");
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next nine strings at most 16 characters. */
|
|
|
|
const char *to_files_msg = N_("To Files");
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
const char *dos_format_msg = N_("DOS Format");
|
|
|
|
const char *mac_format_msg = N_("Mac Format");
|
|
|
|
const char *append_msg = N_("Append");
|
|
|
|
const char *prepend_msg = N_("Prepend");
|
|
|
|
const char *backup_file_msg = N_("Backup File");
|
2008-03-12 04:44:14 +00:00
|
|
|
const char *ext_cmd_msg = N_("Execute Command");
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
const char *new_buffer_msg = N_("New Buffer");
|
|
|
|
#endif
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *goto_dir_msg = N_("Go To Dir");
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif /* NANO_TINY */
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
/* Initialize all shortcut lists. If unjustify is TRUE, replace the
|
|
|
|
* Uncut shortcut in the main shortcut list with UnJustify. */
|
2004-11-11 21:50:01 +00:00
|
|
|
void shortcut_init(bool unjustify)
|
2000-09-01 13:32:47 +00:00
|
|
|
{
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep the following strings at most 10 characters. */
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *get_help_msg = N_("Get Help");
|
|
|
|
const char *exit_msg = N_("Exit");
|
2006-03-30 07:03:04 +00:00
|
|
|
const char *whereis_msg = N_("Where Is");
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *prev_page_msg = N_("Prev Page");
|
|
|
|
const char *next_page_msg = N_("Next Page");
|
|
|
|
const char *first_line_msg = N_("First Line");
|
|
|
|
const char *last_line_msg = N_("Last Line");
|
2008-03-13 08:23:52 +00:00
|
|
|
const char *suspend_msg = N_("Suspend");
|
2004-09-11 21:41:13 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
const char *beg_of_par_msg = N_("Beg of Par");
|
|
|
|
const char *end_of_par_msg = N_("End of Par");
|
|
|
|
const char *fulljstify_msg = N_("FullJstify");
|
|
|
|
#endif
|
2006-04-24 20:53:43 +00:00
|
|
|
const char *refresh_msg = N_("Refresh");
|
2008-03-05 07:34:01 +00:00
|
|
|
const char *insert_file_msg = N_("Insert File");
|
2008-03-09 02:52:40 +00:00
|
|
|
const char *go_to_line_msg = N_("Go To Line");
|
2008-07-10 20:13:04 +00:00
|
|
|
const char *prev_undo_msg = N_("Prev Undo");
|
|
|
|
const char *next_undo_msg = N_("Next Undo");
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2004-07-12 03:10:30 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
|
|
|
|
* they are best kept shorter than 56 characters, but may be longer. */
|
2006-03-29 19:43:32 +00:00
|
|
|
const char *nano_cancel_msg = N_("Cancel the current function");
|
2006-04-14 20:21:45 +00:00
|
|
|
const char *nano_help_msg = N_("Display this help text");
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_exit_msg =
|
2001-07-14 19:32:47 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2006-05-21 21:37:21 +00:00
|
|
|
N_("Close the current file buffer / Exit from nano")
|
2004-07-12 03:10:30 +00:00
|
|
|
#else
|
|
|
|
N_("Exit from nano")
|
|
|
|
#endif
|
|
|
|
;
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_writeout_msg =
|
|
|
|
N_("Write the current file to disk");
|
2008-03-20 04:45:55 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_justify_msg = N_("Justify the current paragraph");
|
2008-03-20 04:45:55 +00:00
|
|
|
#endif
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_insert_msg =
|
|
|
|
N_("Insert another file into the current one");
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_whereis_msg =
|
2006-05-21 21:37:21 +00:00
|
|
|
N_("Search for a string or a regular expression");
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_prevpage_msg = N_("Go to previous screen");
|
|
|
|
const char *nano_nextpage_msg = N_("Go to next screen");
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_cut_msg =
|
|
|
|
N_("Cut the current line and store it in the cutbuffer");
|
|
|
|
const char *nano_uncut_msg =
|
|
|
|
N_("Uncut from the cutbuffer into the current line");
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_cursorpos_msg =
|
2006-04-14 20:15:44 +00:00
|
|
|
N_("Display the position of the cursor");
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_spell_msg =
|
|
|
|
N_("Invoke the spell checker, if available");
|
2006-05-21 21:37:21 +00:00
|
|
|
const char *nano_replace_msg =
|
|
|
|
N_("Replace a string or a regular expression");
|
2008-03-05 07:34:01 +00:00
|
|
|
const char *nano_gotoline_msg = N_("Go to line and column number");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2004-11-01 22:40:02 +00:00
|
|
|
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
|
|
|
const char *nano_whereis_next_msg = N_("Repeat last search");
|
2006-04-27 23:39:49 +00:00
|
|
|
const char *nano_copy_msg =
|
|
|
|
N_("Copy the current line and store it in the cutbuffer");
|
2006-07-05 18:42:22 +00:00
|
|
|
const char *nano_indent_msg = N_("Indent the current line");
|
|
|
|
const char *nano_unindent_msg = N_("Unindent the current line");
|
2008-07-10 20:13:04 +00:00
|
|
|
const char *nano_undo_msg = N_("Undo the last operation");
|
|
|
|
const char *nano_redo_msg = N_("Redo the last undone operation");
|
2004-11-01 22:54:40 +00:00
|
|
|
#endif
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_forward_msg = N_("Go forward one character");
|
|
|
|
const char *nano_back_msg = N_("Go back one character");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_nextword_msg = N_("Go forward one word");
|
|
|
|
const char *nano_prevword_msg = N_("Go back one word");
|
2004-08-07 21:27:37 +00:00
|
|
|
#endif
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_prevline_msg = N_("Go to previous line");
|
|
|
|
const char *nano_nextline_msg = N_("Go to next line");
|
|
|
|
const char *nano_home_msg = N_("Go to beginning of current line");
|
|
|
|
const char *nano_end_msg = N_("Go to end of current line");
|
2004-09-11 21:41:13 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
const char *nano_parabegin_msg =
|
2007-02-01 13:40:59 +00:00
|
|
|
N_("Go to beginning of paragraph; then of previous paragraph");
|
2004-09-11 21:41:13 +00:00
|
|
|
const char *nano_paraend_msg =
|
2007-02-01 13:40:59 +00:00
|
|
|
N_("Go just beyond end of paragraph; then of next paragraph");
|
2006-04-24 21:14:55 +00:00
|
|
|
#endif
|
|
|
|
const char *nano_firstline_msg =
|
2007-02-01 13:40:59 +00:00
|
|
|
N_("Go to the first line of the file");
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_lastline_msg =
|
2007-02-01 13:40:59 +00:00
|
|
|
N_("Go to the last line of the file");
|
2006-04-24 21:14:55 +00:00
|
|
|
#ifndef NANO_TINY
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_bracket_msg = N_("Go to the matching bracket");
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_scrollup_msg =
|
|
|
|
N_("Scroll up one line without scrolling the cursor");
|
|
|
|
const char *nano_scrolldown_msg =
|
|
|
|
N_("Scroll down one line without scrolling the cursor");
|
2004-09-11 21:41:13 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2005-07-08 20:09:16 +00:00
|
|
|
const char *nano_prevfile_msg =
|
2005-06-06 18:38:16 +00:00
|
|
|
N_("Switch to the previous file buffer");
|
2005-07-08 20:09:16 +00:00
|
|
|
const char *nano_nextfile_msg =
|
2005-06-06 18:38:16 +00:00
|
|
|
N_("Switch to the next file buffer");
|
2004-09-11 21:41:13 +00:00
|
|
|
#endif
|
2006-04-23 19:21:12 +00:00
|
|
|
const char *nano_verbatim_msg =
|
2006-04-24 21:00:17 +00:00
|
|
|
N_("Insert the next keystroke verbatim");
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_tab_msg =
|
2006-04-29 13:59:04 +00:00
|
|
|
N_("Insert a tab at the cursor position");
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_enter_msg =
|
2006-04-27 23:39:49 +00:00
|
|
|
N_("Insert a newline at the cursor position");
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_delete_msg =
|
|
|
|
N_("Delete the character under the cursor");
|
|
|
|
const char *nano_backspace_msg =
|
|
|
|
N_("Delete the character to the left of the cursor");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2005-01-01 07:43:32 +00:00
|
|
|
const char *nano_cut_till_end_msg =
|
|
|
|
N_("Cut from the cursor position to the end of the file");
|
|
|
|
#endif
|
2004-09-11 21:41:13 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
2004-07-12 03:10:30 +00:00
|
|
|
#endif
|
2005-11-15 23:45:29 +00:00
|
|
|
#ifndef NANO_TINY
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_wordcount_msg =
|
|
|
|
N_("Count the number of words, lines, and characters");
|
2004-08-07 21:27:37 +00:00
|
|
|
#endif
|
2006-04-24 21:14:55 +00:00
|
|
|
const char *nano_refresh_msg =
|
|
|
|
N_("Refresh (redraw) the current screen");
|
2008-03-13 08:23:52 +00:00
|
|
|
const char *nano_suspend_msg =
|
|
|
|
N_("Suspend the editor (if suspend is enabled)");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_case_msg =
|
2006-06-08 02:37:45 +00:00
|
|
|
N_("Toggle the case sensitivity of the search");
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_reverse_msg =
|
2006-06-08 02:37:45 +00:00
|
|
|
N_("Reverse the direction of the search");
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2004-07-12 03:10:30 +00:00
|
|
|
#ifdef HAVE_REGEX_H
|
2006-06-08 02:37:45 +00:00
|
|
|
const char *nano_regexp_msg =
|
|
|
|
N_("Toggle the use of regular expressions");
|
2002-09-06 20:35:28 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2006-05-24 19:48:03 +00:00
|
|
|
const char *nano_prev_history_msg =
|
2006-07-31 01:30:31 +00:00
|
|
|
N_("Recall the previous search/replace string");
|
2006-05-24 19:48:03 +00:00
|
|
|
const char *nano_next_history_msg =
|
2006-07-31 01:30:31 +00:00
|
|
|
N_("Recall the next search/replace string");
|
2008-07-10 20:13:04 +00:00
|
|
|
const char *nano_prev_undo_msg =
|
|
|
|
N_("Recall the previous undo action");
|
|
|
|
const char *nano_next_undo_msg =
|
|
|
|
N_("Recall the next undo action");
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2004-07-12 03:10:30 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
|
|
|
const char *nano_tofiles_msg = N_("Go to file browser");
|
2002-04-06 05:02:14 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2006-06-08 02:37:45 +00:00
|
|
|
const char *nano_dos_msg = N_("Toggle the use of DOS format");
|
|
|
|
const char *nano_mac_msg = N_("Toggle the use of Mac format");
|
2001-09-28 19:53:11 +00:00
|
|
|
#endif
|
2006-06-08 02:37:45 +00:00
|
|
|
const char *nano_append_msg = N_("Toggle appending");
|
|
|
|
const char *nano_prepend_msg = N_("Toggle prepending");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_backup_msg =
|
2006-06-08 02:37:45 +00:00
|
|
|
N_("Toggle backing up of the original file");
|
2004-07-12 03:10:30 +00:00
|
|
|
const char *nano_execute_msg = N_("Execute external command");
|
2001-09-28 19:53:11 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER)
|
2006-06-08 02:37:45 +00:00
|
|
|
const char *nano_multibuffer_msg =
|
|
|
|
N_("Toggle the use of a new buffer");
|
2004-07-12 03:10:30 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_BROWSER
|
2004-07-23 12:51:40 +00:00
|
|
|
const char *nano_exitbrowser_msg = N_("Exit from the file browser");
|
2006-03-30 07:03:04 +00:00
|
|
|
const char *nano_firstfile_msg =
|
|
|
|
N_("Go to the first file in the list");
|
|
|
|
const char *nano_lastfile_msg =
|
|
|
|
N_("Go to the last file in the list");
|
2004-07-23 12:51:40 +00:00
|
|
|
const char *nano_gotodir_msg = N_("Go to directory");
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2002-04-23 10:56:06 +00:00
|
|
|
#endif /* !DISABLE_HELP */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2004-03-02 22:52:57 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-13 08:23:52 +00:00
|
|
|
#define IFSCHELP(help) help
|
2004-03-02 22:52:57 +00:00
|
|
|
#else
|
2008-03-13 08:23:52 +00:00
|
|
|
#define IFSCHELP(help) ""
|
2002-04-23 10:56:06 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
while (allfuncs != NULL) {
|
|
|
|
subnfunc *f = allfuncs;
|
|
|
|
allfuncs = (allfuncs)->next;
|
|
|
|
free(f);
|
|
|
|
}
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_help_void, MALL, get_help_msg, nano_help_msg,
|
|
|
|
FALSE, VIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) cancel_msg,
|
2008-03-19 02:32:48 +00:00
|
|
|
(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO),
|
2008-03-13 08:23:52 +00:00
|
|
|
cancel_msg, IFSCHELP(nano_cancel_msg), FALSE, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
add_to_funcs(do_exit, MMAIN,
|
2004-11-25 04:39:07 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2006-04-09 18:27:42 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2006-03-24 05:28:03 +00:00
|
|
|
openfile != NULL && openfile != openfile->next ? N_("Close") :
|
2001-07-11 02:08:33 +00:00
|
|
|
#endif
|
2008-03-13 08:23:52 +00:00
|
|
|
exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-20 04:45:55 +00:00
|
|
|
add_to_funcs(do_exit, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
|
|
|
|
2008-03-20 04:51:26 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2008-03-20 04:45:55 +00:00
|
|
|
add_to_funcs(do_exit, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW);
|
2008-03-20 04:51:26 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2006-04-09 18:27:42 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"),
|
2008-03-13 08:23:52 +00:00
|
|
|
IFSCHELP(nano_writeout_msg), FALSE, NOVIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2004-06-29 00:43:56 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-05 07:34:01 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
|
|
|
add_to_funcs(do_justify_void, MMAIN, N_("Justify"),
|
|
|
|
nano_justify_msg, TRUE, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2001-02-11 19:05:05 +00:00
|
|
|
|
2004-05-29 01:20:17 +00:00
|
|
|
/* We allow inserting files in view mode if multibuffers are
|
2005-12-08 07:09:08 +00:00
|
|
|
* available, so that we can view multiple files. If we're using
|
|
|
|
* restricted mode, inserting files is disabled, since it allows
|
|
|
|
* reading from or writing to files not specified on the command
|
|
|
|
* line. */
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(!ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg,
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-13 08:23:52 +00:00
|
|
|
MMAIN, N_("Read File"), IFSCHELP(nano_insert_msg), FALSE,
|
2002-01-02 15:12:21 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2008-03-05 07:34:01 +00:00
|
|
|
VIEW);
|
2002-01-02 15:12:21 +00:00
|
|
|
#else
|
2008-03-05 07:34:01 +00:00
|
|
|
NOVIEW);
|
2002-01-02 15:12:21 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_search, MMAIN|MBROWSER, whereis_msg,
|
2008-03-13 08:23:52 +00:00
|
|
|
IFSCHELP(nano_whereis_msg), FALSE, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_page_up, MMAIN|MHELP,
|
2008-03-13 08:23:52 +00:00
|
|
|
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_page_down, MMAIN|MHELP,
|
2008-03-13 08:23:52 +00:00
|
|
|
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-07-10 20:13:04 +00:00
|
|
|
|
2006-04-09 18:27:42 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_cut_text_void, MMAIN, N_("Cut Text"), IFSCHELP(nano_cut_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2000-11-27 22:58:23 +00:00
|
|
|
if (unjustify)
|
2006-07-03 18:40:53 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_uncut_text, MMAIN, N_("UnJustify"), "",
|
|
|
|
FALSE, NOVIEW);
|
|
|
|
|
2000-11-27 22:58:23 +00:00
|
|
|
else
|
2006-07-03 18:40:53 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_uncut_text, MMAIN, N_("UnCut Text"), IFSCHELP(nano_uncut_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, VIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2004-05-29 01:20:17 +00:00
|
|
|
/* If we're using restricted mode, spell checking is disabled
|
|
|
|
* because it allows reading from or writing to files not specified
|
|
|
|
* on the command line. */
|
2004-04-30 04:49:02 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2008-03-05 07:34:01 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_spell, MMAIN, N_("To Spell"), nano_spell_msg,
|
|
|
|
TRUE, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_first_line,
|
|
|
|
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
2008-03-18 03:06:27 +00:00
|
|
|
first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_last_line,
|
|
|
|
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
2008-03-13 08:23:52 +00:00
|
|
|
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2006-04-27 23:39:49 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, (MMAIN|MWHEREIS),
|
2008-03-13 08:23:52 +00:00
|
|
|
go_to_line_msg, IFSCHELP(nano_gotoline_msg), FALSE, VIEW);
|
2006-04-28 13:19:56 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
#ifdef NANO_TINY
|
2008-03-18 03:06:27 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN, N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg),
|
2008-03-09 02:52:40 +00:00
|
|
|
FALSE, VIEW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_replace, (MMAIN|MWHEREIS), replace_msg, IFSCHELP(nano_replace_msg),
|
2006-04-28 13:19:56 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
FALSE,
|
|
|
|
#else
|
|
|
|
TRUE,
|
2006-04-19 14:09:01 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
NOVIEW);
|
2006-04-19 14:09:01 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2002-06-21 03:20:06 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_mark, MMAIN, N_("Mark Text"),
|
|
|
|
nano_mark_msg, FALSE, VIEW);
|
2005-06-12 22:31:03 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_research, (MMAIN|MBROWSER), whereis_next_msg,
|
|
|
|
nano_whereis_next_msg, TRUE, VIEW);
|
2005-10-24 02:12:09 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_copy_text, MMAIN, N_("Copy Text"),
|
|
|
|
nano_copy_msg, FALSE, NOVIEW);
|
2005-10-24 02:12:09 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_indent_void, MMAIN, N_("Indent Text"),
|
|
|
|
nano_indent_msg, FALSE, NOVIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_unindent, MMAIN, N_("Unindent Text"),
|
2008-07-10 20:13:04 +00:00
|
|
|
nano_unindent_msg, FALSE, NOVIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_undo, MMAIN, N_("Undo"),
|
|
|
|
nano_undo_msg, FALSE, NOVIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_redo, MMAIN, N_("Redo"),
|
|
|
|
nano_redo_msg, TRUE, NOVIEW);
|
2003-08-23 21:11:06 +00:00
|
|
|
|
2004-09-11 21:41:13 +00:00
|
|
|
#endif
|
2003-08-23 21:11:06 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_page_up, MBROWSER,
|
2008-03-13 08:23:52 +00:00
|
|
|
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_page_down, MBROWSER,
|
2008-03-13 08:23:52 +00:00
|
|
|
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
|
2006-04-21 02:05:09 +00:00
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_right, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, VIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_funcs(do_right, MALL, "", "", FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_left, (MMAIN|MBROWSER), N_("Back"), IFSCHELP(nano_back_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, VIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_funcs(do_left, MALL, "", "", FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_next_word_void, MMAIN, N_("Next Word"),
|
|
|
|
nano_nextword_msg, FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_prev_word_void, MMAIN, N_("Prev Word"),
|
|
|
|
nano_prevword_msg, FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
#endif
|
2006-04-21 02:05:09 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_up_void, (MMAIN|MHELP|MBROWSER), N_("Prev Line"),
|
2008-03-13 08:23:52 +00:00
|
|
|
IFSCHELP(nano_prevline_msg), FALSE, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_funcs(do_down_void, (MMAIN|MHELP|MBROWSER), N_("Next Line"),
|
2008-03-13 08:23:52 +00:00
|
|
|
IFSCHELP(nano_nextline_msg), TRUE, VIEW);
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_home, MMAIN, N_("Home"), IFSCHELP(nano_home_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, VIEW);
|
2004-09-11 21:41:13 +00:00
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_end, MMAIN, N_("End"), IFSCHELP(nano_end_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
add_to_funcs(do_para_begin_void, (MMAIN|MWHEREIS), beg_of_par_msg,
|
|
|
|
nano_parabegin_msg, FALSE, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_para_end_void, (MMAIN|MWHEREIS), end_of_par_msg,
|
|
|
|
nano_paraend_msg, FALSE, VIEW);
|
2006-04-24 20:50:52 +00:00
|
|
|
#endif
|
2005-01-01 07:43:32 +00:00
|
|
|
|
2006-04-23 19:15:15 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_find_bracket, MMAIN, _("Find Other Bracket"),
|
|
|
|
nano_bracket_msg, FALSE, VIEW);
|
2006-04-23 19:15:15 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_scroll_up, MMAIN, N_("Scroll Up"),
|
|
|
|
nano_scrollup_msg, FALSE, VIEW);
|
2004-09-11 21:41:13 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_scroll_down, MMAIN, N_("Scroll Down"),
|
|
|
|
nano_scrolldown_msg, FALSE, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
add_to_funcs(switch_to_prev_buffer_void, MMAIN, _("Previous File"),
|
2008-03-31 06:25:14 +00:00
|
|
|
IFSCHELP(nano_prevfile_msg), FALSE, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(switch_to_next_buffer_void, MMAIN, N_("Next File"),
|
2008-03-31 06:25:14 +00:00
|
|
|
IFSCHELP(nano_nextfile_msg), TRUE, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
add_to_funcs(do_verbatim_input, MMAIN, N_("Verbatim Input"),
|
2008-03-13 08:23:52 +00:00
|
|
|
IFSCHELP(nano_verbatim_msg), FALSE, NOVIEW);
|
2008-03-17 05:50:04 +00:00
|
|
|
add_to_funcs(do_verbatim_input, MWHEREIS|MREPLACE|MREPLACE2|MEXTCMD|MSPELL,
|
|
|
|
"", "", FALSE, NOVIEW);
|
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_tab, MMAIN, N_("Tab"), IFSCHELP(nano_tab_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, NOVIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_funcs(do_tab, MALL, "", "", FALSE, NOVIEW);
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_enter, MMAIN, N_("Enter"), IFSCHELP(nano_enter_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, NOVIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_funcs(do_enter, MALL, "", "", FALSE, NOVIEW);
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_delete, MMAIN, N_("Delete"), IFSCHELP(nano_delete_msg),
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE, NOVIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_funcs(do_delete, MALL, "", "", FALSE, NOVIEW);
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(do_backspace, MMAIN, N_("Backspace"), IFSCHELP(nano_backspace_msg),
|
2006-04-22 20:00:23 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
FALSE,
|
2006-04-22 20:00:23 +00:00
|
|
|
#else
|
2008-03-05 07:34:01 +00:00
|
|
|
TRUE,
|
2006-04-22 20:00:23 +00:00
|
|
|
#endif
|
2008-03-12 04:44:14 +00:00
|
|
|
NOVIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_backspace, MALL, "", "",
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
FALSE,
|
|
|
|
#else
|
|
|
|
TRUE,
|
|
|
|
#endif
|
|
|
|
NOVIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_cut_till_end, MMAIN, N_("CutTillEnd"),
|
|
|
|
nano_cut_till_end_msg, TRUE, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(xon_complaint, MMAIN, "", "", FALSE, VIEW);
|
|
|
|
add_to_funcs(xoff_complaint, MMAIN, "", "", FALSE, VIEW);
|
2000-06-29 01:30:04 +00:00
|
|
|
|
2003-09-04 20:25:29 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_full_justify, (MMAIN|MWHEREIS), fulljstify_msg,
|
|
|
|
nano_fulljustify_msg, FALSE, NOVIEW);
|
2003-09-04 20:25:29 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs(do_wordlinechar_count, MMAIN, N_("Word Count"),
|
|
|
|
nano_wordcount_msg, FALSE, VIEW);
|
2001-06-14 02:54:22 +00:00
|
|
|
#endif
|
2003-01-05 20:41:21 +00:00
|
|
|
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg,
|
|
|
|
IFSCHELP(nano_refresh_msg), FALSE, VIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_suspend_void, MMAIN, suspend_msg,
|
|
|
|
IFSCHELP(nano_suspend_msg), TRUE, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) case_sens_msg,
|
|
|
|
(MWHEREIS|MREPLACE|MWHEREISFILE),
|
|
|
|
case_sens_msg, nano_case_msg, FALSE, VIEW);
|
2001-06-14 02:54:22 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) backwards_msg,
|
|
|
|
(MWHEREIS|MREPLACE|MWHEREISFILE),
|
|
|
|
backwards_msg, nano_reverse_msg, FALSE, VIEW);
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2000-10-31 05:10:10 +00:00
|
|
|
|
2001-06-14 02:54:22 +00:00
|
|
|
#ifdef HAVE_REGEX_H
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) regexp_msg,
|
|
|
|
(MWHEREIS|MREPLACE|MWHEREISFILE),
|
2008-03-13 08:23:52 +00:00
|
|
|
regexp_msg, IFSCHELP(nano_regexp_msg), FALSE, VIEW);
|
2001-06-14 02:54:22 +00:00
|
|
|
#endif
|
2003-01-05 20:41:21 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) prev_history_msg,
|
|
|
|
(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE),
|
|
|
|
prev_history_msg, nano_prev_history_msg, FALSE, VIEW);
|
2006-05-24 19:48:03 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) next_history_msg,
|
|
|
|
(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE),
|
|
|
|
next_history_msg, nano_next_history_msg, FALSE, VIEW);
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2001-07-16 00:48:53 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) no_replace_msg, MREPLACE,
|
2008-03-13 08:23:52 +00:00
|
|
|
no_replace_msg, IFSCHELP(nano_whereis_msg), FALSE, VIEW);
|
2000-10-31 05:10:10 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) gototext_msg, MGOTOLINE,
|
2008-03-14 04:08:51 +00:00
|
|
|
gototext_msg, IFSCHELP(nano_whereis_msg), TRUE, VIEW);
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2001-01-12 07:51:05 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) to_files_msg,
|
|
|
|
(MGOTOLINE|MINSERTFILE),
|
|
|
|
to_files_msg, nano_tofiles_msg, FALSE, VIEW);
|
2001-01-03 07:11:47 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2004-05-29 01:20:17 +00:00
|
|
|
/* If we're using restricted mode, the DOS format, Mac format,
|
|
|
|
* append, prepend, and backup toggles are disabled. The first and
|
|
|
|
* second are useless since inserting files is disabled, the third
|
|
|
|
* and fourth are disabled because they allow writing to files not
|
|
|
|
* specified on the command line, and the fifth is useless since
|
|
|
|
* backups are disabled. */
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) dos_format_msg, MWRITEFILE,
|
|
|
|
dos_format_msg, nano_dos_msg, FALSE, NOVIEW);
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) mac_format_msg, MWRITEFILE,
|
|
|
|
mac_format_msg, nano_mac_msg, FALSE, NOVIEW);
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) append_msg, MWRITEFILE,
|
|
|
|
append_msg, nano_append_msg, FALSE, NOVIEW);
|
2001-05-29 04:21:44 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) prepend_msg, MWRITEFILE,
|
|
|
|
prepend_msg, nano_prepend_msg, FALSE, NOVIEW);
|
2002-04-16 03:15:47 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) backup_file_msg, MWRITEFILE,
|
|
|
|
backup_file_msg, nano_backup_msg, FALSE, NOVIEW);
|
2001-05-29 04:21:44 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2004-05-29 01:20:17 +00:00
|
|
|
/* If we're using restricted mode, command execution is disabled.
|
|
|
|
* It's useless since inserting files is disabled. */
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) ext_cmd_msg, MINSERTFILE,
|
|
|
|
ext_cmd_msg, nano_execute_msg, FALSE, NOVIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2002-09-03 22:58:40 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2004-05-29 01:20:17 +00:00
|
|
|
/* If we're using restricted mode, the multibuffer toggle is
|
|
|
|
* disabled. It's useless since inserting files is disabled. */
|
2004-04-30 04:49:02 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2008-03-14 04:08:51 +00:00
|
|
|
add_to_funcs((void *) new_buffer_msg, MINSERTFILE,
|
2008-03-05 07:34:01 +00:00
|
|
|
new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW);
|
2002-09-03 22:58:40 +00:00
|
|
|
#endif
|
2001-05-29 04:21:44 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) insert_file_msg, MEXTCMD,
|
2008-03-13 08:23:52 +00:00
|
|
|
insert_file_msg, IFSCHELP(nano_insert_msg), FALSE, VIEW);
|
2004-09-30 22:07:21 +00:00
|
|
|
|
2004-09-28 22:21:46 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) new_buffer_msg, MEXTCMD,
|
|
|
|
new_buffer_msg, nano_multibuffer_msg, FALSE, NOVIEW);
|
2002-03-21 05:07:28 +00:00
|
|
|
#endif
|
2004-09-28 22:21:46 +00:00
|
|
|
#endif
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) refresh_msg, MHELP,
|
|
|
|
refresh_msg, nano_refresh_msg, FALSE, VIEW);
|
2005-12-08 07:09:08 +00:00
|
|
|
#endif
|
|
|
|
|
2001-01-12 07:51:05 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2006-05-06 15:07:26 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) first_file_msg,
|
|
|
|
(MBROWSER|MWHEREISFILE),
|
|
|
|
first_file_msg, nano_firstfile_msg, FALSE, VIEW);
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) last_file_msg,
|
|
|
|
(MBROWSER|MWHEREISFILE),
|
|
|
|
last_file_msg, nano_lastfile_msg, FALSE, VIEW);
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_funcs((void *) goto_dir_msg, MBROWSER,
|
|
|
|
goto_dir_msg, nano_gotodir_msg, FALSE, VIEW);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
currmenu = MMAIN;
|
2006-03-30 07:03:04 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_sclist(MALL, "^G", do_help_void, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "F1", do_help_void, 0, TRUE);
|
|
|
|
#endif
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", do_exit, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", do_exit, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^O", do_writeout_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F3", do_writeout_void, 0, TRUE);
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^J", do_justify_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F4", do_justify_void, 0, TRUE);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^R", do_insertfile_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F5", do_insertfile_void, 0, TRUE);
|
2008-03-11 03:03:53 +00:00
|
|
|
add_to_sclist(MMAIN, "kinsert", do_insertfile_void, 0, TRUE);
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^W", do_search, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "F6", do_search, 0, TRUE);
|
2008-03-11 03:03:53 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^Y", do_page_up, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F7", do_page_up, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpup", do_page_up, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "^V", do_page_down, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "F8", do_page_down, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE, "kpdown", do_page_down, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^K", do_cut_text_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F9", do_cut_text_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^U", do_uncut_text, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F10", do_uncut_text, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F11", do_cursorpos_void, 0, TRUE);
|
2008-05-31 22:49:55 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", do_spell, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F12", do_spell, 0, TRUE);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^\\", do_replace, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F14", do_replace, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-R", do_replace, 0, TRUE);
|
|
|
|
add_to_sclist(MWHEREIS, "^R", do_replace, 0, FALSE);
|
|
|
|
add_to_sclist(MREPLACE, "^R", (void *) no_replace_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS, "^T", do_gotolinecolumn_void, 0, TRUE);
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_sclist(MMAIN, "^^", do_mark, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "F15", do_mark, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-A", do_mark, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "M-W", do_research, 0, TRUE);
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_sclist(MALL, "F16", do_research, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "M-^", do_copy_text, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-6", do_copy_text, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-}", do_indent_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-{", do_unindent, 0, TRUE);
|
2008-07-10 20:13:04 +00:00
|
|
|
add_to_sclist(MMAIN, "M-U", do_undo, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-E", do_redo, 0, TRUE);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_sclist(MALL, "^F", do_right, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "^B", do_left, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^Space", do_next_word_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-Space", do_prev_word_void, 0, TRUE);
|
|
|
|
#endif
|
2008-06-03 05:55:04 +00:00
|
|
|
add_to_sclist(MALL, "kright", do_right, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "kleft", do_left, 0, TRUE);
|
2008-03-12 04:44:14 +00:00
|
|
|
add_to_sclist(MMAIN, "^Q", xon_complaint, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^S", xoff_complaint, 0, TRUE);
|
2008-06-03 08:09:05 +00:00
|
|
|
add_to_sclist(MMAIN, "^P", do_up_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "kup", do_up_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "^N", do_down_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "kdown", do_down_void, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MALL, "^A", do_home, 0, TRUE);
|
2008-03-11 03:03:53 +00:00
|
|
|
add_to_sclist(MALL, "khome", do_home, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MALL, "^E", do_end, 0, TRUE);
|
2008-03-11 03:03:53 +00:00
|
|
|
add_to_sclist(MALL, "kend", do_end, 0, TRUE);
|
2008-06-03 08:09:05 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", (void *) prev_history_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", (void *) prev_history_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", (void *) next_history_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", (void *) next_history_msg, 0, FALSE);
|
|
|
|
#endif
|
2008-06-29 06:22:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
|
|
|
"^W", do_para_begin_void, 0, TRUE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
|
|
|
"^O", do_para_end_void, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "M-(", do_para_begin_void, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "M-9", do_para_begin_void, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "M-)", do_para_end_void, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "M-0", do_para_end_void, 0, TRUE);
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MWHEREIS,
|
|
|
|
"M-C", (void *) case_sens_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MREPLACE,
|
|
|
|
"M-C", (void *) case_sens_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MREPLACE2,
|
|
|
|
"M-C", (void *) case_sens_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
|
|
|
"M-B", (void *) backwards_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
|
|
|
"M-R", (void *) regexp_msg, 0, FALSE);
|
|
|
|
|
|
|
|
add_to_sclist(MMAIN, "M-\\", do_first_line, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-|", do_first_line, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-/", do_last_line, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-?", do_last_line, 0, TRUE);
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP,
|
|
|
|
"^Y", do_first_line, 0, TRUE);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP,
|
|
|
|
"^V", do_last_line, 0, TRUE);
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", (void *) first_file_msg, 0, TRUE);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", (void *) first_file_msg, 0, TRUE);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", (void *) last_file_msg, 0, TRUE);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", (void *) last_file_msg, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-20 04:57:46 +00:00
|
|
|
add_to_sclist(MMAIN, "M-]", do_find_bracket, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "M--", do_scroll_up, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-_", do_scroll_up, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-+", do_scroll_down, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-=", do_scroll_down, 0, TRUE);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
add_to_sclist(MMAIN, "M-<", switch_to_prev_buffer_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-,", switch_to_prev_buffer_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M->", switch_to_next_buffer_void, 0, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-.", switch_to_next_buffer_void, 0, TRUE);
|
|
|
|
#endif
|
2008-03-17 05:50:04 +00:00
|
|
|
add_to_sclist(MALL, "M-V", do_verbatim_input, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-09 02:52:40 +00:00
|
|
|
add_to_sclist(MALL, "M-T", do_cut_till_end, 0, TRUE);
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MALL, "M-J", do_full_justify, 0, TRUE);
|
2008-03-16 12:55:41 +00:00
|
|
|
#endif
|
2008-03-14 04:08:51 +00:00
|
|
|
add_to_sclist(MMAIN, "M-D", do_wordlinechar_count, 0, TRUE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "M-X", do_toggle, NO_HELP, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-C", do_toggle, CONST_UPDATE, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-O", do_toggle, MORE_SPACE, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-S", do_toggle, SMOOTH_SCROLL, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-P", do_toggle, WHITESPACE_DISPLAY, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-Y", do_toggle, NO_COLOR_SYNTAX, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-H", do_toggle, SMART_HOME, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-I", do_toggle, AUTOINDENT, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-K", do_toggle, CUT_TO_END, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-L", do_toggle, NO_WRAP, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-Q", do_toggle, TABS_TO_SPACES, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-B", do_toggle, BACKUP_FILE, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-F", do_toggle, MULTIBUFFER, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-M", do_toggle, USE_MOUSE, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-N", do_toggle, NO_CONVERT, TRUE);
|
|
|
|
add_to_sclist(MMAIN, "M-Z", do_toggle, SUSPEND, TRUE);
|
|
|
|
#endif
|
2008-03-14 04:08:51 +00:00
|
|
|
add_to_sclist(MGOTOLINE, "^T", (void *) gototext_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", (void *) new_buffer_msg, 0, FALSE);
|
2008-03-19 02:32:48 +00:00
|
|
|
add_to_sclist((MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO),
|
2008-03-05 07:34:01 +00:00
|
|
|
"^C", (void *) cancel_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MHELP, "^X", do_exit, 0, TRUE);
|
|
|
|
add_to_sclist(MHELP, "F2", do_exit, 0, TRUE);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-D", (void *) dos_format_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-M", (void *) mac_format_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-A", (void *) append_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-P", (void *) prepend_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-B", (void *) backup_file_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MWRITEFILE, "^T", (void *) to_files_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MINSERTFILE, "^T", (void *) to_files_msg, 0, FALSE);
|
|
|
|
add_to_sclist(MINSERTFILE, "^X", (void *) ext_cmd_msg, 0, FALSE);
|
2008-03-13 08:23:52 +00:00
|
|
|
add_to_sclist(MMAIN, "^Z", do_suspend_void, 0, FALSE);
|
2008-03-05 07:34:01 +00:00
|
|
|
add_to_sclist(MMAIN, "^L", total_refresh, 0, TRUE);
|
2008-03-14 04:08:51 +00:00
|
|
|
add_to_sclist(MALL, "^I", do_tab, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "^M", do_enter, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "kenter", do_enter, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "^D", do_delete, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "kdel", do_delete, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "^H", do_backspace, 0, TRUE);
|
|
|
|
add_to_sclist(MALL, "kbsp", do_backspace, 0, TRUE);
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
print_sclist();
|
2001-01-03 07:11:47 +00:00
|
|
|
#endif
|
|
|
|
|
2002-04-23 10:56:06 +00:00
|
|
|
}
|
2002-02-27 04:14:16 +00:00
|
|
|
|
2006-04-19 13:36:56 +00:00
|
|
|
/* Free the given shortcut. */
|
2004-07-12 03:10:30 +00:00
|
|
|
void free_shortcutage(shortcut **shortcutage)
|
|
|
|
{
|
|
|
|
assert(shortcutage != NULL);
|
2005-06-06 18:41:17 +00:00
|
|
|
|
2004-07-12 03:10:30 +00:00
|
|
|
while (*shortcutage != NULL) {
|
|
|
|
shortcut *ps = *shortcutage;
|
|
|
|
*shortcutage = (*shortcutage)->next;
|
|
|
|
free(ps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
const subnfunc *sctofunc(sc *s)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2008-03-05 07:34:01 +00:00
|
|
|
subnfunc *f;
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next)
|
|
|
|
;
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
return f;
|
2004-07-12 03:10:30 +00:00
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
/* Now lets come up with a single (hopefully)
|
|
|
|
function to get a string for each flag */
|
|
|
|
char *flagtostr(int flag)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2008-03-05 07:34:01 +00:00
|
|
|
switch (flag) {
|
|
|
|
case NO_HELP:
|
|
|
|
return N_("Help mode");
|
|
|
|
case CONST_UPDATE:
|
|
|
|
return N_("Constant cursor position display");
|
|
|
|
case MORE_SPACE:
|
|
|
|
return N_("Use of one more line for editing");
|
|
|
|
case SMOOTH_SCROLL:
|
|
|
|
return N_("Smooth scrolling");
|
|
|
|
case WHITESPACE_DISPLAY:
|
|
|
|
return N_("Whitespace display");
|
|
|
|
case NO_COLOR_SYNTAX:
|
|
|
|
return N_("Color syntax highlighting");
|
|
|
|
case SMART_HOME:
|
|
|
|
return N_("Smart home key");
|
|
|
|
case AUTOINDENT:
|
|
|
|
return N_("Auto indent");
|
|
|
|
case CUT_TO_END:
|
|
|
|
return N_("Cut to end");
|
|
|
|
case NO_WRAP:
|
|
|
|
return N_("Long line wrapping");
|
|
|
|
case TABS_TO_SPACES:
|
|
|
|
return N_("Conversion of typed tabs to spaces");
|
|
|
|
case BACKUP_FILE:
|
|
|
|
return N_("Backup files");
|
|
|
|
case MULTIBUFFER:
|
|
|
|
return N_("Multiple file buffers");
|
|
|
|
case USE_MOUSE:
|
|
|
|
return N_("Mouse support");
|
|
|
|
case NO_CONVERT:
|
|
|
|
return N_("No conversion from DOS/Mac format");
|
|
|
|
case SUSPEND:
|
|
|
|
return N_("Suspension");
|
|
|
|
default:
|
|
|
|
return "?????";
|
|
|
|
}
|
|
|
|
}
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif /* NANO_TINY */
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
/* Interpret the string given by the rc file and return a
|
|
|
|
shortcut struct, complete with proper value for execute */
|
|
|
|
sc *strtosc(int menu, char *input)
|
|
|
|
{
|
|
|
|
sc *s;
|
|
|
|
|
|
|
|
s = (sc *)nmalloc(sizeof(sc));
|
|
|
|
s->execute = TRUE; /* overridden as needed below */
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
if (!strcasecmp(input, "help"))
|
|
|
|
s->scfunc = do_help_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (!strcasecmp(input, "cancel")) {
|
2008-03-05 07:34:01 +00:00
|
|
|
s->scfunc = (void *) cancel_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "exit"))
|
|
|
|
s->scfunc = do_exit;
|
|
|
|
else if (!strcasecmp(input, "writeout"))
|
|
|
|
s->scfunc = do_writeout_void;
|
|
|
|
else if (!strcasecmp(input, "insert"))
|
|
|
|
s->scfunc = do_insertfile_void;
|
|
|
|
else if (!strcasecmp(input, "whereis"))
|
|
|
|
s->scfunc = do_search;
|
|
|
|
else if (!strcasecmp(input, "up"))
|
2008-03-11 03:03:53 +00:00
|
|
|
s->scfunc = do_up_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "down"))
|
2008-03-11 03:03:53 +00:00
|
|
|
s->scfunc = do_down_void;
|
|
|
|
else if (!strcasecmp(input, "pageup")
|
|
|
|
|| !strcasecmp(input, "prevpage"))
|
|
|
|
s->scfunc = do_page_up;
|
|
|
|
else if (!strcasecmp(input, "pagedown")
|
|
|
|
|| !strcasecmp(input, "nextpage"))
|
2008-03-05 07:34:01 +00:00
|
|
|
s->scfunc = do_page_down;
|
|
|
|
else if (!strcasecmp(input, "cut"))
|
|
|
|
s->scfunc = do_cut_text_void;
|
|
|
|
else if (!strcasecmp(input, "uncut"))
|
|
|
|
s->scfunc = do_uncut_text;
|
|
|
|
else if (!strcasecmp(input, "curpos") ||
|
|
|
|
!strcasecmp(input, "cursorpos"))
|
|
|
|
s->scfunc = do_cursorpos_void;
|
|
|
|
else if (!strcasecmp(input, "firstline"))
|
|
|
|
s->scfunc = do_first_line;
|
|
|
|
else if (!strcasecmp(input, "lastline"))
|
|
|
|
s->scfunc = do_last_line;
|
|
|
|
else if (!strcasecmp(input, "gotoline"))
|
|
|
|
s->scfunc = do_gotolinecolumn_void;
|
|
|
|
else if (!strcasecmp(input, "replace"))
|
|
|
|
s->scfunc = do_replace;
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "justify"))
|
|
|
|
s->scfunc = do_justify_void;
|
2008-03-16 12:55:41 +00:00
|
|
|
else if (!strcasecmp(input, "beginpara"))
|
|
|
|
s->scfunc = do_para_begin_void;
|
|
|
|
else if (!strcasecmp(input, "endpara"))
|
|
|
|
s->scfunc = do_para_end_void;
|
|
|
|
else if (!strcasecmp(input, "fulljustify"))
|
|
|
|
s->scfunc = do_full_justify;
|
|
|
|
#endif
|
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "mark"))
|
|
|
|
s->scfunc = do_mark;
|
|
|
|
else if (!strcasecmp(input, "searchagain") ||
|
|
|
|
!strcasecmp(input, "research"))
|
|
|
|
s->scfunc = do_research;
|
|
|
|
else if (!strcasecmp(input, "copytext"))
|
|
|
|
s->scfunc = do_copy_text;
|
|
|
|
else if (!strcasecmp(input, "indent"))
|
|
|
|
s->scfunc = do_indent_void;
|
|
|
|
else if (!strcasecmp(input, "unindent"))
|
|
|
|
s->scfunc = do_unindent;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "scrollup"))
|
|
|
|
s->scfunc = do_scroll_up;
|
|
|
|
else if (!strcasecmp(input, "scrolldown"))
|
|
|
|
s->scfunc = do_scroll_down;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "nextword"))
|
|
|
|
s->scfunc = do_next_word_void;
|
2008-03-13 08:23:52 +00:00
|
|
|
else if (!strcasecmp(input, "suspend"))
|
|
|
|
s->scfunc = do_suspend_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "prevword"))
|
|
|
|
s->scfunc = do_prev_word_void;
|
|
|
|
else if (!strcasecmp(input, "findbracket"))
|
|
|
|
s->scfunc = do_find_bracket;
|
|
|
|
else if (!strcasecmp(input, "wordcount"))
|
|
|
|
s->scfunc = do_wordlinechar_count;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "prevhistory")) {
|
2008-03-05 07:34:01 +00:00
|
|
|
s->scfunc = (void *) prev_history_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "nexthistory")) {
|
|
|
|
s->scfunc = (void *) next_history_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "nohelp") ||
|
|
|
|
!strcasecmp(input, "nohelp")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = NO_HELP;
|
|
|
|
} else if (!strcasecmp(input, "constupdate")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = CONST_UPDATE;
|
|
|
|
} else if (!strcasecmp(input, "morespace")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = MORE_SPACE;
|
|
|
|
} else if (!strcasecmp(input, "smoothscroll")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = SMOOTH_SCROLL;
|
2008-03-16 23:57:14 +00:00
|
|
|
} else if (!strcasecmp(input, "whitespacedisplay")) {
|
2008-03-05 07:34:01 +00:00
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = WHITESPACE_DISPLAY;
|
|
|
|
} else if (!strcasecmp(input, "nosyntax")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = NO_COLOR_SYNTAX;
|
|
|
|
} else if (!strcasecmp(input, "smarthome")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = SMART_HOME;
|
|
|
|
} else if (!strcasecmp(input, "autoindent")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = AUTOINDENT;
|
|
|
|
} else if (!strcasecmp(input, "cuttoend")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = CUT_TO_END;
|
|
|
|
} else if (!strcasecmp(input, "nowrap")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = NO_WRAP;
|
|
|
|
} else if (!strcasecmp(input, "tabstospaces")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = TABS_TO_SPACES;
|
|
|
|
} else if (!strcasecmp(input, "backupfile")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = BACKUP_FILE;
|
|
|
|
} else if (!strcasecmp(input, "mutlibuffer")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = MULTIBUFFER;
|
|
|
|
} else if (!strcasecmp(input, "mouse")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = USE_MOUSE;
|
|
|
|
} else if (!strcasecmp(input, "noconvert")) {
|
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = NO_CONVERT;
|
2008-03-13 08:23:52 +00:00
|
|
|
} else if (!strcasecmp(input, "suspendenable")) {
|
2008-03-05 07:34:01 +00:00
|
|
|
s->scfunc = (void *) do_toggle;
|
|
|
|
s->execute = FALSE;
|
|
|
|
s->toggle = SUSPEND;
|
2008-03-16 12:55:41 +00:00
|
|
|
}
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif /* NANO_TINY */
|
|
|
|
else if (!strcasecmp(input, "right") ||
|
|
|
|
!strcasecmp(input, "forward"))
|
|
|
|
s->scfunc = do_right;
|
|
|
|
else if (!strcasecmp(input, "left") ||
|
|
|
|
!strcasecmp(input, "back"))
|
|
|
|
s->scfunc = do_left;
|
|
|
|
else if (!strcasecmp(input, "up") ||
|
|
|
|
!strcasecmp(input, "prevline"))
|
|
|
|
s->scfunc = do_up_void;
|
|
|
|
else if (!strcasecmp(input, "down") ||
|
|
|
|
!strcasecmp(input, "nextline"))
|
|
|
|
s->scfunc = do_down_void;
|
|
|
|
else if (!strcasecmp(input, "home"))
|
|
|
|
s->scfunc = do_home;
|
|
|
|
else if (!strcasecmp(input, "end"))
|
|
|
|
s->scfunc = do_end;
|
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
else if (!strcasecmp(input, "prevbuf"))
|
|
|
|
s->scfunc = switch_to_prev_buffer_void;
|
|
|
|
else if (!strcasecmp(input, "nextbuf"))
|
|
|
|
s->scfunc = switch_to_next_buffer_void;
|
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "verbatim"))
|
|
|
|
s->scfunc = do_verbatim_input;
|
|
|
|
else if (!strcasecmp(input, "tab"))
|
|
|
|
s->scfunc = do_tab;
|
|
|
|
else if (!strcasecmp(input, "enter"))
|
|
|
|
s->scfunc = do_enter;
|
|
|
|
else if (!strcasecmp(input, "delete"))
|
|
|
|
s->scfunc = do_delete;
|
|
|
|
else if (!strcasecmp(input, "refresh"))
|
|
|
|
s->scfunc = total_refresh;
|
|
|
|
else if (!strcasecmp(input, "casesens")) {
|
|
|
|
s->scfunc = (void *) case_sens_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "regexp") ||
|
|
|
|
!strcasecmp(input, "regex")) {
|
|
|
|
s->scfunc = (void *) regexp_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "dontreplace")) {
|
|
|
|
s->scfunc = (void *) no_replace_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "gototext")) {
|
|
|
|
s->scfunc = (void *) gototext_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "browser") ||
|
|
|
|
!strcasecmp(input, "tofiles")) {
|
|
|
|
s->scfunc = (void *) to_files_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "dosformat")) {
|
|
|
|
s->scfunc = (void *) dos_format_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "macformat")) {
|
|
|
|
s->scfunc = (void *) mac_format_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "append")) {
|
|
|
|
s->scfunc = (void *) append_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "prepend")) {
|
|
|
|
s->scfunc = (void *) prepend_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "backup")) {
|
|
|
|
s->scfunc = (void *) backup_file_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
} else if (!strcasecmp(input, "newbuffer")) {
|
|
|
|
s->scfunc = (void *) new_buffer_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
#endif
|
|
|
|
} else if (!strcasecmp(input, "firstfile")) {
|
|
|
|
s->scfunc = (void *) first_file_msg;
|
|
|
|
s->execute = FALSE;
|
|
|
|
} else if (!strcasecmp(input, "lastfile")) {
|
|
|
|
s->scfunc = (void *) last_file_msg;
|
|
|
|
s->execute = FALSE;
|
2008-03-05 07:34:01 +00:00
|
|
|
} else {
|
|
|
|
free(s);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
return s;
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
#ifdef ENABLE_NANORC
|
2008-03-05 07:34:01 +00:00
|
|
|
/* Same thing as abnove but for the menu */
|
|
|
|
int strtomenu(char *input)
|
|
|
|
{
|
|
|
|
if (!strcasecmp(input, "all"))
|
|
|
|
return MALL;
|
|
|
|
else if (!strcasecmp(input, "main"))
|
|
|
|
return MMAIN;
|
|
|
|
else if (!strcasecmp(input, "search"))
|
|
|
|
return MWHEREIS;
|
|
|
|
else if (!strcasecmp(input, "replace"))
|
|
|
|
return MREPLACE;
|
|
|
|
else if (!strcasecmp(input, "replace2") ||
|
|
|
|
!strcasecmp(input, "replacewith"))
|
|
|
|
return MREPLACE2;
|
|
|
|
else if (!strcasecmp(input, "gotoline"))
|
|
|
|
return MGOTOLINE;
|
|
|
|
else if (!strcasecmp(input, "writeout"))
|
|
|
|
return MWRITEFILE;
|
|
|
|
else if (!strcasecmp(input, "insert"))
|
|
|
|
return MINSERTFILE;
|
|
|
|
else if (!strcasecmp(input, "externalcmd") ||
|
|
|
|
!strcasecmp(input, "extcmd"))
|
|
|
|
return MEXTCMD;
|
|
|
|
else if (!strcasecmp(input, "help"))
|
|
|
|
return MHELP;
|
|
|
|
else if (!strcasecmp(input, "spell"))
|
|
|
|
return MSPELL;
|
|
|
|
else if (!strcasecmp(input, "browser"))
|
|
|
|
return MBROWSER;
|
|
|
|
else if (!strcasecmp(input, "whereisfile"))
|
|
|
|
return MWHEREISFILE;
|
|
|
|
else if (!strcasecmp(input, "gotodir"))
|
|
|
|
return MGOTODIR;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2006-04-20 22:36:10 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
|
2006-04-19 13:36:56 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
/* This function is used to gracefully return all the memory we've used.
|
|
|
|
* It should be called just before calling exit(). Practically, the
|
2002-05-12 19:52:15 +00:00
|
|
|
* only effect is to cause a segmentation fault if the various data
|
|
|
|
* structures got bolloxed earlier. Thus, we don't bother having this
|
2002-07-19 01:08:59 +00:00
|
|
|
* function unless debugging is turned on. */
|
|
|
|
void thanks_for_all_the_fish(void)
|
2002-02-27 04:14:16 +00:00
|
|
|
{
|
2004-07-12 03:10:30 +00:00
|
|
|
delwin(topwin);
|
|
|
|
delwin(edit);
|
|
|
|
delwin(bottomwin);
|
|
|
|
|
2003-01-13 01:35:15 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
if (quotestr != NULL)
|
|
|
|
free(quotestr);
|
2004-07-30 03:54:34 +00:00
|
|
|
#ifdef HAVE_REGEX_H
|
|
|
|
regfree("ereg);
|
2005-05-26 05:17:13 +00:00
|
|
|
if (quoteerr != NULL)
|
|
|
|
free(quoteerr);
|
2004-07-30 03:54:34 +00:00
|
|
|
#endif
|
2003-01-13 01:35:15 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2004-02-28 16:24:31 +00:00
|
|
|
if (backup_dir != NULL)
|
|
|
|
free(backup_dir);
|
|
|
|
#endif
|
2002-03-28 01:59:34 +00:00
|
|
|
#ifndef DISABLE_OPERATINGDIR
|
2002-02-27 04:14:16 +00:00
|
|
|
if (operating_dir != NULL)
|
|
|
|
free(operating_dir);
|
|
|
|
if (full_operating_dir != NULL)
|
|
|
|
free(full_operating_dir);
|
|
|
|
#endif
|
|
|
|
if (last_search != NULL)
|
|
|
|
free(last_search);
|
|
|
|
if (last_replace != NULL)
|
|
|
|
free(last_replace);
|
|
|
|
#ifndef DISABLE_SPELLER
|
|
|
|
if (alt_speller != NULL)
|
|
|
|
free(alt_speller);
|
2002-09-06 20:35:28 +00:00
|
|
|
#endif
|
2002-02-27 04:14:16 +00:00
|
|
|
if (answer != NULL)
|
|
|
|
free(answer);
|
|
|
|
if (cutbuffer != NULL)
|
2003-01-13 01:35:15 +00:00
|
|
|
free_filestruct(cutbuffer);
|
2004-11-23 04:08:28 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
if (jusbuffer != NULL)
|
|
|
|
free_filestruct(jusbuffer);
|
2005-05-26 05:17:13 +00:00
|
|
|
#endif
|
2005-05-26 05:53:29 +00:00
|
|
|
/* Free the memory associated with each open file buffer. */
|
2005-07-08 20:09:16 +00:00
|
|
|
if (openfile != NULL)
|
2005-07-08 19:57:25 +00:00
|
|
|
free_openfilestruct(openfile);
|
2002-07-19 01:08:59 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2005-05-26 05:17:13 +00:00
|
|
|
if (syntaxstr != NULL)
|
|
|
|
free(syntaxstr);
|
2002-07-19 01:08:59 +00:00
|
|
|
while (syntaxes != NULL) {
|
|
|
|
syntaxtype *bill = syntaxes;
|
|
|
|
|
|
|
|
free(syntaxes->desc);
|
|
|
|
while (syntaxes->extensions != NULL) {
|
|
|
|
exttype *bob = syntaxes->extensions;
|
|
|
|
|
|
|
|
syntaxes->extensions = bob->next;
|
2005-07-29 21:42:08 +00:00
|
|
|
free(bob->ext_regex);
|
2005-08-29 18:52:06 +00:00
|
|
|
if (bob->ext != NULL) {
|
|
|
|
regfree(bob->ext);
|
|
|
|
free(bob->ext);
|
|
|
|
}
|
2002-07-19 01:08:59 +00:00
|
|
|
free(bob);
|
|
|
|
}
|
|
|
|
while (syntaxes->color != NULL) {
|
|
|
|
colortype *bob = syntaxes->color;
|
|
|
|
|
|
|
|
syntaxes->color = bob->next;
|
2005-07-29 21:42:08 +00:00
|
|
|
free(bob->start_regex);
|
2005-07-13 20:18:46 +00:00
|
|
|
if (bob->start != NULL) {
|
|
|
|
regfree(bob->start);
|
|
|
|
free(bob->start);
|
|
|
|
}
|
2005-07-14 18:33:51 +00:00
|
|
|
if (bob->end_regex != NULL)
|
|
|
|
free(bob->end_regex);
|
2005-07-13 20:18:46 +00:00
|
|
|
if (bob->end != NULL) {
|
2003-02-03 02:56:44 +00:00
|
|
|
regfree(bob->end);
|
2005-07-13 20:18:46 +00:00
|
|
|
free(bob->end);
|
|
|
|
}
|
2002-07-19 01:08:59 +00:00
|
|
|
free(bob);
|
|
|
|
}
|
|
|
|
syntaxes = syntaxes->next;
|
|
|
|
free(bill);
|
|
|
|
}
|
|
|
|
#endif /* ENABLE_COLOR */
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2005-05-26 06:09:07 +00:00
|
|
|
/* Free the search and replace history lists. */
|
2005-05-26 05:17:13 +00:00
|
|
|
if (searchage != NULL)
|
|
|
|
free_filestruct(searchage);
|
|
|
|
if (replaceage != NULL)
|
|
|
|
free_filestruct(replaceage);
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
2004-08-17 05:23:38 +00:00
|
|
|
#ifdef ENABLE_NANORC
|
2005-05-26 05:17:13 +00:00
|
|
|
if (homedir != NULL)
|
|
|
|
free(homedir);
|
2004-08-17 05:23:38 +00:00
|
|
|
#endif
|
2002-02-27 04:14:16 +00:00
|
|
|
}
|
2002-05-12 19:52:15 +00:00
|
|
|
#endif /* DEBUG */
|
2008-03-05 07:34:01 +00:00
|
|
|
|