2008-07-10 20:13:04 +00:00
|
|
|
/* $Id$ */
|
2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* global.c *
|
|
|
|
* *
|
2009-12-02 03:36:22 +00:00
|
|
|
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
2014-04-30 20:18:26 +00:00
|
|
|
* 2008, 2009, 2010, 2011, 2013, 2014 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-07-12 02:13:22 +00:00
|
|
|
#include "proto.h"
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
2014-06-30 18:04:33 +00:00
|
|
|
bool meta_key;
|
|
|
|
/* Whether the current keystroke is a Meta key. */
|
|
|
|
bool func_key;
|
|
|
|
/* Whether the current keystroke is an extended keypad value. */
|
|
|
|
|
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. */
|
|
|
|
|
2009-08-14 03:18:29 +00:00
|
|
|
unsigned flags[4] = {0, 0, 0, 0};
|
2005-12-08 07:09:08 +00:00
|
|
|
/* 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? */
|
2009-11-16 04:28:40 +00:00
|
|
|
int maxrows = 0;
|
2014-02-25 21:27:22 +00:00
|
|
|
/* How many usable lines there are (due to soft wrapping). */
|
2005-12-08 07:09:08 +00:00
|
|
|
|
|
|
|
filestruct *cutbuffer = NULL;
|
|
|
|
/* The buffer where we store cut text. */
|
2008-07-31 04:24:04 +00:00
|
|
|
filestruct *cutbottom = NULL;
|
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
|
|
|
|
|
2014-04-13 20:50:20 +00:00
|
|
|
#if !defined(NANO_TINY) && !defined(DISABLE_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
|
|
|
|
|
2009-01-24 22:40:41 +00:00
|
|
|
bool nodelay_mode = FALSE;
|
2014-05-13 20:14:01 +00:00
|
|
|
/* Are we checking for a cancel wile doing something? */
|
2009-01-24 22:40:41 +00:00
|
|
|
|
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. */
|
2013-01-01 03:24:39 +00:00
|
|
|
|
2013-01-03 04:36:39 +00:00
|
|
|
const char *locking_prefix = ".";
|
2014-05-13 20:14:01 +00:00
|
|
|
/* Prefix of how to store the vim-style lock file. */
|
2013-01-03 04:36:39 +00:00
|
|
|
const char *locking_suffix = ".swp";
|
2014-05-13 20:14:01 +00:00
|
|
|
/* Suffix of the vim-style lock file. */
|
2005-12-08 07:09:08 +00:00
|
|
|
#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
|
|
|
|
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_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
|
|
|
|
|
2014-05-16 10:34:05 +00:00
|
|
|
bool edit_refresh_needed = FALSE;
|
2012-12-30 19:20:10 +00:00
|
|
|
/* Did a command mangle enough of the buffer refresh that we
|
2014-02-25 21:27:22 +00:00
|
|
|
* should repaint the screen? */
|
2009-02-06 03:41:02 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
int currmenu;
|
2014-02-25 21:27:22 +00:00
|
|
|
/* The currently loaded menu. */
|
2008-03-05 07:34:01 +00:00
|
|
|
sc *sclist = NULL;
|
2014-04-26 18:41:43 +00:00
|
|
|
/* Pointer to the start of the shortcuts list. */
|
2008-03-05 07:34:01 +00:00
|
|
|
subnfunc *allfuncs = NULL;
|
2014-04-26 18:41:43 +00:00
|
|
|
/* Pointer to the start of the functions list. */
|
|
|
|
subnfunc *tailfunc;
|
|
|
|
/* Pointer to the last function in the list. */
|
2014-04-26 19:01:18 +00:00
|
|
|
subnfunc *exitfunc;
|
|
|
|
/* Pointer to the special Exit/Close item. */
|
2014-04-07 09:02:22 +00:00
|
|
|
subnfunc *uncutfunc;
|
|
|
|
/* Pointer to the special Uncut/Unjustify item. */
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2014-06-19 20:05:24 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
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. */
|
2011-02-16 06:52:30 +00:00
|
|
|
poshiststruct *poshistory;
|
2014-02-25 21:27:22 +00:00
|
|
|
/* The cursor position 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
|
|
|
|
2014-05-04 08:53:06 +00:00
|
|
|
int hilite_attribute = A_REVERSE;
|
2006-04-12 15:27:40 +00:00
|
|
|
/* The curses attribute we use for reverse video. */
|
2014-05-03 18:24:45 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
|
|
|
char* specified_color_combo[] = {};
|
|
|
|
/* The color combinations as specified in the rcfile. */
|
|
|
|
#endif
|
2014-05-10 19:15:04 +00:00
|
|
|
color_pair interface_color_pair[] = {};
|
2014-05-03 18:24:45 +00:00
|
|
|
/* The processed color pairs for the interface elements. */
|
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
|
|
|
|
2014-02-25 21:27:22 +00:00
|
|
|
/* Return the number of entries in the shortcut list for a given menu. */
|
2008-03-05 07:34:01 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-07-01 18:52:21 +00:00
|
|
|
/* To make the functions and shortcuts lists clearer. */
|
|
|
|
#define VIEW TRUE /* Is allowed in view mode. */
|
|
|
|
#define NOVIEW FALSE
|
|
|
|
#define BLANKAFTER TRUE /* A blank line after this one. */
|
|
|
|
#define TOGETHER FALSE
|
|
|
|
|
2014-02-25 21:27:22 +00:00
|
|
|
/* Just throw this here. */
|
2011-02-07 14:45:56 +00:00
|
|
|
void case_sens_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void regexp_void(void)
|
|
|
|
{
|
|
|
|
}
|
2014-05-13 20:51:19 +00:00
|
|
|
void backwards_void(void)
|
|
|
|
{
|
|
|
|
}
|
2011-02-07 14:45:56 +00:00
|
|
|
void gototext_void(void)
|
|
|
|
{
|
|
|
|
}
|
2014-05-13 20:51:19 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2011-02-07 14:45:56 +00:00
|
|
|
void to_files_void(void)
|
|
|
|
{
|
|
|
|
}
|
2014-05-13 20:51:19 +00:00
|
|
|
void goto_dir_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2011-02-07 14:45:56 +00:00
|
|
|
void dos_format_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void mac_format_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void append_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void prepend_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void backup_file_void(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void new_buffer_void(void)
|
|
|
|
{
|
|
|
|
}
|
2014-06-23 18:30:35 +00:00
|
|
|
void flip_replace_void(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2014-06-04 19:15:16 +00:00
|
|
|
void flip_execute_void(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-27 19:18:00 +00:00
|
|
|
/* Add a function to the function list. */
|
2011-02-07 14:45:56 +00:00
|
|
|
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
|
2008-03-05 07:34:01 +00:00
|
|
|
bool blank_after, bool viewok)
|
|
|
|
{
|
2014-06-04 16:30:11 +00:00
|
|
|
subnfunc *f = (subnfunc *)nmalloc(sizeof(subnfunc));
|
2014-04-26 18:41:43 +00:00
|
|
|
|
|
|
|
if (allfuncs == NULL)
|
|
|
|
allfuncs = f;
|
|
|
|
else
|
|
|
|
tailfunc->next = f;
|
|
|
|
tailfunc = f;
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
f->next = NULL;
|
|
|
|
f->scfunc = func;
|
|
|
|
f->menus = menus;
|
|
|
|
f->desc = desc;
|
|
|
|
f->viewok = viewok;
|
2008-08-30 21:00:00 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
f->help = help;
|
|
|
|
f->blank_after = blank_after;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2014-04-15 20:01:19 +00:00
|
|
|
fprintf(stderr, "Added func %ld (%s) for menus %x\n", (long)func, f->desc, menus);
|
2002-06-28 22:45:14 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
|
2014-07-27 19:13:46 +00:00
|
|
|
/* Add a key combo to the shortcut list. */
|
2014-06-28 14:42:18 +00:00
|
|
|
void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggle)
|
2000-06-06 05:53:49 +00:00
|
|
|
{
|
2014-07-27 19:13:46 +00:00
|
|
|
static sc *tailsc;
|
|
|
|
sc *s = (sc *)nmalloc(sizeof(sc));
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2014-07-27 19:13:46 +00:00
|
|
|
/* Start the list, or tack on the next item. */
|
|
|
|
if (sclist == NULL)
|
|
|
|
sclist = s;
|
|
|
|
else
|
|
|
|
tailsc->next = s;
|
|
|
|
tailsc = s;
|
|
|
|
s->next = NULL;
|
|
|
|
|
|
|
|
/* Fill in the data. */
|
2008-03-05 07:34:01 +00:00
|
|
|
s->menu = menu;
|
2014-07-27 19:13:46 +00:00
|
|
|
s->scfunc = func;
|
2008-03-05 07:34:01 +00:00
|
|
|
s->toggle = toggle;
|
2009-11-29 06:13:22 +00:00
|
|
|
s->keystr = (char *) scstring;
|
2014-07-27 19:13:46 +00:00
|
|
|
s->type = strtokeytype(scstring);
|
2008-03-05 07:34:01 +00:00
|
|
|
assign_keyinfo(s);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2014-06-09 20:41:15 +00:00
|
|
|
fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int)s->menu);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
}
|
|
|
|
|
2014-05-13 20:20:51 +00:00
|
|
|
/* Assign one function's shortcuts to another function. */
|
2014-02-24 10:18:15 +00:00
|
|
|
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
|
|
|
|
{
|
|
|
|
sc *s;
|
|
|
|
|
2014-05-13 20:20:51 +00:00
|
|
|
for (s = sclist; s != NULL; s = s->next)
|
2014-06-20 10:48:26 +00:00
|
|
|
if (s->scfunc == oldfunc)
|
2014-02-24 10:18:15 +00:00
|
|
|
s->scfunc = newfunc;
|
|
|
|
}
|
|
|
|
|
2014-07-27 19:23:41 +00:00
|
|
|
/* Return the first shortcut in the list of shortcuts that
|
|
|
|
* matches the given func in the given menu. */
|
|
|
|
const sc *first_sc_for(int menu, void (*func)(void))
|
|
|
|
{
|
|
|
|
const sc *s;
|
|
|
|
|
|
|
|
for (s = sclist; s != NULL; s = s->next)
|
|
|
|
if ((s->menu & menu) && s->scfunc == func)
|
|
|
|
return s;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
|
|
|
#endif
|
|
|
|
/* Otherwise... */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
/* Return the given menu's first shortcut sequence, or the default value
|
2014-02-25 21:27:22 +00:00
|
|
|
* (2nd arg). Assumes currmenu for the menu to check. */
|
2014-06-09 14:23:53 +00:00
|
|
|
int sc_seq_or(void (*func)(void), int defaultval)
|
2008-03-09 02:52:40 +00:00
|
|
|
{
|
|
|
|
const sc *s = first_sc_for(currmenu, func);
|
|
|
|
|
2014-06-30 18:20:32 +00:00
|
|
|
if (s) {
|
|
|
|
meta_key = (s->type == META);
|
2008-03-09 02:52:40 +00:00
|
|
|
return s->seq;
|
2014-06-30 18:20:32 +00:00
|
|
|
}
|
2008-03-09 02:52:40 +00:00
|
|
|
/* else */
|
|
|
|
return defaultval;
|
|
|
|
}
|
|
|
|
|
2014-07-02 08:47:09 +00:00
|
|
|
/* Return a pointer to the function that is bound to the given key. */
|
|
|
|
functionptrtype func_from_key(int *kbinput)
|
|
|
|
{
|
|
|
|
const sc *s = get_shortcut(kbinput);
|
|
|
|
|
|
|
|
if (s)
|
|
|
|
return s->scfunc;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-07-27 19:18:00 +00:00
|
|
|
/* Return the type of command key based on the given string. */
|
|
|
|
key_type strtokeytype(const char *str)
|
|
|
|
{
|
|
|
|
if (str[0] == '^')
|
|
|
|
return CONTROL;
|
|
|
|
else if (str[0] == 'M')
|
|
|
|
return META;
|
|
|
|
else if (str[0] == 'F')
|
|
|
|
return FKEY;
|
|
|
|
else
|
|
|
|
return RAWINPUT;
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:27:22 +00:00
|
|
|
/* Assign the info to the shortcut struct.
|
|
|
|
* Assumes keystr is already assigned, naturally. */
|
2008-03-05 07:34:01 +00:00
|
|
|
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]);
|
2011-02-26 14:22:37 +00:00
|
|
|
} else /* RAWINPUT */
|
2008-03-05 07:34:01 +00:00
|
|
|
s->seq = (int) s->keystr[0];
|
2008-03-05 17:15:33 +00:00
|
|
|
|
2014-04-21 15:22:14 +00:00
|
|
|
/* Override some keys which don't bind as easily as we'd like. */
|
2008-03-05 17:15:33 +00:00
|
|
|
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) ' ';
|
2014-04-21 15:22:14 +00:00
|
|
|
else if (s->type == RAWINPUT) {
|
2014-04-21 15:45:23 +00:00
|
|
|
if (!strcasecmp(s->keystr, "Up"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_UP;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Down"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_DOWN;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Left"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_LEFT;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Right"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_RIGHT;
|
2014-04-21 18:05:11 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Ins"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_IC;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Del"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_DC;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Bsp"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_BACKSPACE;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Enter"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_ENTER;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "PgUp"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_PPAGE;
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "PgDn"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_NPAGE;
|
2008-03-11 03:03:53 +00:00
|
|
|
#ifdef KEY_HOME
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "Home"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_HOME;
|
2008-03-11 03:03:53 +00:00
|
|
|
#endif
|
|
|
|
#ifdef KEY_END
|
2014-04-21 15:45:23 +00:00
|
|
|
else if (!strcasecmp(s->keystr, "End"))
|
2014-04-21 15:22:14 +00:00
|
|
|
s->seq = KEY_END;
|
2008-03-11 03:03:53 +00:00
|
|
|
#endif
|
2014-04-21 15:22:14 +00:00
|
|
|
}
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void print_sclist(void)
|
|
|
|
{
|
|
|
|
sc *s;
|
|
|
|
const subnfunc *f;
|
|
|
|
|
2014-03-26 10:57:11 +00:00
|
|
|
for (s = sclist; s != NULL; s = s->next) {
|
2008-03-05 07:34:01 +00:00
|
|
|
f = sctofunc(s);
|
2014-03-26 10:57:11 +00:00
|
|
|
if (f)
|
2014-03-26 10:53:10 +00:00
|
|
|
fprintf(stderr, "Shortcut \"%s\", function: %s, menus %x\n", s->keystr, f->desc, f->menus);
|
2008-03-05 07:34:01 +00:00
|
|
|
else
|
2014-04-08 12:35:18 +00:00
|
|
|
fprintf(stderr, "Hmm, didn't find a func for \"%s\"\n", s->keystr);
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-04-26 19:01:18 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next four strings at most 10 characters. */
|
|
|
|
const char *exit_tag = N_("Exit");
|
|
|
|
const char *close_tag = N_("Close");
|
2014-04-07 09:02:22 +00:00
|
|
|
const char *uncut_tag = N_("Uncut Text");
|
|
|
|
#ifndef DISABLE_JUSITIFY
|
|
|
|
const char *unjust_tag = N_("Unjustify");
|
|
|
|
#endif
|
2014-04-06 20:55:21 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-04-22 10:44:24 +00:00
|
|
|
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
2014-04-22 10:18:48 +00:00
|
|
|
const char *whereis_next_tag = N_("WhereIs Next");
|
2014-04-06 20:55:21 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2014-04-07 09:24:10 +00:00
|
|
|
/* Initialize the list of functions and the list of shortcuts. */
|
|
|
|
void shortcut_init(void)
|
2000-09-01 13:32:47 +00:00
|
|
|
{
|
2014-05-28 19:02:00 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next eight strings at most 10 characters. */
|
2014-04-22 10:18:48 +00:00
|
|
|
const char *whereis_tag = N_("Where Is");
|
2014-04-27 14:21:57 +00:00
|
|
|
const char *replace_tag = N_("Replace");
|
|
|
|
const char *gotoline_tag = N_("Go To Line");
|
2014-04-22 10:02:55 +00:00
|
|
|
const char *prev_line_tag = N_("Prev Line");
|
|
|
|
const char *next_line_tag = N_("Next Line");
|
2014-05-28 15:35:00 +00:00
|
|
|
const char *read_file_tag = N_("Read File");
|
2014-04-27 15:26:25 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-04-27 14:21:57 +00:00
|
|
|
const char *fulljustify_tag = N_("FullJstify");
|
2014-04-27 15:26:25 +00:00
|
|
|
#endif
|
2014-04-22 10:18:48 +00:00
|
|
|
const char *refresh_tag = N_("Refresh");
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2014-05-28 20:31:06 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-08-30 21:00:00 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-02-25 21:27:22 +00:00
|
|
|
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
|
|
|
|
* they are best kept shorter than 56 characters, but may be longer. */
|
2008-08-30 21:00:00 +00:00
|
|
|
const char *nano_justify_msg = N_("Justify the current paragraph");
|
|
|
|
#endif
|
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 =
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_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
|
2014-03-17 21:36:37 +00:00
|
|
|
N_("Exit from nano")
|
2004-07-12 03:10:30 +00:00
|
|
|
#endif
|
|
|
|
;
|
2005-06-06 18:38:16 +00:00
|
|
|
const char *nano_writeout_msg =
|
|
|
|
N_("Write the current file to disk");
|
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");
|
2014-05-13 20:51:19 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2014-03-18 22:04:41 +00:00
|
|
|
const char *nano_browser_whereis_msg =
|
|
|
|
N_("Search for a string");
|
2014-05-13 20:51:19 +00:00
|
|
|
#endif
|
2014-04-27 19:51:03 +00:00
|
|
|
const char *nano_prevpage_msg = N_("Go one screenful up");
|
|
|
|
const char *nano_nextpage_msg = N_("Go one screenful down");
|
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");
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_cursorpos_msg = N_("Display the position of the cursor");
|
2014-04-03 21:06:30 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
|
2014-04-03 21:06:30 +00:00
|
|
|
#endif
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_replace_msg = N_("Replace a string or a regular expression");
|
2014-04-13 12:16:37 +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
|
2014-04-27 15:20:57 +00:00
|
|
|
const char *nano_mark_msg = N_("Mark text starting from the cursor position");
|
|
|
|
const char *nano_whereis_next_msg = N_("Repeat the 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
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
|
|
|
const char *nano_lastline_msg = 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
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_prevfile_msg = N_("Switch to the previous file buffer");
|
|
|
|
const char *nano_nextfile_msg = N_("Switch to the next file buffer");
|
|
|
|
#endif
|
|
|
|
const char *nano_verbatim_msg = N_("Insert the next keystroke verbatim");
|
|
|
|
const char *nano_tab_msg = N_("Insert a tab at the cursor position");
|
|
|
|
const char *nano_enter_msg = N_("Insert a newline at the cursor position");
|
|
|
|
const char *nano_delete_msg = N_("Delete the character under the cursor");
|
2006-04-24 21:14:55 +00:00
|
|
|
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
|
2014-06-30 20:39:27 +00:00
|
|
|
const char *nano_cut_till_eof_msg =
|
2005-01-01 07:43:32 +00:00
|
|
|
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
|
2014-06-19 20:05:24 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
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");
|
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");
|
|
|
|
const char *nano_append_msg = N_("Toggle appending");
|
|
|
|
const char *nano_prepend_msg = N_("Toggle prepending");
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_backup_msg = 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
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-05-26 10:07:00 +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");
|
2014-05-26 10:07:00 +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");
|
2009-12-23 05:03:09 +00:00
|
|
|
const char *nano_backfile_msg = N_("Go to the previous file in the list");
|
2014-05-26 10:07:00 +00:00
|
|
|
const char *nano_forwardfile_msg = N_("Go to the next file in the list");
|
2004-07-23 12:51:40 +00:00
|
|
|
const char *nano_gotodir_msg = N_("Go to directory");
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2014-03-27 21:35:18 +00:00
|
|
|
const char *nano_lint_msg = N_("Invoke the linter, if available");
|
2014-02-24 10:18:15 +00:00
|
|
|
const char *nano_prevlint_msg = N_("Go to previous linter msg");
|
|
|
|
const char *nano_nextlint_msg = N_("Go to next linter msg");
|
2015-01-03 07:24:17 +00:00
|
|
|
const char *nano_formatter_msg = N_("Invoke formatter, if available");
|
2014-02-24 10:18:15 +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;
|
2014-05-13 18:06:09 +00:00
|
|
|
allfuncs = allfuncs->next;
|
2008-03-05 07:34:01 +00:00
|
|
|
free(f);
|
|
|
|
}
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2014-04-13 12:16:37 +00:00
|
|
|
/* Start populating the different menus with functions. */
|
|
|
|
|
2014-04-16 09:55:16 +00:00
|
|
|
add_to_funcs(do_help_void, MMOST,
|
2014-04-22 11:57:11 +00:00
|
|
|
/* TRANSLATORS: Try to keep the following strings at most 10 characters. */
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Get Help"), IFSCHELP(nano_help_msg), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-04-16 09:55:16 +00:00
|
|
|
add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO),
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Cancel"), IFSCHELP(nano_cancel_msg), TOGETHER, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(do_exit, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
exit_tag, IFSCHELP(nano_exit_msg), TOGETHER, VIEW);
|
2014-04-26 19:01:18 +00:00
|
|
|
/* Remember the entry for Exit, to be able to replace it with Close. */
|
|
|
|
exitfunc = tailfunc;
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2008-03-20 04:51:26 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_exit, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW);
|
2008-03-20 04:51:26 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_writeout_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Write Out"), IFSCHELP(nano_writeout_msg), TOGETHER, NOVIEW);
|
2008-03-05 07:34:01 +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. */
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_insertfile_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_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
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_search, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
whereis_tag, IFSCHELP(nano_whereis_msg), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_replace, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_BROWSER
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_search, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW);
|
2014-03-18 22:04:41 +00:00
|
|
|
|
2014-04-27 19:51:03 +00:00
|
|
|
add_to_funcs(goto_dir_void, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW);
|
2014-02-26 20:37:40 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-15 20:01:19 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2014-04-22 10:02:55 +00:00
|
|
|
/* The description ("x") and blank_after (0) are irrelevant,
|
|
|
|
* because the help viewer does not have a help text. */
|
2014-04-22 10:18:48 +00:00
|
|
|
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
|
2014-04-15 20:01:19 +00:00
|
|
|
|
2014-04-22 10:18:48 +00:00
|
|
|
add_to_funcs(total_refresh, MHELP, refresh_tag, "x", 0, VIEW);
|
2014-04-22 10:02:55 +00:00
|
|
|
|
|
|
|
add_to_funcs(do_up_void, MHELP, prev_line_tag, "x", 0, VIEW);
|
|
|
|
add_to_funcs(do_down_void, MHELP, next_line_tag, "x" , 0, VIEW);
|
2014-04-15 20:01:19 +00:00
|
|
|
#endif
|
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_cut_text_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Cut Text"), IFSCHELP(nano_cut_msg), TOGETHER, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_uncut_text, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
uncut_tag, IFSCHELP(nano_uncut_msg), BLANKAFTER, NOVIEW);
|
2014-04-07 09:02:22 +00:00
|
|
|
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
|
2014-04-26 18:41:43 +00:00
|
|
|
uncutfunc = tailfunc;
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-04-27 19:51:03 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Justify"), IFSCHELP(nano_justify_msg), TOGETHER, NOVIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2004-04-30 04:49:02 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2014-05-28 19:02:00 +00:00
|
|
|
add_to_funcs(do_spell, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2014-05-28 19:02:00 +00:00
|
|
|
add_to_funcs(do_linter, MMAIN,
|
2015-03-20 12:22:49 +00:00
|
|
|
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
2015-01-03 07:24:17 +00:00
|
|
|
add_to_funcs(do_formatter, MMAIN,
|
2015-03-20 12:22:49 +00:00
|
|
|
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
|
2014-02-24 10:18:15 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-27 14:21:57 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-07-01 16:24:01 +00:00
|
|
|
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Case Sens"), IFSCHELP(nano_case_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_REGEX_H
|
2014-07-01 16:24:01 +00:00
|
|
|
add_to_funcs(regexp_void, MWHEREIS|MREPLACE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Regexp"), IFSCHELP(nano_regexp_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NANO_TINY
|
2014-07-01 16:24:01 +00:00
|
|
|
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-23 18:30:35 +00:00
|
|
|
add_to_funcs(flip_replace_void, MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2014-06-23 18:30:35 +00:00
|
|
|
add_to_funcs(flip_replace_void, MREPLACE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("No Replace"), IFSCHELP(nano_whereis_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_full_justify, MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
fulljustify_tag, IFSCHELP(nano_fulljustify_msg), TOGETHER, NOVIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
#endif
|
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2014-05-27 12:17:49 +00:00
|
|
|
#if !defined(NANO_TINY) || defined(DISABLE_COLOR)
|
|
|
|
/* Conditionally placing this one here or further on, to keep the
|
|
|
|
* help items nicely paired in most conditions. */
|
2014-04-27 19:51:03 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN|MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
|
2014-05-27 12:17:49 +00:00
|
|
|
#endif
|
2014-04-27 19:51:03 +00:00
|
|
|
|
|
|
|
add_to_funcs(do_page_up, MMAIN|MHELP|MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Prev Page"), IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
add_to_funcs(do_page_down, MMAIN|MHELP|MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Next Page"), IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW);
|
2006-04-19 14:09:01 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_research, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
2014-04-27 15:20:57 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_find_bracket, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("To Bracket"), IFSCHELP(nano_bracket_msg), TOGETHER, VIEW);
|
2014-04-27 15:20:57 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_mark, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Mark Text"), IFSCHELP(nano_mark_msg), TOGETHER, VIEW);
|
2005-06-12 22:31:03 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_copy_text, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Copy Text"), IFSCHELP(nano_copy_msg), BLANKAFTER, NOVIEW);
|
2005-10-24 02:12:09 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_indent_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Indent Text"), IFSCHELP(nano_indent_msg), TOGETHER, NOVIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_unindent, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Unindent Text"), IFSCHELP(nano_unindent_msg), BLANKAFTER, NOVIEW);
|
2008-07-10 20:13:04 +00:00
|
|
|
|
2014-06-13 15:20:26 +00:00
|
|
|
add_to_funcs(do_undo, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Undo"), IFSCHELP(nano_undo_msg), TOGETHER, NOVIEW);
|
2014-06-13 15:20:26 +00:00
|
|
|
add_to_funcs(do_redo, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Redo"), IFSCHELP(nano_redo_msg), BLANKAFTER, NOVIEW);
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2003-08-23 21:11:06 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_left, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_right, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW);
|
2009-12-23 05:03:09 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_BROWSER
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_left, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_right, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Forward"), IFSCHELP(nano_forwardfile_msg), TOGETHER, VIEW);
|
2009-12-23 05:03:09 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_prev_word_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Prev Word"), IFSCHELP(nano_prevword_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_next_word_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Next Word"), IFSCHELP(nano_nextword_msg), TOGETHER, VIEW);
|
2006-04-22 19:45:26 +00:00
|
|
|
#endif
|
2006-04-21 02:05:09 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_home, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Home"), IFSCHELP(nano_home_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_end, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("End"), IFSCHELP(nano_end_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_up_void, MMAIN|MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
prev_line_tag, IFSCHELP(nano_prevline_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_down_void, MMAIN|MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
next_line_tag, IFSCHELP(nano_nextline_msg), BLANKAFTER, VIEW);
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_para_begin_void, MMAIN|MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Beg of Par"), IFSCHELP(nano_parabegin_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_para_end_void, MMAIN|MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("End of Par"), IFSCHELP(nano_paraend_msg), TOGETHER, 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
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_scroll_up, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Scroll Up"), IFSCHELP(nano_scrollup_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_scroll_down, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Scroll Down"), IFSCHELP(nano_scrolldown_msg), BLANKAFTER, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(switch_to_prev_buffer_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Prev File"), IFSCHELP(nano_prevfile_msg), TOGETHER, VIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(switch_to_next_buffer_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Next File"), IFSCHELP(nano_nextfile_msg), BLANKAFTER, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
|
2014-05-27 12:17:49 +00:00
|
|
|
#if defined(NANO_TINY) && !defined(DISABLE_COLOR)
|
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN|MWHEREIS,
|
2014-07-01 18:52:21 +00:00
|
|
|
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
|
2014-05-27 12:17:49 +00:00
|
|
|
#endif
|
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_verbatim_input, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), TOGETHER, NOVIEW);
|
2008-03-17 05:50:04 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_tab, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_enter_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Enter"), IFSCHELP(nano_enter_msg), TOGETHER, NOVIEW);
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_delete, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Delete"), IFSCHELP(nano_delete_msg), TOGETHER, NOVIEW);
|
2014-05-28 21:02:39 +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
|
2014-07-01 18:52:21 +00:00
|
|
|
TOGETHER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#else
|
2014-07-01 18:52:21 +00:00
|
|
|
BLANKAFTER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#endif
|
2008-03-12 04:44:14 +00:00
|
|
|
NOVIEW);
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-30 20:39:27 +00:00
|
|
|
add_to_funcs(do_cut_till_eof, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("CutTillEnd"), IFSCHELP(nano_cut_till_eof_msg), BLANKAFTER, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2003-09-04 20:25:29 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_full_justify, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
fulljustify_tag, IFSCHELP(nano_fulljustify_msg), TOGETHER, NOVIEW);
|
2003-09-04 20:25:29 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_wordlinechar_count, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Word Count"), IFSCHELP(nano_wordcount_msg), TOGETHER, VIEW);
|
2001-06-14 02:54:22 +00:00
|
|
|
#endif
|
2003-01-05 20:41:21 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(total_refresh, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
refresh_tag, IFSCHELP(nano_refresh_msg), TOGETHER, VIEW);
|
2008-03-13 08:23:52 +00:00
|
|
|
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_suspend_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Suspend"), IFSCHELP(nano_suspend_msg), BLANKAFTER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2014-06-19 20:05:24 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(get_history_older_void,
|
2014-04-16 09:26:15 +00:00
|
|
|
(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE),
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("PrevHstory"), IFSCHELP(nano_prev_history_msg), TOGETHER, VIEW);
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(get_history_newer_void,
|
2014-04-16 09:26:15 +00:00
|
|
|
(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE),
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("NextHstory"), IFSCHELP(nano_next_history_msg), TOGETHER, VIEW);
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2001-07-16 00:48:53 +00:00
|
|
|
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(gototext_void, MGOTOLINE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Go To Text"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
|
2004-07-12 03:10:30 +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. */
|
2014-03-27 21:35:18 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(dos_format_void, MWRITEFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2011-02-07 14:45:56 +00:00
|
|
|
add_to_funcs(mac_format_void, MWRITEFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2014-03-17 12:15:23 +00:00
|
|
|
add_to_funcs(append_void, MWRITEFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
2014-03-17 12:15:23 +00:00
|
|
|
add_to_funcs(prepend_void, MWRITEFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
2002-04-16 03:15:47 +00:00
|
|
|
|
2014-03-17 12:15:23 +00:00
|
|
|
add_to_funcs(backup_file_void, MWRITEFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Backup File"), IFSCHELP(nano_backup_msg), TOGETHER, NOVIEW);
|
2014-03-27 21:35:18 +00:00
|
|
|
}
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2014-03-27 21:35:18 +00:00
|
|
|
/* If we're using restricted mode, file insertion is disabled, and
|
|
|
|
* thus command execution and the multibuffer toggle have no place. */
|
|
|
|
if (!ISSET(RESTRICTED)) {
|
2014-06-04 19:15:16 +00:00
|
|
|
add_to_funcs(flip_execute_void, MINSERTFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2014-06-04 19:15:16 +00:00
|
|
|
add_to_funcs(flip_execute_void, MEXTCMD,
|
2014-07-01 18:52:21 +00:00
|
|
|
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
|
2014-05-28 15:35:00 +00:00
|
|
|
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-03-27 21:35:18 +00:00
|
|
|
add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("New Buffer"), IFSCHELP(nano_multibuffer_msg), TOGETHER, NOVIEW);
|
2002-03-21 05:07:28 +00:00
|
|
|
#endif
|
2014-03-27 21:35:18 +00:00
|
|
|
}
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2001-01-12 07:51:05 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2014-04-27 19:51:03 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2014-03-17 12:15:23 +00:00
|
|
|
add_to_funcs(do_first_file, (MBROWSER|MWHEREISFILE),
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("First File"), IFSCHELP(nano_firstfile_msg), TOGETHER, VIEW);
|
2014-03-17 12:15:23 +00:00
|
|
|
add_to_funcs(do_last_file, (MBROWSER|MWHEREISFILE),
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Last File"), IFSCHELP(nano_lastfile_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
#endif
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2014-04-27 19:51:03 +00:00
|
|
|
#if !defined(NANO_TINY) && !defined(DISABLE_BROWSER)
|
2014-05-28 21:02:39 +00:00
|
|
|
add_to_funcs(do_research, MBROWSER,
|
2014-07-01 18:52:21 +00:00
|
|
|
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DISABLE_COLOR
|
2014-05-28 19:02:00 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
|
2014-04-27 19:51:03 +00:00
|
|
|
add_to_funcs(do_page_up, MLINTER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Prev Lint Msg"), IFSCHELP(nano_prevlint_msg), TOGETHER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
add_to_funcs(do_page_down, MLINTER,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Next Lint Msg"), IFSCHELP(nano_nextlint_msg), TOGETHER, VIEW);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
|
|
|
|
2014-04-13 12:16:37 +00:00
|
|
|
/* Start associating key combos with functions in specific menus. */
|
|
|
|
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMOST, "^G", do_help_void, 0);
|
|
|
|
add_to_sclist(MMOST, "F1", do_help_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN, "^O", do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F3", do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^R", do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F5", do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "Ins", do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^W", do_search, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "F6", do_search, 0);
|
|
|
|
add_to_sclist(MMAIN, "^\\", do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-R", do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "F14", do_replace, 0);
|
|
|
|
add_to_sclist(MMOST, "^K", do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMOST, "F9", do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^U", do_uncut_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "F10", do_uncut_text, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "^J", do_justify_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F4", do_justify_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2008-05-31 22:49:55 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", do_spell, 0);
|
|
|
|
add_to_sclist(MMAIN, "F12", do_spell, 0);
|
2014-05-09 15:14:29 +00:00
|
|
|
#else
|
|
|
|
#ifndef DISABLE_COLOR
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", do_linter, 0);
|
|
|
|
add_to_sclist(MMAIN, "F12", do_linter, 0);
|
2015-01-03 07:24:17 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", do_formatter, 0);
|
|
|
|
add_to_sclist(MMAIN, "F12", do_formatter, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F11", do_cursorpos_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^_", do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-G", do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F13", do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^Y", do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F7", do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgUp", do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "^V", do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "F8", do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MWHEREISFILE|MLINTER, "PgDn", do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-\\", do_first_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-|", do_first_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-/", do_last_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-?", do_last_line, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER, "M-W", do_research, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "F16", do_research, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-]", do_find_bracket, 0);
|
|
|
|
add_to_sclist(MMAIN, "^^", do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-A", do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "F15", do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-^", do_copy_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-6", do_copy_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-}", do_indent_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-{", do_unindent, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-U", do_undo, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-E", do_redo, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMOST, "^B", do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "Left", do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "^F", do_right, 0);
|
|
|
|
add_to_sclist(MMOST, "Right", do_right, 0);
|
2014-03-17 11:47:49 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMOST, "M-Space", do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^Space", do_next_word_void, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMOST, "^A", do_home, 0);
|
|
|
|
add_to_sclist(MMOST, "Home", do_home, 0);
|
|
|
|
add_to_sclist(MMOST, "^E", do_end, 0);
|
|
|
|
add_to_sclist(MMOST, "End", do_end, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", do_up_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", do_up_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", do_down_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", do_down_void, 0);
|
2008-06-29 06:22:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-(", do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-9", do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-)", do_para_end_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-0", do_para_end_void, 0);
|
2014-03-17 12:15:23 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M--", do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-_", do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-+", do_scroll_down, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-=", do_scroll_down, 0);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-<", switch_to_prev_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-,", switch_to_prev_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M->", switch_to_next_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-.", switch_to_next_buffer_void, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMOST, "M-V", do_verbatim_input, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-30 20:39:27 +00:00
|
|
|
add_to_sclist(MMAIN, "M-T", do_cut_till_eof, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-D", do_wordlinechar_count, 0);
|
2014-04-07 09:44:52 +00:00
|
|
|
#endif
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN|MWHEREIS, "M-J", do_full_justify, 0);
|
2011-02-07 14:45:56 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "^L", total_refresh, 0);
|
|
|
|
add_to_sclist(MMAIN, "^Z", do_suspend_void, 0);
|
2014-04-06 08:57:36 +00:00
|
|
|
|
2014-05-03 19:19:31 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-05-09 20:33:49 +00:00
|
|
|
/* Group of "Appearance" toggles. */
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-X", do_toggle_void, NO_HELP);
|
|
|
|
add_to_sclist(MMAIN, "M-C", do_toggle_void, CONST_UPDATE);
|
|
|
|
add_to_sclist(MMAIN, "M-O", do_toggle_void, MORE_SPACE);
|
|
|
|
add_to_sclist(MMAIN, "M-S", do_toggle_void, SMOOTH_SCROLL);
|
|
|
|
add_to_sclist(MMAIN, "M-$", do_toggle_void, SOFTWRAP);
|
|
|
|
add_to_sclist(MMAIN, "M-P", do_toggle_void, WHITESPACE_DISPLAY);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Y", do_toggle_void, NO_COLOR_SYNTAX);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2014-05-09 20:33:49 +00:00
|
|
|
/* Group of "Editing-behavior" toggles. */
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-H", do_toggle_void, SMART_HOME);
|
|
|
|
add_to_sclist(MMAIN, "M-I", do_toggle_void, AUTOINDENT);
|
|
|
|
add_to_sclist(MMAIN, "M-K", do_toggle_void, CUT_TO_END);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_WRAPPING
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-L", do_toggle_void, NO_WRAP);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Q", do_toggle_void, TABS_TO_SPACES);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2014-05-09 20:33:49 +00:00
|
|
|
/* Group of "Peripheral-feature" toggles. */
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-B", do_toggle_void, BACKUP_FILE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-F", do_toggle_void, MULTIBUFFER);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_MOUSE
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-M", do_toggle_void, USE_MOUSE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "M-N", do_toggle_void, NO_CONVERT);
|
|
|
|
add_to_sclist(MMAIN, "M-Z", do_toggle_void, SUSPEND);
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2014-03-17 12:15:23 +00:00
|
|
|
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMAIN, "^Q", xon_complaint, 0);
|
|
|
|
add_to_sclist(MMAIN, "^S", xoff_complaint, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", do_cancel, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2014-05-28 20:31:06 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-07-01 16:24:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-B", backwards_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-C", case_sens_void, 0);
|
2014-05-28 20:31:06 +00:00
|
|
|
#endif
|
2014-07-01 16:24:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-R", regexp_void, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "^R", flip_replace_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", do_first_line, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", do_last_line, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", do_para_end_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MWHEREIS, "^T", do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MGOTOLINE, "^T", gototext_void, 0);
|
2014-06-19 20:05:24 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^P", get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Up", get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^N", get_history_newer_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", get_history_newer_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_BROWSER
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", do_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", do_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", do_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", do_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", goto_dir_void, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MWRITEFILE, "M-D", dos_format_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-M", mac_format_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-A", append_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-P", prepend_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-B", backup_file_void, 0);
|
2014-05-13 20:51:19 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", to_files_void, 0);
|
2014-05-13 20:51:19 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", flip_execute_void, 0);
|
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", new_buffer_void, 0);
|
|
|
|
add_to_sclist(MHELP|MBROWSER, "^C", do_exit, 0);
|
2014-05-28 20:31:06 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MHELP, "^G", do_exit, 0);
|
2014-05-28 20:31:06 +00:00
|
|
|
#endif
|
2014-06-28 14:42:18 +00:00
|
|
|
add_to_sclist(MMOST, "^I", do_tab, 0);
|
|
|
|
add_to_sclist(MMOST, "^M", do_enter_void, 0);
|
|
|
|
add_to_sclist(MMOST, "Enter", do_enter_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^D", do_delete, 0);
|
|
|
|
add_to_sclist(MMOST, "Del", do_delete, 0);
|
|
|
|
add_to_sclist(MMOST, "^H", do_backspace, 0);
|
|
|
|
add_to_sclist(MMOST, "Bsp", do_backspace, 0);
|
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
|
|
|
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2015-01-03 07:24:17 +00:00
|
|
|
void set_lint_or_format_shortcuts(void)
|
2014-02-24 10:18:15 +00:00
|
|
|
{
|
|
|
|
#ifndef DISABLE_SPELLER
|
2015-01-03 07:24:17 +00:00
|
|
|
if (openfile->syntax->formatter) {
|
|
|
|
replace_scs_for(do_spell, do_formatter);
|
|
|
|
replace_scs_for(do_linter, do_formatter);
|
|
|
|
} else {
|
|
|
|
replace_scs_for(do_spell, do_linter);
|
|
|
|
replace_scs_for(do_formatter, do_linter);
|
|
|
|
}
|
2014-02-24 10:18:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_spell_shortcuts(void)
|
|
|
|
{
|
|
|
|
#ifndef DISABLE_SPELLER
|
2015-01-03 07:24:17 +00:00
|
|
|
replace_scs_for(do_formatter, do_spell);
|
|
|
|
replace_scs_for(do_linter, do_spell);
|
2014-02-24 10:18:15 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
2014-04-08 18:38:45 +00:00
|
|
|
/* Now let's come up with a single (hopefully) function to get a string
|
|
|
|
* for each flag. */
|
2009-11-29 06:13:22 +00:00
|
|
|
const char *flagtostr(int flag)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2014-06-20 10:48:26 +00:00
|
|
|
switch (flag) {
|
2008-03-05 07:34:01 +00:00
|
|
|
case NO_HELP:
|
2014-04-22 11:57:11 +00:00
|
|
|
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
|
|
|
* they are best kept shorter than 40 characters, but may be longer. */
|
2008-03-05 07:34:01 +00:00
|
|
|
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");
|
2014-05-09 20:33:49 +00:00
|
|
|
case SOFTWRAP:
|
|
|
|
return N_("Soft wrapping of overlong lines");
|
2008-03-05 07:34:01 +00:00
|
|
|
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:
|
2014-04-23 20:37:32 +00:00
|
|
|
return N_("Hard wrapping of overlong lines");
|
2008-03-05 07:34:01 +00:00
|
|
|
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 "?????";
|
|
|
|
}
|
|
|
|
}
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2014-05-25 19:47:46 +00:00
|
|
|
#ifndef DISABLE_NANORC
|
2014-04-13 11:56:08 +00:00
|
|
|
/* Interpret a function string given in the rc file, and return a
|
2014-06-28 14:42:18 +00:00
|
|
|
* shortcut struct with the corresponding function filled in. */
|
2014-04-13 11:56:08 +00:00
|
|
|
sc *strtosc(char *input)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2014-04-13 11:56:08 +00:00
|
|
|
sc *s;
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
s = (sc *)nmalloc(sizeof(sc));
|
|
|
|
|
2008-03-09 02:52:40 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
if (!strcasecmp(input, "help"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_help_void;
|
|
|
|
else
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2014-06-28 15:34:10 +00:00
|
|
|
if (!strcasecmp(input, "cancel"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_cancel;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "exit"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_exit;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "writeout"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_writeout_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "insert"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_insertfile_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "whereis"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_search;
|
2014-04-27 15:26:25 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-04-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "searchagain") ||
|
|
|
|
!strcasecmp(input, "research"))
|
|
|
|
s->scfunc = do_research;
|
2014-04-27 15:26:25 +00:00
|
|
|
#endif
|
2014-04-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "replace"))
|
|
|
|
s->scfunc = do_replace;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "cut"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_cut_text_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "uncut"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_uncut_text;
|
2014-04-27 15:26:25 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-05-05 19:54:34 +00:00
|
|
|
else if (!strcasecmp(input, "cutrestoffile"))
|
2014-06-30 20:39:27 +00:00
|
|
|
s->scfunc = do_cut_till_eof;
|
2014-04-27 15:26:25 +00:00
|
|
|
else if (!strcasecmp(input, "copytext"))
|
|
|
|
s->scfunc = do_copy_text;
|
2014-04-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "mark"))
|
|
|
|
s->scfunc = do_mark;
|
2014-05-09 15:14:29 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_SPELLER
|
2014-04-26 19:33:11 +00:00
|
|
|
else if (!strcasecmp(input, "tospell") ||
|
|
|
|
!strcasecmp(input, "speller"))
|
|
|
|
s->scfunc = do_spell;
|
2014-04-27 15:26:25 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "curpos") ||
|
2014-02-28 20:08:59 +00:00
|
|
|
!strcasecmp(input, "cursorpos"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_cursorpos_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "gotoline"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_gotolinecolumn_void;
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "justify"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_justify_void;
|
2014-04-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "fulljustify"))
|
|
|
|
s->scfunc = do_full_justify;
|
2008-03-16 12:55:41 +00:00
|
|
|
else if (!strcasecmp(input, "beginpara"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_para_begin_void;
|
2008-03-16 12:55:41 +00:00
|
|
|
else if (!strcasecmp(input, "endpara"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_para_end_void;
|
2008-03-16 12:55:41 +00:00
|
|
|
#endif
|
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "indent"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_indent_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "unindent"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_unindent;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "scrollup"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_scroll_up;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "scrolldown"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_scroll_down;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "prevword"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_prev_word_void;
|
2014-04-21 12:06:20 +00:00
|
|
|
else if (!strcasecmp(input, "nextword"))
|
|
|
|
s->scfunc = do_next_word_void;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "findbracket"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_find_bracket;
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "wordcount"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_wordlinechar_count;
|
2008-07-13 01:36:06 +00:00
|
|
|
else if (!strcasecmp(input, "undo"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_undo;
|
2014-06-20 16:03:38 +00:00
|
|
|
else if (!strcasecmp(input, "redo"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_redo;
|
2014-06-19 20:19:22 +00:00
|
|
|
#endif
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "left") ||
|
2014-02-28 20:08:59 +00:00
|
|
|
!strcasecmp(input, "back"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_left;
|
2014-04-22 19:07:32 +00:00
|
|
|
else if (!strcasecmp(input, "right") ||
|
|
|
|
!strcasecmp(input, "forward"))
|
|
|
|
s->scfunc = do_right;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "up") ||
|
2014-02-28 20:08:59 +00:00
|
|
|
!strcasecmp(input, "prevline"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_up_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "down") ||
|
2014-02-28 20:08:59 +00:00
|
|
|
!strcasecmp(input, "nextline"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_down_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "home"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_home;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "end"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_end;
|
2014-04-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "pageup") ||
|
|
|
|
!strcasecmp(input, "prevpage"))
|
|
|
|
s->scfunc = do_page_up;
|
|
|
|
else if (!strcasecmp(input, "pagedown") ||
|
|
|
|
!strcasecmp(input, "nextpage"))
|
|
|
|
s->scfunc = do_page_down;
|
|
|
|
else if (!strcasecmp(input, "firstline"))
|
|
|
|
s->scfunc = do_first_line;
|
|
|
|
else if (!strcasecmp(input, "lastline"))
|
|
|
|
s->scfunc = do_last_line;
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "prevbuf"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = switch_to_prev_buffer_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "nextbuf"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = switch_to_next_buffer_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "verbatim"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_verbatim_input;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "tab"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_tab;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "enter"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_enter_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "delete"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_delete;
|
2008-07-13 16:44:19 +00:00
|
|
|
else if (!strcasecmp(input, "backspace"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_backspace;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "refresh"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = total_refresh;
|
2014-05-27 12:38:32 +00:00
|
|
|
else if (!strcasecmp(input, "suspend"))
|
|
|
|
s->scfunc = do_suspend_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "casesens"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = case_sens_void;
|
2014-05-27 12:34:43 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "regexp") ||
|
|
|
|
!strcasecmp(input, "regex"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = regexp_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "backwards"))
|
2014-05-04 12:20:51 +00:00
|
|
|
s->scfunc = backwards_void;
|
2014-05-27 12:34:43 +00:00
|
|
|
#endif
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "flipreplace") ||
|
|
|
|
!strcasecmp(input, "dontreplace"))
|
2014-06-23 18:30:35 +00:00
|
|
|
s->scfunc = flip_replace_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "gototext"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = gototext_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
|
|
|
else if (!strcasecmp(input, "prevhistory"))
|
|
|
|
s->scfunc = get_history_older_void;
|
|
|
|
else if (!strcasecmp(input, "nexthistory"))
|
|
|
|
s->scfunc = get_history_newer_void;
|
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "dosformat"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = dos_format_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "macformat"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = mac_format_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "append"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = append_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "prepend"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = prepend_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "backup"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = backup_file_void;
|
2014-06-04 19:15:16 +00:00
|
|
|
#ifndef ENABLE_TINY
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "flipexecute"))
|
2014-06-04 19:15:16 +00:00
|
|
|
s->scfunc = flip_execute_void;
|
|
|
|
#endif
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "flipnewbuffer") ||
|
|
|
|
!strcasecmp(input, "newbuffer"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = new_buffer_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2011-02-07 14:45:56 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "tofiles") ||
|
|
|
|
!strcasecmp(input, "browser"))
|
2014-06-23 20:03:25 +00:00
|
|
|
s->scfunc = to_files_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "gotodir"))
|
2014-06-23 20:03:25 +00:00
|
|
|
s->scfunc = goto_dir_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "firstfile"))
|
2014-06-20 10:48:26 +00:00
|
|
|
s->scfunc = do_first_file;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "lastfile"))
|
2011-02-07 14:45:56 +00:00
|
|
|
s->scfunc = do_last_file;
|
|
|
|
#endif
|
2014-06-28 15:00:29 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 15:34:10 +00:00
|
|
|
else {
|
2014-06-28 15:00:29 +00:00
|
|
|
s->scfunc = do_toggle_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
if (!strcasecmp(input, "nohelp"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = NO_HELP;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "constupdate"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = CONST_UPDATE;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "morespace"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = MORE_SPACE;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "smoothscroll"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = SMOOTH_SCROLL;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "softwrap"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = SOFTWRAP;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "whitespacedisplay"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = WHITESPACE_DISPLAY;
|
2014-06-28 15:00:29 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "nosyntax"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = NO_COLOR_SYNTAX;
|
|
|
|
#endif
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "smarthome"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = SMART_HOME;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "autoindent"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = AUTOINDENT;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "cuttoend"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = CUT_TO_END;
|
2014-06-28 15:00:29 +00:00
|
|
|
#ifndef DISABLE_WRAPPING
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "nowrap"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = NO_WRAP;
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "tabstospaces"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = TABS_TO_SPACES;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "backupfile"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = BACKUP_FILE;
|
2014-06-28 15:00:29 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "multibuffer"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = MULTIBUFFER;
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_MOUSE
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "mouse"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = USE_MOUSE;
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "noconvert"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = NO_CONVERT;
|
2014-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "suspendenable"))
|
2014-06-28 15:22:41 +00:00
|
|
|
s->toggle = SUSPEND;
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2014-06-28 15:34:10 +00:00
|
|
|
else {
|
2014-06-28 15:22:41 +00:00
|
|
|
free(s);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
2014-06-28 15:22:41 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
return s;
|
|
|
|
}
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2014-05-25 19:47:46 +00:00
|
|
|
/* Interpret a menu name and return the corresponding menu flag. */
|
2008-03-05 07:34:01 +00:00
|
|
|
int strtomenu(char *input)
|
|
|
|
{
|
|
|
|
if (!strcasecmp(input, "all"))
|
2014-04-16 09:12:13 +00:00
|
|
|
return (MMOST|MHELP|MYESNO);
|
2008-03-05 07:34:01 +00:00
|
|
|
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") ||
|
2014-04-13 12:16:37 +00:00
|
|
|
!strcasecmp(input, "replacewith"))
|
2014-04-16 09:26:15 +00:00
|
|
|
return MREPLACEWITH;
|
2008-03-05 07:34:01 +00:00
|
|
|
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") ||
|
2014-04-13 12:16:37 +00:00
|
|
|
!strcasecmp(input, "extcmd"))
|
2008-03-05 07:34:01 +00:00
|
|
|
return MEXTCMD;
|
2014-05-25 19:47:46 +00:00
|
|
|
#ifndef DISABLE_HELP
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "help"))
|
|
|
|
return MHELP;
|
2014-05-25 19:47:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_SPELLER
|
2015-03-25 16:20:45 +00:00
|
|
|
else if (!strcasecmp(input, "spell"))
|
2008-03-05 07:34:01 +00:00
|
|
|
return MSPELL;
|
2014-05-25 19:47:46 +00:00
|
|
|
#endif
|
2014-04-21 12:06:20 +00:00
|
|
|
else if (!strcasecmp(input, "linter"))
|
|
|
|
return MLINTER;
|
2014-05-25 19:47:46 +00:00
|
|
|
#ifndef DISABLE_BROWSER
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "browser"))
|
|
|
|
return MBROWSER;
|
|
|
|
else if (!strcasecmp(input, "whereisfile"))
|
|
|
|
return MWHEREISFILE;
|
|
|
|
else if (!strcasecmp(input, "gotodir"))
|
|
|
|
return MGOTODIR;
|
2014-05-25 19:47:46 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2014-05-25 19:47:46 +00:00
|
|
|
#endif /* !DISABLE_NANORC */
|
2006-04-20 22:36:10 +00:00
|
|
|
|
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);
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_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) {
|
2014-05-12 14:31:54 +00:00
|
|
|
regexlisttype *bob = syntaxes->extensions;
|
2002-07-19 01:08:59 +00:00
|
|
|
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);
|
|
|
|
}
|
2014-05-12 14:31:54 +00:00
|
|
|
while (syntaxes->headers != NULL) {
|
|
|
|
regexlisttype *bob = syntaxes->headers;
|
|
|
|
syntaxes->headers = bob->next;
|
|
|
|
free(bob->ext_regex);
|
|
|
|
if (bob->ext != NULL) {
|
|
|
|
regfree(bob->ext);
|
|
|
|
free(bob->ext);
|
|
|
|
}
|
|
|
|
free(bob);
|
|
|
|
}
|
|
|
|
while (syntaxes->magics != NULL) {
|
|
|
|
regexlisttype *bob = syntaxes->magics;
|
|
|
|
syntaxes->magics = bob->next;
|
|
|
|
free(bob->ext_regex);
|
|
|
|
if (bob->ext != NULL) {
|
|
|
|
regfree(bob->ext);
|
|
|
|
free(bob->ext);
|
|
|
|
}
|
|
|
|
free(bob);
|
|
|
|
}
|
2002-07-19 01:08:59 +00:00
|
|
|
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);
|
|
|
|
}
|
2014-04-04 11:59:03 +00:00
|
|
|
#endif /* !DISABLE_COLOR */
|
2014-06-19 21:01:39 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
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
|
2014-05-13 18:06:09 +00:00
|
|
|
/* Free the functions and shortcuts lists. */
|
|
|
|
while (allfuncs != NULL) {
|
|
|
|
subnfunc *f = allfuncs;
|
|
|
|
allfuncs = allfuncs->next;
|
|
|
|
free(f);
|
|
|
|
}
|
|
|
|
while (sclist != NULL) {
|
2014-05-13 18:31:13 +00:00
|
|
|
sc *s = sclist;
|
2014-05-13 18:06:09 +00:00
|
|
|
sclist = sclist->next;
|
2014-05-13 18:31:13 +00:00
|
|
|
free(s);
|
2014-05-13 18:06:09 +00:00
|
|
|
}
|
2014-04-13 20:50:20 +00:00
|
|
|
#ifndef DISABLE_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
|
|
|
}
|
2011-02-07 14:45:56 +00:00
|
|
|
|
2002-05-12 19:52:15 +00:00
|
|
|
#endif /* DEBUG */
|