2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
2016-09-03 10:14:08 +00:00
|
|
|
* global.c -- This file is part of GNU nano. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
2017-04-09 10:09:23 +00:00
|
|
|
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
2016-08-29 13:14:18 +00:00
|
|
|
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
|
|
|
* *
|
2016-08-29 15:10:49 +00:00
|
|
|
* GNU nano is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published *
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, *
|
|
|
|
* or (at your option) any later version. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
2016-08-29 15:10:49 +00:00
|
|
|
* GNU nano is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty *
|
|
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* See the GNU General Public License for more details. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
2016-08-29 15:10:49 +00:00
|
|
|
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
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
|
2016-12-14 19:37:03 +00:00
|
|
|
volatile sig_atomic_t the_window_resized = FALSE;
|
|
|
|
/* Set to TRUE by the handler whenever a SIGWINCH occurs. */
|
2006-05-10 13:41:53 +00:00
|
|
|
#endif
|
|
|
|
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifdef __linux__
|
2016-07-29 07:15:07 +00:00
|
|
|
bool console;
|
|
|
|
/* Whether we're running on a Linux VC (TRUE) or under X (FALSE). */
|
2016-08-11 10:37:11 +00:00
|
|
|
#endif
|
|
|
|
|
2014-06-30 18:04:33 +00:00
|
|
|
bool meta_key;
|
|
|
|
/* Whether the current keystroke is a Meta key. */
|
2016-04-24 09:28:28 +00:00
|
|
|
bool shift_held;
|
|
|
|
/* Whether Shift was being held together with a movement key. */
|
2016-04-12 08:24:57 +00:00
|
|
|
bool focusing = TRUE;
|
2015-03-28 17:01:46 +00:00
|
|
|
/* Whether an update of the edit window should center the cursor. */
|
2016-05-19 18:43:08 +00:00
|
|
|
|
2016-12-20 18:27:41 +00:00
|
|
|
bool as_an_at = TRUE;
|
|
|
|
/* Whether a 0x0A byte should be shown as a ^@ instead of a ^J. */
|
|
|
|
|
2016-10-20 08:44:29 +00:00
|
|
|
int margin = 0;
|
|
|
|
/* The amount of space reserved at the left for line numbers. */
|
|
|
|
int editwincols = -1;
|
|
|
|
/* The number of usable columns in the edit window: COLS - margin. */
|
|
|
|
|
2016-05-19 18:43:08 +00:00
|
|
|
message_type lastmessage = HUSH;
|
|
|
|
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
2014-06-30 18:04:33 +00:00
|
|
|
|
2016-12-07 04:13:47 +00:00
|
|
|
filestruct *pletion_line = NULL;
|
|
|
|
/* The line where the last completion was found, if any. */
|
|
|
|
|
2017-04-22 16:27:01 +00:00
|
|
|
bool inhelp = FALSE;
|
|
|
|
/* Whether we are in the help viewer. */
|
|
|
|
char *title = NULL;
|
|
|
|
/* When not NULL: the title of the current help text. */
|
|
|
|
|
2017-04-05 09:22:35 +00:00
|
|
|
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-04-24 09:28:28 +00:00
|
|
|
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
2017-04-05 09:22:35 +00:00
|
|
|
int shiftcontrolhome, shiftcontrolend;
|
2016-04-24 09:28:28 +00:00
|
|
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
2015-11-23 08:52:23 +00:00
|
|
|
#endif
|
|
|
|
|
2003-10-03 20:26:25 +00:00
|
|
|
#ifndef DISABLE_WRAPJUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
ssize_t fill = 0;
|
|
|
|
/* The column where we will wrap lines. */
|
2005-07-24 19:57:51 +00:00
|
|
|
ssize_t wrap_at = -CHARS_FROM_EOL;
|
2005-12-08 07:09:08 +00:00
|
|
|
/* The position where we will wrap lines. fill is equal to this
|
|
|
|
* if it's greater than zero, and equal to (COLS + this) if it
|
|
|
|
* isn't. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *last_search = NULL;
|
|
|
|
/* The last string we searched for. */
|
|
|
|
|
2016-04-30 19:22:16 +00:00
|
|
|
char *present_path = NULL;
|
|
|
|
/* The current browser directory when trying to do tab completion. */
|
|
|
|
|
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? */
|
|
|
|
|
|
|
|
filestruct *cutbuffer = NULL;
|
|
|
|
/* The buffer where we store cut text. */
|
2008-07-31 04:24:04 +00:00
|
|
|
filestruct *cutbottom = NULL;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The last line in the cutbuffer. */
|
2005-12-08 07:09:08 +00:00
|
|
|
partition *filepart = NULL;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* 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. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *whitespace = NULL;
|
2015-08-09 16:05:50 +00:00
|
|
|
/* The characters used when visibly showing tabs and spaces. */
|
2005-12-08 07:09:08 +00:00
|
|
|
int whitespace_len[2];
|
2015-08-09 16:05:50 +00:00
|
|
|
/* The length in bytes 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(). */
|
|
|
|
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. */
|
2016-09-03 10:14:08 +00:00
|
|
|
#endif /* !DISABLE_JUSTIFY */
|
2004-02-28 16:24:31 +00:00
|
|
|
|
2016-06-30 16:02:45 +00:00
|
|
|
char *word_chars = NULL;
|
|
|
|
/* Nonalphanumeric characters that also form words. */
|
|
|
|
|
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;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The width of a tab in spaces. The default 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 = ".";
|
2015-03-27 13:46:50 +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";
|
2015-03-27 13:46:50 +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
|
|
|
|
|
2016-04-25 19:14:18 +00:00
|
|
|
bool refresh_needed = FALSE;
|
|
|
|
/* Did a command mangle enough of the buffer that we should
|
|
|
|
* repaint the screen? */
|
2009-02-06 03:41:02 +00:00
|
|
|
|
2016-05-08 10:01:33 +00:00
|
|
|
int currmenu = MMOST;
|
|
|
|
/* The currently active menu, initialized to a dummy value. */
|
2008-03-05 07:34:01 +00:00
|
|
|
sc *sclist = NULL;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The start of the shortcuts list. */
|
2008-03-05 07:34:01 +00:00
|
|
|
subnfunc *allfuncs = NULL;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The start of the functions list. */
|
2014-04-26 18:41:43 +00:00
|
|
|
subnfunc *tailfunc;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The last function in the list. */
|
2014-04-26 19:01:18 +00:00
|
|
|
subnfunc *exitfunc;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* A pointer to the special Exit/Close item. */
|
2014-04-07 09:02:22 +00:00
|
|
|
subnfunc *uncutfunc;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* A 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. */
|
2016-01-12 19:20:40 +00:00
|
|
|
poshiststruct *position_history = NULL;
|
2014-02-25 21:27:22 +00:00
|
|
|
/* The cursor position history list. */
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
|
|
|
|
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-03-24 23:19:32 +00:00
|
|
|
|
2014-05-04 08:53:06 +00:00
|
|
|
int hilite_attribute = A_REVERSE;
|
2016-09-03 10:14:08 +00:00
|
|
|
/* The curses attribute we use to highlight something. */
|
2014-05-03 18:24:45 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
|
|
|
char* specified_color_combo[] = {};
|
|
|
|
/* The color combinations as specified in the rcfile. */
|
|
|
|
#endif
|
2016-07-12 07:35:48 +00:00
|
|
|
int 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
|
|
|
|
2016-09-03 10:14:08 +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)
|
2016-08-27 10:22:59 +00:00
|
|
|
if ((f->menus & menu) && first_sc_for(menu, f->scfunc) != NULL)
|
2008-03-05 07:34:01 +00:00
|
|
|
i++;
|
2016-08-27 10:22:59 +00:00
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
2015-12-23 16:34:44 +00:00
|
|
|
void discard_buffer(void)
|
|
|
|
{
|
|
|
|
}
|
2011-02-07 14:45:56 +00:00
|
|
|
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;
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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. */
|
2016-10-15 15:55:19 +00:00
|
|
|
void add_to_sclist(int menus, const char *scstring, const int keycode,
|
|
|
|
void (*func)(void), int toggle)
|
2000-06-06 05:53:49 +00:00
|
|
|
{
|
2014-07-27 19:13:46 +00:00
|
|
|
static sc *tailsc;
|
2016-09-01 07:36:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2015-07-06 17:51:17 +00:00
|
|
|
static int counter = 0;
|
2016-09-01 07:36:47 +00:00
|
|
|
#endif
|
2014-07-27 19:13:46 +00:00
|
|
|
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. */
|
2015-07-15 20:13:05 +00:00
|
|
|
s->menus = menus;
|
2014-07-27 19:13:46 +00:00
|
|
|
s->scfunc = func;
|
2016-09-01 07:36:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2008-03-05 07:34:01 +00:00
|
|
|
s->toggle = toggle;
|
2015-07-06 17:51:17 +00:00
|
|
|
if (toggle)
|
|
|
|
s->ordinal = ++counter;
|
2016-09-01 07:36:47 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
assign_keyinfo(s, scstring, keycode);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2016-07-24 19:49:07 +00:00
|
|
|
fprintf(stderr, "Setting keycode to %d for shortcut \"%s\" in menus %x\n", s->keycode, scstring, s->menus);
|
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)
|
2015-07-15 20:13:05 +00:00
|
|
|
if ((s->menus & menu) && s->scfunc == func)
|
2014-07-27 19:23:41 +00:00
|
|
|
return s;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
|
|
|
#endif
|
|
|
|
/* Otherwise... */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-12-22 11:02:11 +00:00
|
|
|
/* Return the first keycode that is bound to the given function in the
|
|
|
|
* current menu, if any; otherwise, return the given default value. */
|
|
|
|
int the_code_for(void (*func)(void), int defaultval)
|
2008-03-09 02:52:40 +00:00
|
|
|
{
|
|
|
|
const sc *s = first_sc_for(currmenu, func);
|
|
|
|
|
2016-12-22 11:02:11 +00:00
|
|
|
if (s == NULL)
|
|
|
|
return defaultval;
|
|
|
|
|
|
|
|
meta_key = s->meta;
|
|
|
|
return s->keycode;
|
2008-03-09 02:52:40 +00:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-07-23 12:42:40 +00:00
|
|
|
/* Set the string and its corresponding keycode for the given shortcut s. */
|
2016-10-15 15:55:19 +00:00
|
|
|
void assign_keyinfo(sc *s, const char *keystring, const int keycode)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2016-07-30 10:44:23 +00:00
|
|
|
s->keystr = keystring;
|
2016-07-23 12:42:40 +00:00
|
|
|
s->meta = (keystring[0] == 'M');
|
2016-07-23 10:15:39 +00:00
|
|
|
|
2016-07-25 07:33:43 +00:00
|
|
|
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
|
|
|
|
|
2016-10-15 15:55:19 +00:00
|
|
|
if (keycode)
|
|
|
|
s->keycode = keycode;
|
|
|
|
else if (keystring[0] == '^') {
|
2016-07-25 08:30:41 +00:00
|
|
|
if (strcasecmp(keystring, "^Space") == 0)
|
|
|
|
s->keycode = 0;
|
2016-10-11 08:50:04 +00:00
|
|
|
else
|
|
|
|
s->keycode = keystring[1] - 64;
|
2016-07-25 08:30:41 +00:00
|
|
|
} else if (s->meta) {
|
|
|
|
if (strcasecmp(keystring, "M-Space") == 0)
|
|
|
|
s->keycode = (int)' ';
|
2016-10-15 15:55:19 +00:00
|
|
|
else
|
2017-02-12 17:58:48 +00:00
|
|
|
s->keycode = tolower((unsigned char)keystring[2]);
|
2016-07-25 08:30:41 +00:00
|
|
|
} else if (keystring[0] == 'F')
|
2016-07-30 10:44:23 +00:00
|
|
|
s->keycode = KEY_F0 + atoi(&keystring[1]);
|
|
|
|
else if (!strcasecmp(keystring, "Ins"))
|
2016-07-25 08:27:02 +00:00
|
|
|
s->keycode = KEY_IC;
|
2016-07-30 10:44:23 +00:00
|
|
|
else if (!strcasecmp(keystring, "Del"))
|
2016-07-25 08:27:02 +00:00
|
|
|
s->keycode = KEY_DC;
|
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
|
|
|
|
|
2015-07-30 19:51:08 +00:00
|
|
|
/* These four tags are used elsewhere too, so they are global. */
|
|
|
|
/* TRANSLATORS: Try to keep the next fifteen strings at most 10 characters. */
|
2014-04-26 19:01:18 +00:00
|
|
|
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");
|
2016-01-17 16:25:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2014-04-07 09:02:22 +00:00
|
|
|
const char *unjust_tag = N_("Unjustify");
|
|
|
|
#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
|
|
|
{
|
2015-07-30 19:51:08 +00:00
|
|
|
const char *read_file_tag = N_("Read File");
|
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");
|
2015-04-17 10:06:03 +00:00
|
|
|
const char *prev_page_tag = N_("Prev Page");
|
|
|
|
const char *next_page_tag = N_("Next Page");
|
2014-04-27 15:26:25 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2015-07-30 19:51:08 +00:00
|
|
|
const char *justify_tag = N_("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");
|
2015-07-30 19:51:08 +00:00
|
|
|
/* TRANSLATORS: Try to keep this string at most 12 characters. */
|
|
|
|
const char *whereis_next_tag = N_("WhereIs Next");
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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
|
2016-05-02 07:34:23 +00:00
|
|
|
const char *nano_browser_whereis_msg = N_("Search for a string");
|
|
|
|
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
2017-02-27 18:16:06 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-05-12 08:10:04 +00:00
|
|
|
const char *nano_browser_lefthand_msg = N_("Go to lefthand column");
|
|
|
|
const char *nano_browser_righthand_msg = N_("Go to righthand column");
|
2017-04-03 10:32:27 +00:00
|
|
|
const char *nano_browser_toprow_msg = N_("Go to first row in this column");
|
|
|
|
const char *nano_browser_bottomrow_msg = N_("Go to last row in this column");
|
2017-02-27 18:16:06 +00:00
|
|
|
#endif
|
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");
|
2017-02-27 18:10:39 +00:00
|
|
|
const char *nano_whereis_next_msg = N_("Repeat the last search");
|
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");
|
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_back_msg = N_("Go back one character");
|
2016-02-05 12:01:02 +00:00
|
|
|
const char *nano_forward_msg = N_("Go forward one character");
|
2007-02-01 13:40:59 +00:00
|
|
|
const char *nano_prevword_msg = N_("Go back one word");
|
2016-02-05 12:01:02 +00:00
|
|
|
const char *nano_nextword_msg = N_("Go forward one word");
|
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");
|
2016-06-25 13:16:52 +00:00
|
|
|
const char *nano_prevblock_msg = N_("Go to previous block of text");
|
|
|
|
const char *nano_nextblock_msg = N_("Go to next block of text");
|
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
|
2015-07-31 11:52:26 +00:00
|
|
|
const char *nano_cut_word_left_msg =
|
|
|
|
N_("Cut backward from cursor to word start");
|
|
|
|
const char *nano_cut_word_right_msg =
|
|
|
|
N_("Cut forward from cursor to next word start");
|
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 =
|
2015-07-26 09:29:42 +00:00
|
|
|
N_("Suspend the editor (if suspension is enabled)");
|
2016-12-07 12:10:40 +00:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
|
|
|
const char *nano_completion_msg = N_("Try and complete the current word");
|
|
|
|
#endif
|
2016-12-07 18:56:27 +00:00
|
|
|
#ifdef ENABLE_COMMENT
|
|
|
|
const char *nano_comment_msg =
|
|
|
|
N_("Comment/uncomment the current line or marked lines");
|
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2015-07-25 19:25:50 +00:00
|
|
|
const char *nano_savefile_msg = N_("Save file without prompting");
|
2015-07-26 09:23:24 +00:00
|
|
|
const char *nano_findprev_msg = N_("Search next occurrence backward");
|
|
|
|
const char *nano_findnext_msg = N_("Search next occurrence forward");
|
2017-02-27 18:10:39 +00:00
|
|
|
#endif
|
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");
|
|
|
|
const char *nano_regexp_msg =
|
|
|
|
N_("Toggle the use of regular expressions");
|
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");
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2017-04-25 18:42:05 +00:00
|
|
|
const char *nano_newbuffer_msg = N_("Toggle the use of a new buffer");
|
2004-07-12 03:10:30 +00:00
|
|
|
#endif
|
2017-04-25 18:42:05 +00:00
|
|
|
#endif
|
|
|
|
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
|
2004-07-12 03:10:30 +00:00
|
|
|
#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-03-27 16:55:49 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
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
|
2015-03-27 16:55:49 +00:00
|
|
|
#endif
|
2017-04-25 15:51:45 +00:00
|
|
|
#endif /* ENABLE_HELP */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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
|
|
|
|
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),
|
2016-05-05 11:27:07 +00:00
|
|
|
N_("Cancel"), IFSCHELP(nano_cancel_msg), BLANKAFTER, 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
|
|
|
|
2015-07-30 10:37:28 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
|
|
|
if (!ISSET(RESTRICTED)) {
|
|
|
|
#else
|
|
|
|
/* If we can't replace Insert with Justify, show Insert anyway, to
|
|
|
|
* keep the help items nicely paired also in restricted mode. */
|
|
|
|
if (TRUE) {
|
|
|
|
#endif
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_insertfile_void, MMAIN,
|
|
|
|
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
|
2015-07-30 10:37:28 +00:00
|
|
|
/* We allow inserting files in view mode if multibuffer mode
|
|
|
|
* is switched on, so that we can view multiple files. */
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2015-07-30 11:29:45 +00:00
|
|
|
VIEW);
|
2002-01-02 15:12:21 +00:00
|
|
|
#else
|
2015-07-30 11:29:45 +00:00
|
|
|
NOVIEW);
|
2002-01-02 15:12:21 +00:00
|
|
|
#endif
|
2015-07-30 10:37:28 +00:00
|
|
|
} else {
|
|
|
|
#ifndef DISABLE_JUSTIFY
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2015-07-30 19:51:08 +00:00
|
|
|
justify_tag, IFSCHELP(nano_justify_msg), BLANKAFTER, NOVIEW);
|
2015-07-30 10:37:28 +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
|
|
|
|
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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
|
|
|
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_funcs(do_search, MHELP, whereis_tag, "x", 0, VIEW);
|
|
|
|
add_to_funcs(do_research, MHELP, whereis_next_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
|
|
|
|
2015-07-30 11:29:45 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2014-04-27 19:51:03 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2015-07-30 19:51:08 +00:00
|
|
|
justify_tag, 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
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_spell, MMAIN,
|
|
|
|
N_("To Spell"), IFSCHELP(nano_spell_msg), TOGETHER, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_linter, MMAIN,
|
|
|
|
N_("To Linter"), IFSCHELP(nano_lint_msg), TOGETHER, NOVIEW);
|
2015-03-27 16:55:49 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2015-07-30 11:29:45 +00:00
|
|
|
add_to_funcs(do_formatter, MMAIN,
|
|
|
|
N_("Formatter"), IFSCHELP(nano_formatter_msg), BLANKAFTER, NOVIEW);
|
2014-02-24 10:18:15 +00:00
|
|
|
#endif
|
2015-03-27 16:55:49 +00:00
|
|
|
#endif
|
2015-07-30 11:29:45 +00:00
|
|
|
}
|
2014-02-24 10:18:15 +00:00
|
|
|
|
2016-09-03 11:41:02 +00:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN,
|
|
|
|
N_("Cur Pos"), IFSCHELP(nano_cursorpos_msg), TOGETHER, VIEW);
|
|
|
|
|
|
|
|
#if (!defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
|
|
|
|
defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
|
|
|
|
/* Conditionally placing this one here or further on, to keep the
|
|
|
|
* help items nicely paired in most conditions. */
|
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN,
|
|
|
|
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, VIEW);
|
|
|
|
#endif
|
|
|
|
|
2017-03-23 10:31:56 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_undo, MMAIN,
|
|
|
|
N_("Undo"), IFSCHELP(nano_undo_msg), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_redo, MMAIN,
|
|
|
|
N_("Redo"), IFSCHELP(nano_redo_msg), BLANKAFTER, NOVIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_mark, MMAIN,
|
|
|
|
N_("Mark Text"), IFSCHELP(nano_mark_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_copy_text, MMAIN,
|
|
|
|
N_("Copy Text"), IFSCHELP(nano_copy_msg), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
|
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-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-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
|
|
|
|
2014-06-23 18:30:35 +00:00
|
|
|
add_to_funcs(flip_replace_void, MWHEREIS,
|
2016-05-16 14:55:11 +00:00
|
|
|
replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2014-06-23 18:30:35 +00:00
|
|
|
add_to_funcs(flip_replace_void, MREPLACE,
|
2016-05-16 14:55:11 +00:00
|
|
|
N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, 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 19:51:03 +00:00
|
|
|
|
2016-09-03 11:32:49 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, 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
|
|
|
|
2016-09-12 10:49:46 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-12-05 18:53:41 +00:00
|
|
|
add_to_funcs(do_find_bracket, MMAIN,
|
|
|
|
N_("To Bracket"), IFSCHELP(nano_bracket_msg), BLANKAFTER, VIEW);
|
|
|
|
|
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
|
|
|
|
2016-12-05 18:53:41 +00:00
|
|
|
add_to_funcs(do_findprevious, MMAIN,
|
|
|
|
N_("Previous"), IFSCHELP(nano_findprev_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_findnext, MMAIN,
|
|
|
|
N_("Next"), IFSCHELP(nano_findnext_msg), BLANKAFTER, VIEW);
|
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
|
|
|
|
|
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-21 02:05:09 +00:00
|
|
|
|
2017-01-22 20:09:15 +00:00
|
|
|
add_to_funcs(do_home_void, MMAIN,
|
2014-07-01 18:52:21 +00:00
|
|
|
N_("Home"), IFSCHELP(nano_home_msg), TOGETHER, VIEW);
|
2017-01-22 20:09:15 +00:00
|
|
|
add_to_funcs(do_end_void, MMAIN,
|
2017-03-23 10:31:56 +00:00
|
|
|
N_("End"), IFSCHELP(nano_end_msg), BLANKAFTER, 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,
|
2017-03-23 10:31:56 +00:00
|
|
|
next_line_tag, IFSCHELP(nano_nextline_msg), TOGETHER, VIEW);
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_scroll_up, MMAIN,
|
|
|
|
N_("Scroll Up"), IFSCHELP(nano_scrollup_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_scroll_down, MMAIN,
|
|
|
|
N_("Scroll Down"), IFSCHELP(nano_scrolldown_msg), BLANKAFTER, VIEW);
|
|
|
|
#endif
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2016-06-25 13:16:52 +00:00
|
|
|
add_to_funcs(do_prev_block, MMAIN,
|
|
|
|
N_("Prev Block"), IFSCHELP(nano_prevblock_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_block, MMAIN,
|
|
|
|
N_("Next Block"), IFSCHELP(nano_nextblock_msg), TOGETHER, VIEW);
|
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,
|
2017-03-23 10:31:56 +00:00
|
|
|
N_("End of Par"), IFSCHELP(nano_paraend_msg), BLANKAFTER, VIEW);
|
2006-04-24 20:50:52 +00:00
|
|
|
#endif
|
2005-01-01 07:43:32 +00:00
|
|
|
|
2017-03-23 10:31:56 +00:00
|
|
|
add_to_funcs(do_page_up, MMAIN|MHELP,
|
|
|
|
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_page_down, MMAIN|MHELP,
|
|
|
|
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
|
|
|
N_("First Line"), IFSCHELP(nano_firstline_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
|
|
|
N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
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
|
|
|
|
|
2016-09-03 11:32:49 +00:00
|
|
|
#if (defined(DISABLE_JUSTIFY) && (!defined(DISABLE_SPELLER) || !defined(DISABLE_COLOR)) || \
|
|
|
|
!defined(DISABLE_JUSTIFY) && defined(DISABLE_SPELLER) && defined(DISABLE_COLOR))
|
2016-05-14 10:29:51 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN,
|
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
|
|
|
|
|
2016-09-12 10:49:46 +00:00
|
|
|
#ifdef NANO_TINY
|
|
|
|
/* Place this one here only in the tiny version; otherwise further up. */
|
|
|
|
add_to_funcs(do_research, MMAIN,
|
|
|
|
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
|
|
|
#endif
|
|
|
|
|
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);
|
2015-11-11 19:56:35 +00:00
|
|
|
add_to_funcs(do_enter, MMAIN,
|
2015-07-31 11:52:26 +00:00
|
|
|
N_("Enter"), IFSCHELP(nano_enter_msg), BLANKAFTER, 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
|
2015-07-31 11:52:26 +00:00
|
|
|
add_to_funcs(do_cut_prev_word, MMAIN,
|
2016-02-05 12:27:54 +00:00
|
|
|
/* TRANSLATORS: The next two strings refer to cutting words. */
|
2015-07-31 11:52:26 +00:00
|
|
|
N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_cut_next_word, MMAIN,
|
|
|
|
N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW);
|
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
|
|
|
|
2017-04-11 11:15:00 +00:00
|
|
|
add_to_funcs(do_verbatim_input, MMAIN,
|
|
|
|
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), BLANKAFTER, NOVIEW);
|
|
|
|
|
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
|
|
|
|
2017-03-23 10:31:56 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_indent_void, MMAIN,
|
|
|
|
N_("Indent Text"), IFSCHELP(nano_indent_msg), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_unindent, MMAIN,
|
|
|
|
N_("Unindent Text"), IFSCHELP(nano_unindent_msg), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
2016-12-07 12:10:40 +00:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
|
|
|
add_to_funcs(complete_a_word, MMAIN,
|
|
|
|
N_("Complete"), IFSCHELP(nano_completion_msg), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
2016-05-25 20:13:50 +00:00
|
|
|
#ifdef ENABLE_COMMENT
|
|
|
|
add_to_funcs(do_comment, MMAIN,
|
|
|
|
N_("Comment Lines"), IFSCHELP(nano_comment_msg), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
2015-07-25 19:25:50 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_savefile, MMAIN,
|
|
|
|
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
|
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),
|
2016-05-14 10:29:51 +00:00
|
|
|
N_("NextHstory"), IFSCHELP(nano_next_history_msg), BLANKAFTER, VIEW);
|
|
|
|
#endif
|
|
|
|
|
2016-09-03 11:32:49 +00:00
|
|
|
#ifdef DISABLE_JUSTIFY
|
2016-05-14 10:29:51 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, MWHEREIS,
|
|
|
|
gotoline_tag, IFSCHELP(nano_gotoline_msg), BLANKAFTER, 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
|
2016-05-17 09:33:21 +00:00
|
|
|
add_to_funcs(dos_format_void, MWRITEFILE,
|
2015-08-13 19:29:55 +00:00
|
|
|
N_("DOS Format"), IFSCHELP(nano_dos_msg), TOGETHER, NOVIEW);
|
2016-05-17 09:33:21 +00:00
|
|
|
add_to_funcs(mac_format_void, MWRITEFILE,
|
2015-08-13 19:29:55 +00:00
|
|
|
N_("Mac Format"), IFSCHELP(nano_mac_msg), TOGETHER, NOVIEW);
|
|
|
|
|
|
|
|
/* If we're using restricted mode, the Append, Prepend, and Backup toggles
|
|
|
|
* are disabled. The first and second are not useful as they only allow
|
|
|
|
* reduplicating the current file, and the third is not allowed as it
|
|
|
|
* would write to a file not specified on the command line. */
|
2014-03-27 21:35:18 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2015-03-27 13:46:50 +00:00
|
|
|
add_to_funcs(append_void, MWRITEFILE,
|
|
|
|
N_("Append"), IFSCHELP(nano_append_msg), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(prepend_void, MWRITEFILE,
|
|
|
|
N_("Prepend"), IFSCHELP(nano_prepend_msg), TOGETHER, NOVIEW);
|
2002-04-16 03:15:47 +00:00
|
|
|
|
2015-03-27 13:46:50 +00:00
|
|
|
add_to_funcs(backup_file_void, MWRITEFILE,
|
2016-05-05 11:27:07 +00:00
|
|
|
N_("Backup File"), IFSCHELP(nano_backup_msg), BLANKAFTER, 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)) {
|
2015-03-27 13:46:50 +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
|
|
|
|
2015-03-27 13:46:50 +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,
|
2017-04-25 18:42:05 +00:00
|
|
|
N_("New Buffer"), IFSCHELP(nano_newbuffer_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
|
|
|
|
2015-04-17 10:06:03 +00:00
|
|
|
add_to_funcs(do_page_up, MBROWSER,
|
|
|
|
prev_page_tag, IFSCHELP(nano_prevpage_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_page_down, MBROWSER,
|
|
|
|
next_page_tag, IFSCHELP(nano_nextpage_msg), TOGETHER, VIEW);
|
|
|
|
|
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),
|
2015-04-17 10:06:03 +00:00
|
|
|
N_("Last File"), IFSCHELP(nano_lastfile_msg), BLANKAFTER, VIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
#endif
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2015-12-23 16:34:44 +00:00
|
|
|
add_to_funcs(discard_buffer, MWRITEFILE,
|
|
|
|
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
|
|
|
|
|
2017-02-27 18:16:06 +00:00
|
|
|
#ifndef 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);
|
2016-05-02 07:34:23 +00:00
|
|
|
add_to_funcs(total_refresh, MBROWSER,
|
|
|
|
refresh_tag, IFSCHELP(nano_browser_refresh_msg), BLANKAFTER, VIEW);
|
2016-05-17 10:48:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-05-12 08:10:04 +00:00
|
|
|
add_to_funcs(do_prev_word_void, MBROWSER,
|
|
|
|
N_("Left Column"), IFSCHELP(nano_browser_lefthand_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_word_void, MBROWSER,
|
2017-04-03 10:32:27 +00:00
|
|
|
N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_prev_block, MBROWSER,
|
|
|
|
N_("Top Row"), IFSCHELP(nano_browser_toprow_msg), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_block, MBROWSER,
|
|
|
|
N_("Bottom Row"), IFSCHELP(nano_browser_bottomrow_msg), BLANKAFTER, VIEW);
|
2016-05-02 07:34:23 +00:00
|
|
|
#endif
|
2016-05-17 10:48:47 +00:00
|
|
|
#endif
|
2014-04-27 19:51:03 +00:00
|
|
|
|
|
|
|
#ifndef DISABLE_COLOR
|
|
|
|
add_to_funcs(do_page_up, MLINTER,
|
2016-02-05 12:27:54 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
|
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. */
|
|
|
|
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MMOST & ~MFINDINHELP, "^G", 0, do_help_void, 0);
|
|
|
|
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "F14", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMOST, "^K", 0, do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^U", 0, do_uncut_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "F10", 0, do_uncut_text, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2008-05-31 22:49:55 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", 0, do_spell, 0);
|
|
|
|
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
|
2014-05-09 15:14:29 +00:00
|
|
|
#else
|
|
|
|
#ifndef DISABLE_COLOR
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "^T", 0, do_linter, 0);
|
|
|
|
add_to_sclist(MMAIN, "F12", 0, do_linter, 0);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "F13", 0, do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-\\", 0, do_first_line, 0);
|
2017-04-05 09:22:35 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, do_first_line, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "M-|", 0, do_first_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-/", 0, do_last_line, 0);
|
2017-04-05 09:22:35 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, do_last_line, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "M-?", 0, do_last_line, 0);
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_research, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F16", 0, do_research, 0);
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
2017-04-07 18:00:44 +00:00
|
|
|
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
2017-04-04 18:34:06 +00:00
|
|
|
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
2017-04-07 18:00:44 +00:00
|
|
|
add_to_sclist(MMAIN, "F15", 0, do_mark, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0);
|
2017-04-04 18:34:06 +00:00
|
|
|
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-}", 0, do_indent_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-E", 0, do_redo, 0);
|
2016-12-07 12:10:40 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2016-12-07 04:13:47 +00:00
|
|
|
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
2016-05-25 20:13:50 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COMMENT
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMOST, "^B", 0, do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "^F", 0, do_right, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
2016-10-12 10:21:44 +00:00
|
|
|
if (using_utf8()) {
|
2017-04-04 18:53:08 +00:00
|
|
|
add_to_sclist(MMOST, "\xE2\x86\x90", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "\xE2\x86\x92", KEY_RIGHT, do_right, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2017-04-04 18:53:08 +00:00
|
|
|
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
2016-10-12 10:21:44 +00:00
|
|
|
}
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
2017-01-22 20:09:15 +00:00
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home_void, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home_void, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end_void, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end_void, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
2016-10-12 10:21:44 +00:00
|
|
|
if (using_utf8()) {
|
2017-04-04 18:53:08 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x91", KEY_UP, do_up_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x93", KEY_DOWN, do_down_void, 0);
|
2017-04-03 10:32:27 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2017-04-04 18:53:08 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
|
2017-04-03 10:32:27 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^Up", CONTROL_UP, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
2016-10-12 10:21:44 +00:00
|
|
|
}
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
|
2008-06-29 06:22:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-(", 0, do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-9", 0, do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-)", 0, do_para_end_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-0", 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
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M--", 0, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-_", 0, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-=", 0, do_scroll_down, 0);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
2014-04-03 20:23:07 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-<", 0, switch_to_prev_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-,", 0, switch_to_prev_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M->", 0, switch_to_next_buffer_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-.", 0, switch_to_next_buffer_void, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMOST, "M-V", 0, do_verbatim_input, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-T", 0, do_cut_till_eof, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-D", 0, do_wordlinechar_count, 0);
|
2014-04-07 09:44:52 +00:00
|
|
|
#endif
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MWHEREIS, "M-J", 0, do_full_justify, 0);
|
2011-02-07 14:45:56 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "^L", 0, total_refresh, 0);
|
|
|
|
add_to_sclist(MMAIN, "^Z", 0, 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. */
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
|
2017-04-17 09:51:48 +00:00
|
|
|
add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-O", 0, do_toggle_void, MORE_SPACE);
|
|
|
|
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SMOOTH_SCROLL);
|
|
|
|
add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
|
2016-10-20 08:44:29 +00:00
|
|
|
#ifdef ENABLE_LINENUMBERS
|
|
|
|
add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
|
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Y", 0, 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. */
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-H", 0, do_toggle_void, SMART_HOME);
|
|
|
|
add_to_sclist(MMAIN, "M-I", 0, do_toggle_void, AUTOINDENT);
|
|
|
|
add_to_sclist(MMAIN, "M-K", 0, do_toggle_void, CUT_TO_END);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_WRAPPING
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Q", 0, 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. */
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-B", 0, do_toggle_void, BACKUP_FILE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#ifndef DISABLE_MULTIBUFFER
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-F", 0, do_toggle_void, MULTIBUFFER);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_MOUSE
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-M", 0, do_toggle_void, USE_MOUSE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "M-N", 0, do_toggle_void, NO_CONVERT);
|
|
|
|
add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPEND);
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2014-03-17 12:15:23 +00:00
|
|
|
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MMAIN, "^Q", 0, xon_complaint, 0);
|
|
|
|
add_to_sclist(MMAIN, "^S", 0, xoff_complaint, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^W", 0, do_para_begin_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH, "^O", 0, do_para_end_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWHEREIS, "^T", 0, do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MGOTOLINE, "^T", 0, gototext_void, 0);
|
2014-06-19 20:05:24 +00:00
|
|
|
#ifndef DISABLE_HISTORIES
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "^P", 0, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "^N", 0, get_history_newer_void, 0);
|
2017-04-09 21:30:38 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
|
|
|
if (using_utf8()) {
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "\xE2\x86\x91", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "\xE2\x86\x93", KEY_DOWN, get_history_newer_void, 0);
|
2017-04-09 21:30:38 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2017-04-22 16:27:01 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Up", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Down", KEY_DOWN, get_history_newer_void, 0);
|
2017-04-09 21:30:38 +00:00
|
|
|
}
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_BROWSER
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
|
|
|
|
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, do_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, do_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "Home", KEY_HOME, do_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "End", KEY_END, do_last_file, 0);
|
2017-04-05 09:22:35 +00:00
|
|
|
add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, do_first_file, 0);
|
2017-04-26 08:03:13 +00:00
|
|
|
add_to_sclist(MBROWSER, "^End", CONTROL_END, do_last_file, 0);
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER, "^L", 0, total_refresh, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
#endif
|
2015-12-23 16:34:44 +00:00
|
|
|
if (ISSET(TEMP_FILE))
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
|
2017-04-19 11:24:41 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
|
2017-04-19 11:24:41 +00:00
|
|
|
/* In restricted mode, don't allow Appending, Prepending, nor making
|
|
|
|
* backups, nor executing a command, nor opening a new buffer. */
|
2015-08-13 19:29:55 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
|
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0);
|
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0);
|
2015-08-13 19:29:55 +00:00
|
|
|
}
|
2017-04-19 11:24:41 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DISABLE_BROWSER
|
|
|
|
/* In restricted mode, don't allow entering the file browser. */
|
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
|
|
|
|
#endif
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
|
2015-11-08 19:40:13 +00:00
|
|
|
/* Allow exiting from the file browser and the help viewer with
|
|
|
|
* the same key as they were entered. */
|
|
|
|
#ifndef DISABLE_BROWSER
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
2015-11-08 19:40:13 +00:00
|
|
|
#endif
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_HELP
|
2016-10-15 15:55:19 +00:00
|
|
|
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0);
|
|
|
|
add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMOST, "^I", 0, do_tab, 0);
|
|
|
|
add_to_sclist(MMOST, "Tab", TAB_CODE, do_tab, 0);
|
|
|
|
add_to_sclist(MMOST, "^M", 0, do_enter, 0);
|
|
|
|
add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0);
|
|
|
|
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
|
|
|
add_to_sclist(MMOST, "Del", 0, do_delete, 0);
|
|
|
|
add_to_sclist(MMOST, "^H", 0, do_backspace, 0);
|
|
|
|
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, 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
|
|
|
|
}
|
2016-01-13 20:32:40 +00:00
|
|
|
#endif /* !DISABLE_COLOR */
|
2014-02-24 10:18:15 +00:00
|
|
|
|
2016-01-04 09:52:43 +00:00
|
|
|
const subnfunc *sctofunc(const sc *s)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2016-01-04 09:52:43 +00:00
|
|
|
subnfunc *f = allfuncs;
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2016-01-04 09:52:43 +00:00
|
|
|
while (f != NULL && f->scfunc != s->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) {
|
2015-03-27 13:46:50 +00:00
|
|
|
case NO_HELP:
|
|
|
|
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
|
|
|
* they are best kept shorter than 40 characters, but may be longer. */
|
|
|
|
return N_("Help mode");
|
2017-04-17 09:51:48 +00:00
|
|
|
case CONSTANT_SHOW:
|
2015-03-27 13:46:50 +00:00
|
|
|
return N_("Constant cursor position display");
|
|
|
|
case MORE_SPACE:
|
|
|
|
return N_("Use of one more line for editing");
|
|
|
|
case SMOOTH_SCROLL:
|
|
|
|
return N_("Smooth scrolling");
|
|
|
|
case SOFTWRAP:
|
|
|
|
return N_("Soft wrapping of overlong lines");
|
|
|
|
case WHITESPACE_DISPLAY:
|
|
|
|
return N_("Whitespace display");
|
|
|
|
case NO_COLOR_SYNTAX:
|
|
|
|
return N_("Color syntax highlighting");
|
|
|
|
case SMART_HOME:
|
|
|
|
return N_("Smart home key");
|
|
|
|
case AUTOINDENT:
|
|
|
|
return N_("Auto indent");
|
|
|
|
case CUT_TO_END:
|
|
|
|
return N_("Cut to end");
|
|
|
|
case NO_WRAP:
|
|
|
|
return N_("Hard wrapping of overlong lines");
|
|
|
|
case TABS_TO_SPACES:
|
|
|
|
return N_("Conversion of typed tabs to spaces");
|
|
|
|
case BACKUP_FILE:
|
|
|
|
return N_("Backup files");
|
|
|
|
case MULTIBUFFER:
|
2015-04-18 16:07:53 +00:00
|
|
|
return N_("Reading file into separate buffer");
|
2015-03-27 13:46:50 +00:00
|
|
|
case USE_MOUSE:
|
|
|
|
return N_("Mouse support");
|
|
|
|
case NO_CONVERT:
|
|
|
|
return N_("No conversion from DOS/Mac format");
|
|
|
|
case SUSPEND:
|
|
|
|
return N_("Suspension");
|
2016-10-20 08:44:29 +00:00
|
|
|
case LINE_NUMBERS:
|
|
|
|
return N_("Line numbering");
|
2015-03-27 13:46:50 +00:00
|
|
|
default:
|
|
|
|
return "?????";
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
}
|
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. */
|
2016-01-04 09:12:21 +00:00
|
|
|
sc *strtosc(const char *input)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2016-09-01 07:36:47 +00:00
|
|
|
sc *s = nmalloc(sizeof(sc));
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2016-09-01 07:36:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2016-08-06 19:16:41 +00:00
|
|
|
s->toggle = 0;
|
2016-09-01 07:36:47 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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;
|
2015-12-23 16:34:44 +00:00
|
|
|
else if (!strcasecmp(input, "discardbuffer"))
|
|
|
|
s->scfunc = discard_buffer;
|
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;
|
2015-07-25 19:25:50 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
else if (!strcasecmp(input, "savefile"))
|
|
|
|
s->scfunc = do_savefile;
|
|
|
|
#endif
|
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-26 20:16:17 +00:00
|
|
|
else if (!strcasecmp(input, "searchagain") ||
|
2016-09-03 18:12:29 +00:00
|
|
|
!strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */
|
2014-04-26 20:16:17 +00:00
|
|
|
s->scfunc = do_research;
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifndef NANO_TINY
|
2015-07-26 09:23:24 +00:00
|
|
|
else if (!strcasecmp(input, "findprevious"))
|
|
|
|
s->scfunc = do_findprevious;
|
|
|
|
else if (!strcasecmp(input, "findnext"))
|
|
|
|
s->scfunc = do_findnext;
|
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
|
2015-03-27 15:34:41 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2015-03-25 19:33:00 +00:00
|
|
|
else if (!strcasecmp(input, "linter"))
|
|
|
|
s->scfunc = do_linter;
|
2015-03-27 15:34:41 +00:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
else if (!strcasecmp(input, "curpos") ||
|
2016-09-03 18:12:29 +00:00
|
|
|
!strcasecmp(input, "cursorpos")) /* Deprecated. Remove in 2018. */
|
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
|
2016-05-25 20:13:50 +00:00
|
|
|
#ifdef ENABLE_COMMENT
|
|
|
|
else if (!strcasecmp(input, "comment"))
|
|
|
|
s->scfunc = do_comment;
|
|
|
|
#endif
|
2016-12-07 12:20:36 +00:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
|
|
|
else if (!strcasecmp(input, "complete"))
|
|
|
|
s->scfunc = complete_a_word;
|
|
|
|
#endif
|
2008-03-16 12:55:41 +00:00
|
|
|
#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;
|
2015-07-31 11:52:26 +00:00
|
|
|
else if (!strcasecmp(input, "cutwordleft"))
|
|
|
|
s->scfunc = do_cut_prev_word;
|
|
|
|
else if (!strcasecmp(input, "cutwordright"))
|
|
|
|
s->scfunc = do_cut_next_word;
|
2016-06-25 13:16:52 +00:00
|
|
|
else if (!strcasecmp(input, "prevblock"))
|
|
|
|
s->scfunc = do_prev_block;
|
|
|
|
else if (!strcasecmp(input, "nextblock"))
|
|
|
|
s->scfunc = do_next_block;
|
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"))
|
2017-01-22 20:09:15 +00:00
|
|
|
s->scfunc = do_home_void;
|
2008-03-09 02:52:40 +00:00
|
|
|
else if (!strcasecmp(input, "end"))
|
2017-01-22 20:09:15 +00:00
|
|
|
s->scfunc = do_end_void;
|
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"))
|
2015-11-11 19:56:35 +00:00
|
|
|
s->scfunc = do_enter;
|
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-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "regexp") ||
|
2016-09-03 18:12:29 +00:00
|
|
|
!strcasecmp(input, "regex")) /* Deprecated. Remove in 2018. */
|
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-06-28 15:34:10 +00:00
|
|
|
else if (!strcasecmp(input, "flipreplace") ||
|
2016-09-03 18:12:29 +00:00
|
|
|
!strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */
|
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
|
2017-04-19 11:24:41 +00:00
|
|
|
#ifndef NANO_TINY
|
2014-06-28 15:34:10 +00:00
|
|
|
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-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") ||
|
2016-09-03 18:12:29 +00:00
|
|
|
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
|
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:34:10 +00:00
|
|
|
else {
|
2016-09-03 10:14:08 +00:00
|
|
|
#ifndef NANO_TINY
|
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"))
|
2017-04-17 09:51:48 +00:00
|
|
|
s->toggle = CONSTANT_SHOW;
|
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;
|
2016-09-03 10:14:08 +00:00
|
|
|
else
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2016-09-03 10:14:08 +00:00
|
|
|
{
|
2014-06-28 15:22:41 +00:00
|
|
|
free(s);
|
|
|
|
return NULL;
|
|
|
|
}
|
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. */
|
2016-01-04 09:12:21 +00:00
|
|
|
int strtomenu(const char *input)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
|
|
|
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;
|
2016-09-03 18:12:29 +00:00
|
|
|
else if (!strcasecmp(input, "replace2") || /* Deprecated. Remove in 2018. */
|
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;
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_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);
|
|
|
|
|
2016-06-30 16:02:45 +00:00
|
|
|
free(word_chars);
|
2003-01-13 01:35:15 +00:00
|
|
|
#ifndef DISABLE_JUSTIFY
|
2015-06-14 19:14:41 +00:00
|
|
|
free(quotestr);
|
2004-07-30 03:54:34 +00:00
|
|
|
regfree("ereg);
|
2015-06-14 19:14:41 +00:00
|
|
|
free(quoteerr);
|
2004-07-30 03:54:34 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2015-06-14 19:14:41 +00:00
|
|
|
free(backup_dir);
|
2004-02-28 16:24:31 +00:00
|
|
|
#endif
|
2002-03-28 01:59:34 +00:00
|
|
|
#ifndef DISABLE_OPERATINGDIR
|
2015-06-14 19:14:41 +00:00
|
|
|
free(operating_dir);
|
|
|
|
free(full_operating_dir);
|
2002-02-27 04:14:16 +00:00
|
|
|
#endif
|
2015-06-14 19:14:41 +00:00
|
|
|
free(answer);
|
2015-04-21 18:42:11 +00:00
|
|
|
free(last_search);
|
2016-04-30 19:22:16 +00:00
|
|
|
free(present_path);
|
2002-02-27 04:14:16 +00:00
|
|
|
#ifndef DISABLE_SPELLER
|
2015-06-14 19:14:41 +00:00
|
|
|
free(alt_speller);
|
2002-09-06 20:35:28 +00:00
|
|
|
#endif
|
2016-02-21 20:54:04 +00:00
|
|
|
free_filestruct(cutbuffer);
|
2005-05-26 05:53:29 +00:00
|
|
|
/* Free the memory associated with each open file buffer. */
|
2016-02-22 09:02:58 +00:00
|
|
|
while (openfile != openfile->next) {
|
|
|
|
openfile = openfile->next;
|
|
|
|
delete_opennode(openfile->prev);
|
|
|
|
}
|
|
|
|
delete_opennode(openfile);
|
2014-04-04 11:59:03 +00:00
|
|
|
#ifndef DISABLE_COLOR
|
2015-06-14 19:14:41 +00:00
|
|
|
free(syntaxstr);
|
2002-07-19 01:08:59 +00:00
|
|
|
while (syntaxes != NULL) {
|
2016-03-04 20:22:27 +00:00
|
|
|
syntaxtype *sint = syntaxes;
|
|
|
|
syntaxes = syntaxes->next;
|
2002-07-19 01:08:59 +00:00
|
|
|
|
2016-03-04 20:22:27 +00:00
|
|
|
free(sint->name);
|
|
|
|
free(sint->linter);
|
|
|
|
free(sint->formatter);
|
2016-02-22 09:34:33 +00:00
|
|
|
|
2016-03-04 20:22:27 +00:00
|
|
|
while (sint->extensions != NULL) {
|
|
|
|
regexlisttype *item = sint->extensions;
|
|
|
|
sint->extensions = sint->extensions->next;
|
|
|
|
free(item->full_regex);
|
|
|
|
free(item);
|
2002-07-19 01:08:59 +00:00
|
|
|
}
|
2016-03-04 20:22:27 +00:00
|
|
|
while (sint->headers != NULL) {
|
|
|
|
regexlisttype *item = sint->headers;
|
|
|
|
sint->headers = sint->headers->next;
|
|
|
|
free(item->full_regex);
|
|
|
|
free(item);
|
2014-05-12 14:31:54 +00:00
|
|
|
}
|
2016-03-04 20:22:27 +00:00
|
|
|
while (sint->magics != NULL) {
|
|
|
|
regexlisttype *item = sint->magics;
|
|
|
|
sint->magics = sint->magics->next;
|
|
|
|
free(item->full_regex);
|
|
|
|
free(item);
|
2014-05-12 14:31:54 +00:00
|
|
|
}
|
2016-02-22 09:34:33 +00:00
|
|
|
|
2016-03-04 20:22:27 +00:00
|
|
|
while (sint->color != NULL) {
|
|
|
|
colortype *ink = sint->color;
|
|
|
|
sint->color = sint->color->next;
|
|
|
|
free(ink->start_regex);
|
|
|
|
if (ink->start != NULL) {
|
|
|
|
regfree(ink->start);
|
|
|
|
free(ink->start);
|
2005-07-13 20:18:46 +00:00
|
|
|
}
|
2016-03-04 20:22:27 +00:00
|
|
|
free(ink->end_regex);
|
|
|
|
if (ink->end != NULL) {
|
|
|
|
regfree(ink->end);
|
|
|
|
free(ink->end);
|
2005-07-13 20:18:46 +00:00
|
|
|
}
|
2016-03-04 20:22:27 +00:00
|
|
|
free(ink);
|
2002-07-19 01:08:59 +00:00
|
|
|
}
|
2016-03-04 20:22:27 +00:00
|
|
|
|
|
|
|
free(sint);
|
2002-07-19 01:08:59 +00:00
|
|
|
}
|
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. */
|
2016-02-21 20:54:04 +00:00
|
|
|
free_filestruct(searchage);
|
|
|
|
free_filestruct(replaceage);
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
2016-02-21 20:54:04 +00:00
|
|
|
/* Free the list of functions. */
|
2014-05-13 18:06:09 +00:00
|
|
|
while (allfuncs != NULL) {
|
2015-03-27 13:46:50 +00:00
|
|
|
subnfunc *f = allfuncs;
|
|
|
|
allfuncs = allfuncs->next;
|
|
|
|
free(f);
|
2014-05-13 18:06:09 +00:00
|
|
|
}
|
2016-02-21 20:54:04 +00:00
|
|
|
/* Free the list of shortcuts. */
|
2014-05-13 18:06:09 +00:00
|
|
|
while (sclist != NULL) {
|
2015-03-27 13:46:50 +00:00
|
|
|
sc *s = sclist;
|
|
|
|
sclist = sclist->next;
|
|
|
|
free(s);
|
2014-05-13 18:06:09 +00:00
|
|
|
}
|
2014-04-13 20:50:20 +00:00
|
|
|
#ifndef DISABLE_NANORC
|
2015-06-14 19:14:41 +00:00
|
|
|
free(homedir);
|
2004-08-17 05:23:38 +00:00
|
|
|
#endif
|
2002-02-27 04:14:16 +00:00
|
|
|
}
|
2002-05-12 19:52:15 +00:00
|
|
|
#endif /* DEBUG */
|