2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
2016-09-03 12:14:08 +02:00
|
|
|
* global.c -- This file is part of GNU nano. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
2018-01-24 10:13:28 +01:00
|
|
|
* Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc. *
|
2018-06-01 10:17:42 +02:00
|
|
|
* Copyright (C) 2014-2018 Benno Schulenberg *
|
2016-08-29 15:14:18 +02:00
|
|
|
* *
|
2016-08-29 17:10:49 +02: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 17:10:49 +02: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 17:10:49 +02: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>
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2006-05-10 13:41:53 +00:00
|
|
|
/* Global variables. */
|
|
|
|
#ifndef NANO_TINY
|
2016-12-14 20:37:03 +01:00
|
|
|
volatile sig_atomic_t the_window_resized = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Set to TRUE by the handler whenever a SIGWINCH occurs. */
|
2006-05-10 13:41:53 +00:00
|
|
|
#endif
|
|
|
|
|
2016-09-08 21:00:51 +02:00
|
|
|
#ifdef __linux__
|
2018-02-01 21:50:13 +01:00
|
|
|
bool on_a_vt;
|
|
|
|
/* Whether we're running on a Linux VT or on something else. */
|
2016-08-11 12:37:11 +02:00
|
|
|
#endif
|
|
|
|
|
2014-06-30 18:04:33 +00:00
|
|
|
bool meta_key;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether the current keystroke is a Meta key. */
|
2016-04-24 11:28:28 +02:00
|
|
|
bool shift_held;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether Shift was being held together with a movement key. */
|
2016-04-12 10:24:57 +02:00
|
|
|
bool focusing = TRUE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether an update of the edit window should center the cursor. */
|
2016-05-19 20:43:08 +02:00
|
|
|
|
2016-12-20 19:27:41 +01:00
|
|
|
bool as_an_at = TRUE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether a 0x0A byte should be shown as a ^@ instead of a ^J. */
|
2016-12-20 19:27:41 +01:00
|
|
|
|
2017-05-29 22:06:59 +02:00
|
|
|
bool suppress_cursorpos = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Should we skip constant position display for current keystroke? */
|
2017-05-29 22:06:59 +02:00
|
|
|
|
2016-05-19 20:43:08 +02:00
|
|
|
message_type lastmessage = HUSH;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
2014-06-30 18:04:33 +00:00
|
|
|
|
2016-12-07 09:43:47 +05:30
|
|
|
filestruct *pletion_line = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The line where the last completion was found, if any. */
|
2016-12-07 09:43:47 +05:30
|
|
|
|
2017-04-22 21:57:01 +05:30
|
|
|
bool inhelp = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether we are in the help viewer. */
|
2017-04-22 21:57:01 +05:30
|
|
|
char *title = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* When not NULL: the title of the current help text. */
|
2017-04-22 21:57:01 +05:30
|
|
|
|
2017-09-12 21:35:35 +02:00
|
|
|
bool more_than_one = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether more than one buffer is or has been open. */
|
2017-12-24 12:26:55 +01:00
|
|
|
bool also_the_last = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether indenting/commenting should include the last line of
|
|
|
|
* the marked region. */
|
2017-05-03 12:41:24 +02:00
|
|
|
int didfind = 0;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether the last search found something. */
|
2017-05-03 12:41:24 +02:00
|
|
|
|
2018-10-07 10:24:19 +02:00
|
|
|
int controlleft, controlright, controlup, controldown;
|
|
|
|
int controlhome, controlend;
|
2016-09-08 21:00:51 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-10-15 08:28:29 -05:00
|
|
|
int controldelete, controlshiftdelete;
|
2018-10-05 19:50:41 +02:00
|
|
|
int shiftleft, shiftright, shiftup, shiftdown;
|
2016-04-24 11:28:28 +02:00
|
|
|
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
2017-04-05 11:22:35 +02:00
|
|
|
int shiftcontrolhome, shiftcontrolend;
|
2017-08-11 15:23:56 +03:00
|
|
|
int altleft, altright, altup, altdown;
|
2016-04-24 11:28:28 +02:00
|
|
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
2015-11-23 08:52:23 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 17:39:30 +01:00
|
|
|
#ifdef ENABLED_WRAPORJUSTIFY
|
2018-10-17 18:01:01 -05:00
|
|
|
ssize_t wrap_at = -COLUMNS_FROM_EOL;
|
|
|
|
/* The relative column where we will wrap lines. */
|
|
|
|
ssize_t fill = 0;
|
|
|
|
/* The actual column where we will wrap lines, based on wrap_at. */
|
2005-12-08 07:09:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
char *last_search = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The last string we searched for. */
|
2005-12-08 07:09:08 +00:00
|
|
|
|
2016-04-30 21:22:16 +02:00
|
|
|
char *present_path = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The current browser directory when trying to do tab completion. */
|
2016-04-30 21:22:16 +02:00
|
|
|
|
2009-08-14 03:18:29 +00:00
|
|
|
unsigned flags[4] = {0, 0, 0, 0};
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Our flag containing the states of all global options. */
|
2018-04-01 20:11:44 +02:00
|
|
|
|
2017-05-18 10:16:52 +02:00
|
|
|
WINDOW *topwin = NULL;
|
2018-04-01 20:11:44 +02:00
|
|
|
/* The top portion of the screen, showing the version number of nano,
|
|
|
|
* the name of the file, and whether the buffer was modified. */
|
2017-05-18 10:16:52 +02:00
|
|
|
WINDOW *edit = NULL;
|
2018-04-01 20:11:44 +02:00
|
|
|
/* The middle portion of the screen: the edit window, showing the
|
|
|
|
* contents of the current buffer, the file we are editing. */
|
2017-05-18 10:16:52 +02:00
|
|
|
WINDOW *bottomwin = NULL;
|
2018-04-01 20:11:44 +02:00
|
|
|
/* The bottom portion of the screen, where we display statusbar
|
2017-12-29 19:27:33 +01:00
|
|
|
* messages, the statusbar prompt, and a list of shortcuts. */
|
2005-12-08 07:09:08 +00:00
|
|
|
int editwinrows = 0;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* How many rows does the edit window take up? */
|
2018-04-01 19:53:51 +02:00
|
|
|
int editwincols = -1;
|
|
|
|
/* The number of usable columns in the edit window: COLS - margin. */
|
|
|
|
int margin = 0;
|
|
|
|
/* The amount of space reserved at the left for line numbers. */
|
2005-12-08 07:09:08 +00:00
|
|
|
|
|
|
|
filestruct *cutbuffer = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The buffer where we store cut text. */
|
2008-07-31 04:24:04 +00:00
|
|
|
filestruct *cutbottom = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The last line in the cutbuffer. */
|
2005-12-08 07:09:08 +00:00
|
|
|
partition *filepart = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The "partition" where we store a portion of the current file. */
|
2005-07-08 19:57:25 +00:00
|
|
|
openfilestruct *openfile = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The list of all open file buffers. */
|
2017-09-01 13:47:19 -03:00
|
|
|
openfilestruct *firstfile = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The first open buffer. */
|
2001-07-11 02:08:33 +00:00
|
|
|
|
2006-01-06 21:51:10 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
char *matchbrackets = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The opening and closing brackets that can be found by bracket
|
|
|
|
* searches. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *whitespace = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The characters used when visibly showing tabs and spaces. */
|
2005-12-08 07:09:08 +00:00
|
|
|
int whitespace_len[2];
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The length in bytes of these characters. */
|
2004-05-29 16:47:52 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
char *punct = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The closing punctuation that can end sentences. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *brackets = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The closing brackets that can follow closing punctuation and
|
|
|
|
* can end sentences. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *quotestr = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The quoting string. The default value is set in main(). */
|
2005-12-08 07:09:08 +00:00
|
|
|
regex_t quotereg;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The compiled regular expression from the quoting string. */
|
2005-12-08 07:09:08 +00:00
|
|
|
int quoterc;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether it was compiled successfully. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *quoteerr = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The error message, if it didn't. */
|
2017-10-31 17:34:07 +01:00
|
|
|
#endif
|
2004-02-28 16:24:31 +00:00
|
|
|
|
2016-06-30 18:02:45 +02:00
|
|
|
char *word_chars = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Nonalphanumeric characters that also form words. */
|
2016-06-30 18:02:45 +02:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
char *answer = NULL;
|
2017-12-29 19:27:33 +01: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;
|
2017-12-29 19:27:33 +01: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;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* 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 = ".";
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Prefix of how to store the vim-style lock file. */
|
2013-01-03 04:36:39 +00:00
|
|
|
const char *locking_suffix = ".swp";
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Suffix of the vim-style lock file. */
|
2005-12-08 07:09:08 +00:00
|
|
|
#endif
|
2017-10-29 21:08:07 +01:00
|
|
|
#ifdef ENABLE_OPERATINGDIR
|
2005-12-08 07:09:08 +00:00
|
|
|
char *operating_dir = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The path to our confining "operating" directory, when given. */
|
2001-09-19 03:19:43 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 19:32:42 +01:00
|
|
|
#ifdef ENABLE_SPELLER
|
2005-12-08 07:09:08 +00:00
|
|
|
char *alt_speller = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The command to use for the alternate spell checker. */
|
2001-04-18 04:28:54 +00:00
|
|
|
#endif
|
|
|
|
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2002-12-22 16:30:00 +00:00
|
|
|
syntaxtype *syntaxes = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The global list of color syntaxes. */
|
2002-12-22 16:30:00 +00:00
|
|
|
char *syntaxstr = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The color syntax name specified on the command line. */
|
2017-11-26 18:01:02 +01:00
|
|
|
bool have_palette = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Whether the colors for the current syntax have been initialized. */
|
2001-04-30 11:28:46 +00:00
|
|
|
#endif
|
|
|
|
|
2016-04-25 21:14:18 +02:00
|
|
|
bool refresh_needed = FALSE;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* 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 12:01:33 +02:00
|
|
|
int currmenu = MMOST;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The currently active menu, initialized to a dummy value. */
|
2008-03-05 07:34:01 +00:00
|
|
|
sc *sclist = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The start of the shortcuts list. */
|
2008-03-05 07:34:01 +00:00
|
|
|
subnfunc *allfuncs = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The start of the functions list. */
|
2014-04-26 18:41:43 +00:00
|
|
|
subnfunc *tailfunc;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The last function in the list. */
|
2014-04-26 19:01:18 +00:00
|
|
|
subnfunc *exitfunc;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* A pointer to the special Exit/Close item. */
|
2014-04-07 09:02:22 +00:00
|
|
|
subnfunc *uncutfunc;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* A pointer to the special Uncut/Unjustify item. */
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *search_history = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The current item in the list of strings that were searched for. */
|
2017-10-29 11:34:53 +01:00
|
|
|
filestruct *execute_history = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The current item in the list of commands that were run with ^R ^X. */
|
2017-10-29 11:34:53 +01:00
|
|
|
filestruct *replace_history = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The current item in the list of replace strings. */
|
2017-10-29 19:42:12 +01:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2017-09-17 16:54:45 +02:00
|
|
|
filestruct *searchtop = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The oldest item in the list of search strings. */
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *searchbot = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The newest item in the list of search strings. */
|
2017-09-17 17:16:36 +02:00
|
|
|
|
2017-09-17 16:54:45 +02:00
|
|
|
filestruct *replacetop = NULL;
|
2005-05-23 16:30:06 +00:00
|
|
|
filestruct *replacebot = NULL;
|
2017-09-17 17:16:36 +02:00
|
|
|
|
2017-09-05 23:10:54 -03:00
|
|
|
filestruct *executetop = NULL;
|
|
|
|
filestruct *executebot = NULL;
|
2017-09-17 17:16:36 +02:00
|
|
|
|
2016-01-12 19:20:40 +00:00
|
|
|
poshiststruct *position_history = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The list of filenames with their last cursor positions. */
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
regex_t search_regexp;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The compiled regular expression to use in searches. */
|
2005-12-08 07:09:08 +00:00
|
|
|
regmatch_t regmatches[10];
|
2017-12-29 19:27:33 +01:00
|
|
|
/* 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;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The curses attribute we use to highlight something. */
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2018-08-30 11:21:27 +03:00
|
|
|
colortype* color_combo[NUMBER_OF_ELEMENTS] = {NULL};
|
2018-01-15 16:07:24 +01:00
|
|
|
/* The color combinations for interface elements given in the rcfile. */
|
2014-05-03 18:24:45 +00:00
|
|
|
#endif
|
2018-08-30 11:21:27 +03:00
|
|
|
int interface_color_pair[NUMBER_OF_ELEMENTS] = {0};
|
2017-12-29 19:27:33 +01: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;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The user's home directory, from $HOME or /etc/passwd. */
|
2017-10-27 23:15:06 +02:00
|
|
|
char *statedir = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The directory for nano's history files. */
|
2018-08-06 21:12:22 +02:00
|
|
|
|
2018-08-04 10:53:34 +02:00
|
|
|
#ifdef ENABLE_NANORC
|
2018-08-06 21:12:22 +02:00
|
|
|
#define NUMBER_OF_MENUS 16
|
|
|
|
char *menunames[NUMBER_OF_MENUS] = { "main", "search", "replace", "replacewith",
|
|
|
|
"yesno", "gotoline", "writeout", "insert",
|
|
|
|
"extcmd", "help", "spell", "linter",
|
|
|
|
"browser", "whereisfile", "gotodir",
|
|
|
|
"all" };
|
|
|
|
int menusymbols[NUMBER_OF_MENUS] = { MMAIN, MWHEREIS, MREPLACE, MREPLACEWITH,
|
|
|
|
MYESNO, MGOTOLINE, MWRITEFILE, MINSERTFILE,
|
|
|
|
MEXTCMD, MHELP, MSPELL, MLINTER,
|
|
|
|
MBROWSER, MWHEREISFILE, MGOTODIR,
|
|
|
|
MMOST|MHELP|MYESNO };
|
|
|
|
|
2017-10-28 14:18:37 +02:00
|
|
|
char *rcfile_with_errors = NULL;
|
2017-12-29 19:27:33 +01:00
|
|
|
/* The first nanorc file, if any, that produced warnings. */
|
2018-08-04 10:53:34 +02:00
|
|
|
#endif
|
2016-09-03 12:14:08 +02:00
|
|
|
|
2018-09-29 11:14:43 -05:00
|
|
|
bool spotlighted = FALSE;
|
|
|
|
/* Whether any text is spotlighted. */
|
|
|
|
size_t light_from_col = 0;
|
|
|
|
/* Where the spotlighted text starts. */
|
|
|
|
size_t light_to_col = 0;
|
|
|
|
/* Where the spotlighted text ends. */
|
|
|
|
|
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
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
subnfunc *f;
|
|
|
|
size_t i = 0;
|
2002-09-13 18:14:04 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
for (f = allfuncs; f != NULL; f = f->next)
|
2018-02-24 19:31:11 +01:00
|
|
|
if ((f->menus & menu) && first_sc_for(menu, f->func) != NULL)
|
2017-12-29 19:27:33 +01:00
|
|
|
i++;
|
2016-08-27 12:22:59 +02:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
return i;
|
2002-02-15 19:17:02 +00:00
|
|
|
}
|
|
|
|
|
2014-07-01 18:52:21 +00:00
|
|
|
/* To make the functions and shortcuts lists clearer. */
|
2017-12-29 21:35:14 +01:00
|
|
|
#define VIEW TRUE /* Is allowed in view mode. */
|
2014-07-01 18:52:21 +00:00
|
|
|
#define NOVIEW FALSE
|
2017-12-29 21:35:14 +01:00
|
|
|
#define BLANKAFTER TRUE /* A blank line after this one. */
|
2014-07-01 18:52:21 +00:00
|
|
|
#define TOGETHER FALSE
|
2018-10-12 19:55:18 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
#define CAN_OPEN_OTHER_BUFFER TRUE
|
|
|
|
#else
|
|
|
|
#define CAN_OPEN_OTHER_BUFFER FALSE
|
|
|
|
#endif
|
2014-07-01 18:52:21 +00:00
|
|
|
|
2018-04-01 20:11:44 +02:00
|
|
|
/* Empty functions, for the most part corresponding to toggles. */
|
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)
|
|
|
|
{
|
|
|
|
}
|
2017-05-08 14:23:47 +02:00
|
|
|
void flip_replace(void)
|
|
|
|
{
|
|
|
|
}
|
2018-02-04 10:34:39 +01:00
|
|
|
void flip_goto(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_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
|
2017-05-08 12:57:15 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-04-17 10:34:57 +02:00
|
|
|
void do_toggle_void(void)
|
|
|
|
{
|
|
|
|
}
|
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)
|
|
|
|
{
|
|
|
|
}
|
2017-05-08 14:23:47 +02:00
|
|
|
void flip_execute(void)
|
2015-12-23 16:34:44 +00:00
|
|
|
{
|
|
|
|
}
|
2018-05-15 22:20:11 -03:00
|
|
|
void flip_pipe(void)
|
|
|
|
{
|
|
|
|
}
|
2018-08-19 12:35:15 +02:00
|
|
|
void flip_convert(void)
|
|
|
|
{
|
|
|
|
}
|
2017-05-08 14:23:47 +02:00
|
|
|
#endif
|
2017-05-08 13:20:07 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-05-08 14:23:47 +02:00
|
|
|
void flip_newbuffer(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2017-05-08 13:20:07 +02:00
|
|
|
#endif
|
2017-05-08 14:23:47 +02:00
|
|
|
void discard_buffer(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2018-04-17 10:34:57 +02:00
|
|
|
void do_cancel(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,
|
2017-12-29 19:27:33 +01:00
|
|
|
bool blank_after, bool viewok)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
subnfunc *f = nmalloc(sizeof(subnfunc));
|
|
|
|
|
|
|
|
if (allfuncs == NULL)
|
|
|
|
allfuncs = f;
|
|
|
|
else
|
|
|
|
tailfunc->next = f;
|
|
|
|
tailfunc = f;
|
|
|
|
|
|
|
|
f->next = NULL;
|
2018-02-24 19:31:11 +01:00
|
|
|
f->func = func;
|
2017-12-29 19:27:33 +01:00
|
|
|
f->menus = menus;
|
|
|
|
f->desc = desc;
|
|
|
|
f->viewok = viewok;
|
2017-04-25 17:51:45 +02:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 19:27:33 +01:00
|
|
|
f->help = help;
|
|
|
|
f->blank_after = blank_after;
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2017-12-29 19:27:33 +01: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 17:55:19 +02:00
|
|
|
void add_to_sclist(int menus, const char *scstring, const int keycode,
|
2017-12-29 19:27:33 +01:00
|
|
|
void (*func)(void), int toggle)
|
2000-06-06 05:53:49 +00:00
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
static sc *tailsc;
|
2016-09-01 09:36:47 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
static int counter = 0;
|
2016-09-01 09:36:47 +02:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
sc *s = nmalloc(sizeof(sc));
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Start the list, or tack on the next item. */
|
|
|
|
if (sclist == NULL)
|
|
|
|
sclist = s;
|
|
|
|
else
|
|
|
|
tailsc->next = s;
|
|
|
|
tailsc = s;
|
|
|
|
s->next = NULL;
|
2014-07-27 19:13:46 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Fill in the data. */
|
|
|
|
s->menus = menus;
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = func;
|
2016-09-01 09:36:47 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
s->toggle = toggle;
|
|
|
|
if (toggle)
|
|
|
|
s->ordinal = ++counter;
|
2016-09-01 09:36:47 +02:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
assign_keyinfo(s, scstring, keycode);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2017-12-29 19:27:33 +01: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-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))
|
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
const sc *s;
|
2014-07-27 19:23:41 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
for (s = sclist; s != NULL; s = s->next)
|
2018-02-24 19:31:11 +01:00
|
|
|
if ((s->menus & menu) && s->func == func)
|
2017-12-29 19:27:33 +01:00
|
|
|
return s;
|
2014-07-27 19:23:41 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2017-12-29 19:27:33 +01:00
|
|
|
fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long)func, menu);
|
2014-07-27 19:23:41 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
return NULL;
|
2014-07-27 19:23:41 +00:00
|
|
|
}
|
|
|
|
|
2016-12-22 12:02:11 +01: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
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
const sc *s = first_sc_for(currmenu, func);
|
2008-03-09 02:52:40 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
if (s == NULL)
|
|
|
|
return defaultval;
|
2016-12-22 12:02:11 +01:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
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)
|
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
const sc *s = get_shortcut(kbinput);
|
2014-07-02 08:47:09 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
if (s)
|
2018-02-24 19:31:11 +01:00
|
|
|
return s->func;
|
2017-12-29 19:27:33 +01:00
|
|
|
else
|
|
|
|
return NULL;
|
2014-07-02 08:47:09 +00:00
|
|
|
}
|
|
|
|
|
2016-07-23 14:42:40 +02:00
|
|
|
/* Set the string and its corresponding keycode for the given shortcut s. */
|
2016-10-15 17:55:19 +02:00
|
|
|
void assign_keyinfo(sc *s, const char *keystring, const int keycode)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
s->keystr = keystring;
|
|
|
|
s->meta = (keystring[0] == 'M' && keystring[2] != '\xE2');
|
2016-07-23 12:15:39 +02:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
assert(strlen(keystring) > 1 && (!s->meta || strlen(keystring) > 2));
|
2016-07-25 09:33:43 +02:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
if (keycode)
|
|
|
|
s->keycode = keycode;
|
|
|
|
else
|
|
|
|
s->keycode = keycode_from_string(keystring);
|
2017-08-11 15:23:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse the given keystring and return the corresponding keycode,
|
|
|
|
* or return -1 when the string is invalid. */
|
|
|
|
int keycode_from_string(const char *keystring)
|
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
if (keystring[0] == '^') {
|
|
|
|
if (strcasecmp(keystring, "^Space") == 0)
|
|
|
|
return 0;
|
2018-09-14 21:57:24 +02:00
|
|
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
|
|
|
|
if (strcasecmp(keystring, "^H") == 0)
|
|
|
|
return KEY_BACKSPACE;
|
|
|
|
#endif
|
2018-07-11 14:42:10 +02:00
|
|
|
if (keystring[1] <= '_' && strlen(keystring) == 2)
|
2017-12-29 19:27:33 +01:00
|
|
|
return keystring[1] - 64;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
} else if (keystring[0] == 'M') {
|
|
|
|
if (strcasecmp(keystring, "M-Space") == 0)
|
|
|
|
return (int)' ';
|
2018-07-11 14:42:10 +02:00
|
|
|
if (keystring[1] == '-' && strlen(keystring) == 3)
|
2017-12-29 19:27:33 +01:00
|
|
|
return tolower((unsigned char)keystring[2]);
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
} else if (keystring[0] == 'F') {
|
|
|
|
int fn = atoi(&keystring[1]);
|
2018-07-19 19:47:49 +02:00
|
|
|
if (fn < 1 || fn > 16)
|
2017-12-29 19:27:33 +01:00
|
|
|
return -1;
|
|
|
|
return KEY_F0 + fn;
|
|
|
|
} else if (!strcasecmp(keystring, "Ins"))
|
|
|
|
return KEY_IC;
|
|
|
|
else if (!strcasecmp(keystring, "Del"))
|
|
|
|
return KEY_DC;
|
2016-10-11 10:50:04 +02:00
|
|
|
else
|
2017-12-29 19:27:33 +01:00
|
|
|
return -1;
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void print_sclist(void)
|
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
sc *s;
|
|
|
|
const subnfunc *f;
|
|
|
|
|
|
|
|
for (s = sclist; s != NULL; s = s->next) {
|
|
|
|
f = sctofunc(s);
|
|
|
|
if (f)
|
|
|
|
fprintf(stderr, "Shortcut \"%s\", function: %s, menus %x\n", s->keystr, f->desc, f->menus);
|
|
|
|
else
|
|
|
|
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. */
|
2018-08-29 20:05:37 +02:00
|
|
|
/* TRANSLATORS: Try to keep the next four 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");
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_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
|
|
|
{
|
2017-04-25 17:51:45 +02:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 19:27:33 +01:00
|
|
|
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
|
|
|
|
* they are best kept shorter than 56 characters, but may be longer. */
|
|
|
|
const char *cancel_gist = N_("Cancel the current function");
|
|
|
|
const char *help_gist = N_("Display this help text");
|
|
|
|
const char *exit_gist =
|
2018-02-22 19:52:27 +01:00
|
|
|
N_("Close the current buffer / Exit from nano");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *writeout_gist =
|
2018-02-19 20:35:47 +01:00
|
|
|
N_("Write the current buffer (or the marked region) to disk");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *readfile_gist =
|
2018-02-22 19:52:27 +01:00
|
|
|
N_("Insert another file into current buffer (or into new buffer)");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *whereis_gist =
|
|
|
|
N_("Search forward for a string or a regular expression");
|
|
|
|
const char *wherewas_gist =
|
|
|
|
N_("Search backward for a string or a regular expression");
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2018-07-24 17:11:25 -05:00
|
|
|
const char *browserwhereis_gist = N_("Search forward for a string");
|
|
|
|
const char *browserwherewas_gist = N_("Search backward for a string");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *browserrefresh_gist = N_("Refresh the file list");
|
2017-02-27 19:16:06 +01:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *browserlefthand_gist = N_("Go to lefthand column");
|
|
|
|
const char *browserrighthand_gist = N_("Go to righthand column");
|
|
|
|
const char *browsertoprow_gist = N_("Go to first row in this column");
|
|
|
|
const char *browserbottomrow_gist = N_("Go to last row in this column");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
const char *prevpage_gist = N_("Go one screenful up");
|
|
|
|
const char *nextpage_gist = N_("Go one screenful down");
|
|
|
|
const char *cut_gist =
|
2018-02-19 20:35:47 +01:00
|
|
|
N_("Cut current line (or marked region) and store it in cutbuffer");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *uncut_gist =
|
|
|
|
N_("Uncut from the cutbuffer into the current line");
|
|
|
|
const char *cursorpos_gist = N_("Display the position of the cursor");
|
2017-10-31 19:32:42 +01:00
|
|
|
#ifdef ENABLE_SPELLER
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *spell_gist = N_("Invoke the spell checker, if available");
|
2014-04-03 21:06:30 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *replace_gist = N_("Replace a string or a regular expression");
|
|
|
|
const char *gotoline_gist = N_("Go to line and column number");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *mark_gist = N_("Mark text starting from the cursor position");
|
|
|
|
const char *copy_gist =
|
2018-02-19 20:35:47 +01:00
|
|
|
N_("Copy current line (or marked region) and store it in cutbuffer");
|
2018-10-23 20:25:22 -06:00
|
|
|
const char *zap_gist = N_("Throw away the current line (or marked region)");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *indent_gist = N_("Indent the current line (or marked lines)");
|
|
|
|
const char *unindent_gist = N_("Unindent the current line (or marked lines)");
|
|
|
|
const char *undo_gist = N_("Undo the last operation");
|
|
|
|
const char *redo_gist = N_("Redo the last undone operation");
|
|
|
|
#endif
|
|
|
|
const char *back_gist = N_("Go back one character");
|
|
|
|
const char *forward_gist = N_("Go forward one character");
|
|
|
|
const char *prevword_gist = N_("Go back one word");
|
|
|
|
const char *nextword_gist = N_("Go forward one word");
|
|
|
|
const char *prevline_gist = N_("Go to previous line");
|
|
|
|
const char *nextline_gist = N_("Go to next line");
|
|
|
|
const char *home_gist = N_("Go to beginning of current line");
|
|
|
|
const char *end_gist = N_("Go to end of current line");
|
|
|
|
const char *prevblock_gist = N_("Go to previous block of text");
|
|
|
|
const char *nextblock_gist = N_("Go to next block of text");
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *parabegin_gist =
|
|
|
|
N_("Go to beginning of paragraph; then of previous paragraph");
|
|
|
|
const char *paraend_gist =
|
|
|
|
N_("Go just beyond end of paragraph; then of next paragraph");
|
2006-04-24 21:14:55 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *firstline_gist = N_("Go to the first line of the file");
|
|
|
|
const char *lastline_gist = N_("Go to the last line of the file");
|
2006-04-24 21:14:55 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *bracket_gist = N_("Go to the matching bracket");
|
2018-03-31 16:50:26 +02:00
|
|
|
#endif
|
2018-10-24 17:30:27 +02:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *scrollup_gist =
|
2018-03-22 11:14:32 +01:00
|
|
|
N_("Scroll up one line without moving the cursor textually");
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *scrolldown_gist =
|
2018-03-22 11:14:32 +01:00
|
|
|
N_("Scroll down one line without moving the cursor textually");
|
2004-09-11 21:41:13 +00:00
|
|
|
#endif
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *prevfile_gist = N_("Switch to the previous file buffer");
|
|
|
|
const char *nextfile_gist = N_("Switch to the next file buffer");
|
|
|
|
#endif
|
|
|
|
const char *verbatim_gist = N_("Insert the next keystroke verbatim");
|
|
|
|
const char *tab_gist = N_("Insert a tab at the cursor position");
|
|
|
|
const char *enter_gist = N_("Insert a newline at the cursor position");
|
|
|
|
const char *delete_gist = N_("Delete the character under the cursor");
|
|
|
|
const char *backspace_gist =
|
|
|
|
N_("Delete the character to the left of the cursor");
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *cutwordleft_gist =
|
|
|
|
N_("Cut backward from cursor to word start");
|
|
|
|
const char *cutwordright_gist =
|
|
|
|
N_("Cut forward from cursor to next word start");
|
|
|
|
const char *cuttilleof_gist =
|
|
|
|
N_("Cut from the cursor position to the end of the file");
|
2005-01-01 07:43:32 +00:00
|
|
|
#endif
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *justify_gist = N_("Justify the current paragraph");
|
|
|
|
const char *fulljustify_gist = 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
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *wordcount_gist =
|
|
|
|
N_("Count the number of words, lines, and characters");
|
2004-08-07 21:27:37 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *refresh_gist =
|
|
|
|
N_("Refresh (redraw) the current screen");
|
|
|
|
const char *suspend_gist =
|
|
|
|
N_("Suspend the editor (if suspension is enabled)");
|
2016-12-07 13:10:40 +01:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *completion_gist = N_("Try and complete the current word");
|
2016-12-07 13:10:40 +01:00
|
|
|
#endif
|
2016-12-07 19:56:27 +01:00
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *comment_gist =
|
|
|
|
N_("Comment/uncomment the current line (or marked lines)");
|
2016-12-07 19:56:27 +01:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *savefile_gist = N_("Save file without prompting");
|
|
|
|
const char *findprev_gist = N_("Search next occurrence backward");
|
|
|
|
const char *findnext_gist = N_("Search next occurrence forward");
|
2018-07-25 21:27:06 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *recordmacro_gist = N_("Start/stop recording a macro");
|
|
|
|
const char *runmacro_gist = N_("Run the last recorded macro");
|
|
|
|
#endif
|
|
|
|
const char *case_gist =
|
|
|
|
N_("Toggle the case sensitivity of the search");
|
|
|
|
const char *reverse_gist =
|
|
|
|
N_("Reverse the direction of the search");
|
|
|
|
const char *regexp_gist =
|
|
|
|
N_("Toggle the use of regular expressions");
|
2017-10-29 19:42:12 +01:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2018-10-08 19:27:56 +02:00
|
|
|
const char *older_gist =
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Recall the previous search/replace string");
|
2018-10-08 19:27:56 +02:00
|
|
|
const char *newer_gist =
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Recall the next search/replace string");
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *dos_gist = N_("Toggle the use of DOS format");
|
|
|
|
const char *mac_gist = N_("Toggle the use of Mac format");
|
|
|
|
const char *append_gist = N_("Toggle appending");
|
|
|
|
const char *prepend_gist = N_("Toggle prepending");
|
|
|
|
const char *backup_gist = N_("Toggle backing up of the original file");
|
|
|
|
const char *execute_gist = N_("Execute external command");
|
2018-05-29 09:05:58 +02:00
|
|
|
const char *pipe_gist =
|
|
|
|
N_("Pipe the current buffer (or marked region) to the command");
|
2018-08-19 12:35:15 +02:00
|
|
|
const char *convert_gist = N_("Do not convert from DOS/Mac format");
|
2017-05-08 21:59:36 +02:00
|
|
|
#endif
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *newbuffer_gist = N_("Toggle the use of a new buffer");
|
2017-04-25 20:42:05 +02:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *discardbuffer_gist = N_("Close buffer without saving it");
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *tofiles_gist = N_("Go to file browser");
|
|
|
|
const char *exitbrowser_gist = N_("Exit from the file browser");
|
|
|
|
const char *firstfile_gist = N_("Go to the first file in the list");
|
|
|
|
const char *lastfile_gist = N_("Go to the last file in the list");
|
|
|
|
const char *backfile_gist = N_("Go to the previous file in the list");
|
|
|
|
const char *forwardfile_gist = N_("Go to the next file in the list");
|
|
|
|
const char *gotodir_gist = N_("Go to directory");
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 19:27:33 +01:00
|
|
|
const char *lint_gist = N_("Invoke the linter, if available");
|
|
|
|
const char *prevlint_gist = N_("Go to previous linter msg");
|
|
|
|
const char *nextlint_gist = N_("Go to next linter msg");
|
2015-03-27 16:55:49 +00:00
|
|
|
#endif
|
2017-04-25 17:51:45 +02:00
|
|
|
#endif /* ENABLE_HELP */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-04-25 17:51:45 +02:00
|
|
|
#ifdef ENABLE_HELP
|
2017-10-28 11:51:24 +02:00
|
|
|
#define WITHORSANS(help) help
|
2004-03-02 22:52:57 +00:00
|
|
|
#else
|
2017-10-28 11:51:24 +02:00
|
|
|
#define WITHORSANS(help) ""
|
2002-04-23 10:56:06 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Start populating the different menus with functions. */
|
2014-04-13 12:16:37 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_help_void, MMOST & ~MFINDINHELP,
|
2018-08-29 20:05:37 +02:00
|
|
|
/* TRANSLATORS: Try to keep the next ninety strings or so at most 10
|
|
|
|
* characters. Some strings may be longer -- run nano and see. */
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Get Help"), WITHORSANS(help_gist), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO),
|
|
|
|
N_("Cancel"), WITHORSANS(cancel_gist), BLANKAFTER, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_exit, MMAIN,
|
|
|
|
exit_tag, WITHORSANS(exit_gist), TOGETHER, VIEW);
|
|
|
|
/* Remember the entry for Exit, to be able to replace it with Close. */
|
|
|
|
exitfunc = tailfunc;
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_exit, MBROWSER,
|
|
|
|
exit_tag, WITHORSANS(exitbrowser_gist), TOGETHER, VIEW);
|
2008-03-20 04:51:26 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_writeout_void, MMAIN,
|
|
|
|
N_("Write Out"), WITHORSANS(writeout_gist), TOGETHER, NOVIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2015-07-30 10:37:28 +00:00
|
|
|
#else
|
2017-12-29 19:27:33 +01:00
|
|
|
/* 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
|
|
|
|
add_to_funcs(do_insertfile_void, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Read File"), WITHORSANS(readfile_gist), BLANKAFTER,
|
2017-12-29 19:27:33 +01:00
|
|
|
/* We allow inserting files in view mode if multibuffer mode
|
|
|
|
* is switched on, so that we can view multiple files. */
|
2018-10-12 19:55:18 +02:00
|
|
|
CAN_OPEN_OTHER_BUFFER);
|
2017-12-29 19:27:33 +01:00
|
|
|
} else {
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Justify"), WITHORSANS(justify_gist), BLANKAFTER, NOVIEW);
|
2015-07-30 10:37:28 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
}
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2018-07-30 21:03:08 +02:00
|
|
|
#ifdef ENABLE_HELP
|
|
|
|
/* The description ("x") and blank_after (0) are irrelevant,
|
|
|
|
* because the help viewer does not have a help text. */
|
|
|
|
add_to_funcs(total_refresh, MHELP, N_("Refresh"), "x", 0, VIEW);
|
|
|
|
add_to_funcs(do_exit, MHELP, close_tag, "x", 0, VIEW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
add_to_funcs(do_search_forward, MMAIN|MHELP,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Where Is"), WITHORSANS(whereis_gist), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_replace, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Replace"), WITHORSANS(replace_gist), TOGETHER, NOVIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(goto_dir_void, MBROWSER,
|
|
|
|
N_("Go To Dir"), WITHORSANS(gotodir_gist), TOGETHER, VIEW);
|
2017-08-19 18:11:59 +02:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(total_refresh, MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Refresh"), WITHORSANS(browserrefresh_gist), BLANKAFTER, VIEW);
|
2014-02-26 20:37:40 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_cut_text_void, MMAIN,
|
|
|
|
N_("Cut Text"), WITHORSANS(cut_gist), TOGETHER, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_uncut_text, MMAIN,
|
|
|
|
uncut_tag, WITHORSANS(uncut_gist), BLANKAFTER, NOVIEW);
|
|
|
|
/* Remember the entry for Uncut, to be able to replace it with Unjustify. */
|
|
|
|
uncutfunc = tailfunc;
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Justify"), WITHORSANS(justify_gist), TOGETHER, NOVIEW);
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2017-10-31 19:32:42 +01:00
|
|
|
#ifdef ENABLE_SPELLER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_spell, MMAIN,
|
2018-09-30 13:57:33 +02:00
|
|
|
N_("To Spell"), WITHORSANS(spell_gist), BLANKAFTER, NOVIEW);
|
2015-03-27 16:55:49 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
}
|
2014-02-24 10:18:15 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN,
|
|
|
|
N_("Cur Pos"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
|
2016-09-03 13:41:02 +02:00
|
|
|
|
2017-11-01 19:45:33 +01:00
|
|
|
#if (defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)) || \
|
2017-12-29 19:27:33 +01:00
|
|
|
!defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_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,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2016-09-03 13:41:02 +02:00
|
|
|
#endif
|
|
|
|
|
2017-03-23 11:31:56 +01:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_undo, MMAIN,
|
|
|
|
N_("Undo"), WITHORSANS(undo_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_redo, MMAIN,
|
|
|
|
N_("Redo"), WITHORSANS(redo_gist), BLANKAFTER, NOVIEW);
|
2017-03-23 11:31:56 +01:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_mark, MMAIN,
|
|
|
|
N_("Mark Text"), WITHORSANS(mark_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_copy_text, MMAIN,
|
|
|
|
N_("Copy Text"), WITHORSANS(copy_gist), BLANKAFTER, NOVIEW);
|
2017-03-23 11:31:56 +01:00
|
|
|
#endif
|
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
|
|
|
|
N_("Case Sens"), WITHORSANS(case_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(regexp_void, MWHEREIS|MREPLACE,
|
|
|
|
N_("Regexp"), WITHORSANS(regexp_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
|
|
|
|
N_("Backwards"), WITHORSANS(reverse_gist), TOGETHER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(flip_replace, MWHEREIS,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Replace"), WITHORSANS(replace_gist), BLANKAFTER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(flip_replace, MREPLACE,
|
|
|
|
N_("No Replace"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2018-10-08 19:48:02 +02:00
|
|
|
#ifdef ENABLE_HISTORIES
|
|
|
|
add_to_funcs(get_history_older_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
|
|
|
N_("Older"), WITHORSANS(older_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(get_history_newer_void, MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE,
|
|
|
|
N_("Newer"), WITHORSANS(newer_gist), BLANKAFTER, VIEW);
|
|
|
|
#endif
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_full_justify, MWHEREIS,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("FullJstify"), WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2018-02-04 10:34:39 +01:00
|
|
|
add_to_funcs(flip_goto, MWHEREIS,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2014-05-27 12:17:49 +00:00
|
|
|
#endif
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2016-09-12 12:49:46 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_find_bracket, MMAIN,
|
|
|
|
N_("To Bracket"), WITHORSANS(bracket_gist), BLANKAFTER, VIEW);
|
2018-07-25 21:27:06 +02:00
|
|
|
#else
|
|
|
|
/* Place this one here only in the tiny version; otherwise further down. */
|
|
|
|
add_to_funcs(do_savefile, MMAIN,
|
|
|
|
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
2016-12-05 19:53:41 +01:00
|
|
|
|
2018-07-24 17:11:25 -05:00
|
|
|
#ifdef ENABLE_BROWSER
|
|
|
|
add_to_funcs(do_search_forward, MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Where Is"), WITHORSANS(browserwhereis_gist), TOGETHER, VIEW);
|
2018-07-24 17:11:25 -05:00
|
|
|
add_to_funcs(do_search_backward, MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Where Was"), WITHORSANS(browserwherewas_gist), TOGETHER, VIEW);
|
2018-07-24 17:11:25 -05:00
|
|
|
#endif
|
|
|
|
add_to_funcs(do_search_backward, MMAIN|MHELP,
|
2018-07-25 21:27:06 +02:00
|
|
|
/* TRANSLATORS: This starts a backward search. */
|
|
|
|
N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW);
|
2018-07-27 20:07:15 +02:00
|
|
|
add_to_funcs(do_findprevious, MMAIN|MHELP|MBROWSER,
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Previous"), WITHORSANS(findprev_gist), TOGETHER, VIEW);
|
2018-07-27 20:07:15 +02:00
|
|
|
add_to_funcs(do_findnext, MMAIN|MHELP|MBROWSER,
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Next"), WITHORSANS(findnext_gist), BLANKAFTER, VIEW);
|
2003-08-23 21:11:06 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_left, MMAIN,
|
2018-08-29 20:05:37 +02:00
|
|
|
/* TRANSLATORS: This means move the cursor one character back. */
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Back"), WITHORSANS(back_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_right, MMAIN,
|
|
|
|
N_("Forward"), WITHORSANS(forward_gist), TOGETHER, VIEW);
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_left, MBROWSER,
|
|
|
|
N_("Back"), WITHORSANS(backfile_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_right, MBROWSER,
|
|
|
|
N_("Forward"), WITHORSANS(forwardfile_gist), TOGETHER, VIEW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
add_to_funcs(do_prev_word_void, MMAIN,
|
|
|
|
N_("Prev Word"), WITHORSANS(prevword_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_word_void, MMAIN,
|
|
|
|
N_("Next Word"), WITHORSANS(nextword_gist), TOGETHER, VIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_home, MMAIN,
|
|
|
|
N_("Home"), WITHORSANS(home_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_end, MMAIN,
|
|
|
|
N_("End"), WITHORSANS(end_gist), BLANKAFTER, VIEW);
|
|
|
|
|
2018-03-12 18:28:44 +01:00
|
|
|
add_to_funcs(do_up, MMAIN|MHELP|MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Prev Line"), WITHORSANS(prevline_gist), TOGETHER, VIEW);
|
2018-03-12 18:28:44 +01:00
|
|
|
add_to_funcs(do_down, MMAIN|MHELP|MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Next Line"), WITHORSANS(nextline_gist), TOGETHER, VIEW);
|
2018-10-24 17:30:27 +02:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_scroll_up, MMAIN,
|
|
|
|
N_("Scroll Up"), WITHORSANS(scrollup_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_scroll_down, MMAIN,
|
|
|
|
N_("Scroll Down"), WITHORSANS(scrolldown_gist), BLANKAFTER, VIEW);
|
2017-03-23 11:31:56 +01:00
|
|
|
#endif
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_prev_block, MMAIN,
|
|
|
|
N_("Prev Block"), WITHORSANS(prevblock_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_block, MMAIN,
|
|
|
|
N_("Next Block"), WITHORSANS(nextblock_gist), TOGETHER, VIEW);
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_para_begin_void, MMAIN|MWHEREIS,
|
|
|
|
N_("Beg of Par"), WITHORSANS(parabegin_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_para_end_void, MMAIN|MWHEREIS,
|
|
|
|
N_("End of Par"), WITHORSANS(paraend_gist), BLANKAFTER, VIEW);
|
2006-04-24 20:50:52 +00:00
|
|
|
#endif
|
2005-01-01 07:43:32 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_page_up, MMAIN|MHELP,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Prev Page"), WITHORSANS(prevpage_gist), TOGETHER, VIEW);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_page_down, MMAIN|MHELP,
|
2018-08-28 21:39:01 +02:00
|
|
|
N_("Next Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
2017-03-23 11:31:56 +01:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(to_first_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
|
|
|
N_("First Line"), WITHORSANS(firstline_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(to_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
|
|
|
N_("Last Line"), WITHORSANS(lastline_gist), BLANKAFTER, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(switch_to_prev_buffer, MMAIN,
|
|
|
|
N_("Prev File"), WITHORSANS(prevfile_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(switch_to_next_buffer, MMAIN,
|
|
|
|
N_("Next File"), WITHORSANS(nextfile_gist), BLANKAFTER, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
|
2017-11-01 19:45:33 +01:00
|
|
|
#if (!defined(ENABLE_JUSTIFY) && (defined(ENABLE_SPELLER) || defined(ENABLE_COLOR)) || \
|
2017-12-29 19:27:33 +01:00
|
|
|
defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER) && !defined(ENABLE_COLOR))
|
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2014-05-27 12:17:49 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_tab, MMAIN,
|
|
|
|
N_("Tab"), WITHORSANS(tab_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_enter, MMAIN,
|
|
|
|
N_("Enter"), WITHORSANS(enter_gist), BLANKAFTER, NOVIEW);
|
2015-07-31 11:52:26 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_delete, MMAIN,
|
|
|
|
N_("Delete"), WITHORSANS(delete_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_backspace, MMAIN,
|
|
|
|
N_("Backspace"), WITHORSANS(backspace_gist),
|
2006-04-22 20:00:23 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
TOGETHER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#else
|
2017-12-29 19:27:33 +01:00
|
|
|
BLANKAFTER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
NOVIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_cut_prev_word, MMAIN,
|
|
|
|
/* TRANSLATORS: The next two strings refer to cutting words. */
|
|
|
|
N_("Cut Left"), WITHORSANS(cutwordleft_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_cut_next_word, MMAIN,
|
|
|
|
N_("Cut Right"), WITHORSANS(cutwordright_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_cut_till_eof, MMAIN,
|
|
|
|
N_("CutTillEnd"), WITHORSANS(cuttilleof_gist), BLANKAFTER, NOVIEW);
|
2004-04-30 04:49:02 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_full_justify, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("FullJstify"), WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
|
2003-09-04 20:25:29 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_wordlinechar_count, MMAIN,
|
|
|
|
N_("Word Count"), WITHORSANS(wordcount_gist), TOGETHER, VIEW);
|
2001-06-14 02:54:22 +00:00
|
|
|
#endif
|
2003-01-05 20:41:21 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_verbatim_input, MMAIN,
|
|
|
|
N_("Verbatim"), WITHORSANS(verbatim_gist), BLANKAFTER, NOVIEW);
|
2017-04-11 13:15:00 +02:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(total_refresh, MMAIN,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Refresh"), WITHORSANS(refresh_gist), TOGETHER, VIEW);
|
2008-03-13 08:23:52 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_suspend_void, MMAIN,
|
|
|
|
N_("Suspend"), WITHORSANS(suspend_gist), BLANKAFTER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-03-23 11:31:56 +01:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_indent, MMAIN,
|
2018-08-29 20:17:41 +02:00
|
|
|
N_("Indent"), WITHORSANS(indent_gist), TOGETHER, NOVIEW);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_unindent, MMAIN,
|
2018-08-29 20:17:41 +02:00
|
|
|
N_("Unindent"), WITHORSANS(unindent_gist), BLANKAFTER, NOVIEW);
|
2017-03-23 11:31:56 +01:00
|
|
|
#endif
|
2016-05-25 22:13:50 +02:00
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_comment, MMAIN,
|
|
|
|
N_("Comment Lines"), WITHORSANS(comment_gist), TOGETHER, NOVIEW);
|
2017-12-26 21:36:29 +01:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(complete_a_word, MMAIN,
|
|
|
|
N_("Complete"), WITHORSANS(completion_gist), BLANKAFTER, NOVIEW);
|
2016-05-25 22:13:50 +02:00
|
|
|
#endif
|
2015-07-25 19:25:50 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(record_macro, MMAIN,
|
|
|
|
N_("Record"), WITHORSANS(recordmacro_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(run_macro, MMAIN,
|
|
|
|
N_("Run Macro"), WITHORSANS(runmacro_gist), BLANKAFTER, VIEW);
|
2018-07-25 21:27:06 +02:00
|
|
|
|
2018-10-23 20:25:22 -06:00
|
|
|
add_to_funcs(zap_text, MMAIN,
|
|
|
|
N_("Zap Text"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
|
|
|
|
|
2018-09-30 13:57:33 +02:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_funcs(do_linter, MMAIN,
|
|
|
|
N_("To Linter"), WITHORSANS(lint_gist), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_savefile, MMAIN,
|
|
|
|
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
|
2018-07-25 21:27:06 +02:00
|
|
|
#endif
|
2016-05-14 12:29:51 +02:00
|
|
|
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifndef ENABLE_JUSTIFY
|
2018-02-04 10:34:39 +01:00
|
|
|
add_to_funcs(flip_goto, MWHEREIS,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2005-06-03 20:51:39 +00:00
|
|
|
#endif
|
2001-07-16 00:48:53 +00:00
|
|
|
|
2018-02-04 10:34:39 +01:00
|
|
|
add_to_funcs(flip_goto, MGOTOLINE,
|
2017-12-29 19:27:33 +01:00
|
|
|
N_("Go To Text"), WITHORSANS(whereis_gist), BLANKAFTER, VIEW);
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2005-11-15 03:17:35 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(dos_format_void, MWRITEFILE,
|
|
|
|
N_("DOS Format"), WITHORSANS(dos_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(mac_format_void, MWRITEFILE,
|
|
|
|
N_("Mac Format"), WITHORSANS(mac_gist), 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. */
|
|
|
|
if (!ISSET(RESTRICTED)) {
|
|
|
|
add_to_funcs(append_void, MWRITEFILE,
|
|
|
|
N_("Append"), WITHORSANS(append_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(prepend_void, MWRITEFILE,
|
|
|
|
N_("Prepend"), WITHORSANS(prepend_gist), TOGETHER, NOVIEW);
|
|
|
|
|
|
|
|
add_to_funcs(backup_file_void, MWRITEFILE,
|
|
|
|
N_("Backup File"), WITHORSANS(backup_gist), BLANKAFTER, NOVIEW);
|
|
|
|
}
|
2017-05-08 13:20:07 +02:00
|
|
|
#endif /* !NANO_TINY */
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2018-03-22 19:54:20 +01:00
|
|
|
/* Multiple buffers are only available when not in restricted mode. */
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
|
|
|
|
N_("New Buffer"), WITHORSANS(newbuffer_gist), TOGETHER, NOVIEW);
|
2002-03-21 05:07:28 +00:00
|
|
|
#endif
|
2018-09-08 12:23:39 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-08-19 13:29:43 +02:00
|
|
|
add_to_funcs(flip_convert, MINSERTFILE,
|
|
|
|
N_("No Conversion"), WITHORSANS(convert_gist), TOGETHER, NOVIEW);
|
|
|
|
|
|
|
|
/* Command execution is only available when not in restricted mode. */
|
|
|
|
if (!ISSET(RESTRICTED)) {
|
|
|
|
add_to_funcs(flip_execute, MINSERTFILE,
|
|
|
|
N_("Execute Command"), WITHORSANS(execute_gist), TOGETHER, NOVIEW);
|
|
|
|
|
2018-05-15 22:20:11 -03:00
|
|
|
add_to_funcs(flip_pipe, MEXTCMD,
|
|
|
|
N_("Pipe Text"), WITHORSANS(pipe_gist), TOGETHER, NOVIEW);
|
2018-08-19 13:29:43 +02:00
|
|
|
|
|
|
|
add_to_funcs(flip_execute, MEXTCMD,
|
|
|
|
N_("Read File"), WITHORSANS(readfile_gist), TOGETHER, NOVIEW);
|
|
|
|
}
|
2018-05-23 11:57:55 +02:00
|
|
|
#endif
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2018-03-22 19:54:20 +01:00
|
|
|
/* The file browser is only available when not in restricted mode. */
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
|
|
|
N_("To Files"), WITHORSANS(tofiles_gist), TOGETHER, VIEW);
|
|
|
|
|
|
|
|
add_to_funcs(do_page_up, MBROWSER,
|
2018-07-30 20:45:15 +02:00
|
|
|
N_("Prev Page"), WITHORSANS(prevpage_gist), TOGETHER, VIEW);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_page_down, MBROWSER,
|
2018-10-09 21:54:54 +02:00
|
|
|
N_("Next Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
2017-12-29 19:27:33 +01:00
|
|
|
|
|
|
|
add_to_funcs(to_first_file, MBROWSER|MWHEREISFILE,
|
|
|
|
N_("First File"), WITHORSANS(firstfile_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(to_last_file, MBROWSER|MWHEREISFILE,
|
|
|
|
N_("Last File"), WITHORSANS(lastfile_gist), BLANKAFTER, VIEW);
|
2016-05-17 12:48:47 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_prev_word_void, MBROWSER,
|
|
|
|
N_("Left Column"), WITHORSANS(browserlefthand_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_word_void, MBROWSER,
|
|
|
|
N_("Right Column"), WITHORSANS(browserrighthand_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_prev_block, MBROWSER,
|
|
|
|
N_("Top Row"), WITHORSANS(browsertoprow_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_next_block, MBROWSER,
|
|
|
|
N_("Bottom Row"), WITHORSANS(browserbottomrow_gist), BLANKAFTER, VIEW);
|
2016-05-02 09:34:23 +02:00
|
|
|
#endif
|
2017-08-19 18:11:59 +02:00
|
|
|
#endif /* ENABLE_BROWSER */
|
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(discard_buffer, MWRITEFILE,
|
|
|
|
N_("Discard buffer"), WITHORSANS(discardbuffer_gist), BLANKAFTER, NOVIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_funcs(do_page_up, MLINTER,
|
|
|
|
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
|
|
|
|
N_("Prev Lint Msg"), WITHORSANS(prevlint_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_page_down, MLINTER,
|
|
|
|
N_("Next Lint Msg"), WITHORSANS(nextlint_gist), TOGETHER, VIEW);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Link key combos to functions in certain menus. */
|
|
|
|
add_to_sclist(MMOST, "^M", 0, do_enter, 0);
|
|
|
|
add_to_sclist(MMOST, "Enter", KEY_ENTER, do_enter, 0);
|
|
|
|
add_to_sclist(MMOST, "^H", 0, do_backspace, 0);
|
|
|
|
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
|
|
|
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
|
|
|
add_to_sclist(MMOST, "Del", 0, do_delete, 0);
|
2018-09-14 19:11:56 +02:00
|
|
|
/* Make ASCII DEL do a delete when requested, otherwise a backspace. */
|
|
|
|
if (ISSET(REBIND_DELETE))
|
|
|
|
add_to_sclist(MMOST, "Del", DEL_CODE, do_delete, 0);
|
|
|
|
else
|
|
|
|
add_to_sclist(MMOST, "Bsp", DEL_CODE, do_backspace, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMOST, "^I", 0, do_tab, 0);
|
|
|
|
add_to_sclist(MMOST, "Tab", TAB_CODE, do_tab, 0);
|
|
|
|
add_to_sclist(MMOST & ~MFINDINHELP, "^G", 0, do_help_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
|
|
|
|
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
2018-07-27 20:07:15 +02:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^Q", 0, do_search_backward, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search_forward, 0);
|
|
|
|
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMOST, "^K", 0, do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^U", 0, do_uncut_text, 0);
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "^J", 0, do_justify_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2017-10-31 19:32:42 +01:00
|
|
|
#ifdef ENABLE_SPELLER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "^T", 0, do_spell, 0);
|
|
|
|
#endif
|
2018-09-23 16:15:55 +02:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
2018-03-01 09:44:38 +01:00
|
|
|
add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
2018-07-31 20:21:17 +02:00
|
|
|
add_to_sclist(MHELP|MBROWSER, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
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);
|
2018-07-31 20:21:17 +02:00
|
|
|
add_to_sclist(MHELP|MBROWSER, "Space", 0x20, do_page_down, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-\\", 0, to_first_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, to_first_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-/", 0, to_last_line, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, to_last_line, 0);
|
2018-07-27 20:07:15 +02:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_findnext, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-Q", 0, do_findprevious, 0);
|
2016-09-08 21:00:51 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
|
|
|
|
add_to_sclist(MMAIN, "Tab", TAB_CODE, do_indent, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
|
|
|
add_to_sclist(MMAIN, "Sh-Tab", SHIFT_TAB, do_unindent, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-:", 0, record_macro, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-;", 0, run_macro, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-E", 0, do_redo, 0);
|
2018-09-23 19:57:04 +02:00
|
|
|
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, do_cut_prev_word, 0);
|
2018-07-12 18:47:46 -03:00
|
|
|
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, do_cut_next_word, 0);
|
2016-12-07 13:10:40 +01:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
2016-05-25 22:13:50 +02:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMOST, "^B", 0, do_left, 0);
|
|
|
|
add_to_sclist(MMOST, "^F", 0, do_right, 0);
|
2016-10-29 10:19:28 +02:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 19:27:33 +01:00
|
|
|
if (using_utf8()) {
|
2018-10-02 19:59:59 +02:00
|
|
|
add_to_sclist(MMOST|MHELP, "\xE2\x97\x80", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST|MHELP, "\xE2\x96\xb6", KEY_RIGHT, do_right, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MSOME, "^\xE2\x97\x80", CONTROL_LEFT, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MSOME, "^\xE2\x96\xb6", CONTROL_RIGHT, do_next_word_void, 0);
|
2018-10-07 15:44:28 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-10-12 12:30:51 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-\xE2\x97\x80", ALT_LEFT, switch_to_prev_buffer, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-\xE2\x96\xb6", ALT_RIGHT, switch_to_next_buffer, 0);
|
2018-10-12 12:30:51 +02:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-\xE2\x96\xb2", ALT_UP, do_findprevious, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-\xE2\x96\xbc", ALT_DOWN, do_findnext, 0);
|
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2018-10-02 19:59:59 +02:00
|
|
|
add_to_sclist(MMOST|MHELP, "Left", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST|MHELP, "Right", KEY_RIGHT, do_right, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
|
|
|
}
|
|
|
|
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
|
|
|
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end, 0);
|
|
|
|
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end, 0);
|
2018-03-12 18:28:44 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down, 0);
|
2016-10-29 10:19:28 +02:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 19:27:33 +01:00
|
|
|
if (using_utf8()) {
|
2018-03-12 18:28:44 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xb2", KEY_UP, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x96\xbc", KEY_DOWN, do_down, 0);
|
2018-09-29 09:40:53 +02:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xb2", CONTROL_UP, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xbc", CONTROL_DOWN, do_next_block, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2018-03-12 18:28:44 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down, 0);
|
2018-09-29 09:40:53 +02:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Up", CONTROL_UP, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
2017-12-29 19:27:33 +01:00
|
|
|
}
|
|
|
|
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01: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
|
2018-10-24 17:30:27 +02:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2017-12-29 19:27:33 +01: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
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-<", 0, switch_to_prev_buffer, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-,", 0, switch_to_prev_buffer, 0);
|
|
|
|
add_to_sclist(MMAIN, "M->", 0, switch_to_next_buffer, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-.", 0, switch_to_next_buffer, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMOST, "M-V", 0, do_verbatim_input, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01: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
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN|MWHEREIS, "M-J", 0, do_full_justify, 0);
|
2011-02-07 14:45:56 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^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
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Group of "Appearance" toggles. */
|
|
|
|
add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
|
|
|
|
add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
|
|
|
|
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 09:44:29 +01:00
|
|
|
#ifdef ENABLE_LINENUMBERS
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
|
2016-10-20 09:44:29 +01:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY);
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 19:27:33 +01: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
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Group of "Editing-behavior" toggles. */
|
|
|
|
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_FROM_CURSOR);
|
2017-10-29 21:00:09 +01:00
|
|
|
#ifdef ENABLE_WRAPPING
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, NO_WRAP);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2018-07-13 13:57:06 +02:00
|
|
|
add_to_sclist(MMAIN, "M-O", 0, do_toggle_void, TABS_TO_SPACES);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
/* Group of "Peripheral-feature" toggles. */
|
2017-05-01 20:45:07 +02:00
|
|
|
#ifdef ENABLE_MOUSE
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MMAIN, "M-M", 0, do_toggle_void, USE_MOUSE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
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
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(((MMOST & ~MMAIN & ~MBROWSER) | MYESNO), "^C", 0, do_cancel, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2017-12-29 19:27:33 +01: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, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^Y", 0, to_first_line, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MFINDINHELP, "^V", 0, to_last_line, 0);
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01: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
|
2018-02-04 10:34:39 +01:00
|
|
|
add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0);
|
2017-10-29 19:42:12 +01:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "^P", 0, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "^N", 0, get_history_newer_void, 0);
|
2017-04-09 16:30:38 -05:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 19:27:33 +01:00
|
|
|
if (using_utf8()) {
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "\xE2\x96\xb2", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "\xE2\x96\xbc", KEY_DOWN, get_history_newer_void, 0);
|
|
|
|
} else
|
2017-04-09 16:30:38 -05:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
{
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "Up", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXTCMD, "Down", KEY_DOWN, get_history_newer_void, 0);
|
|
|
|
}
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MWHEREISFILE, "^Y", 0, to_first_file, 0);
|
|
|
|
add_to_sclist(MWHEREISFILE, "^V", 0, to_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, to_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, to_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "Home", KEY_HOME, to_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "End", KEY_END, to_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, to_first_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "^End", CONTROL_END, to_last_file, 0);
|
|
|
|
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
|
|
|
|
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
|
|
|
|
#endif
|
|
|
|
if (ISSET(TEMP_FILE))
|
|
|
|
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
|
2017-04-19 13:24:41 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
|
2018-03-22 19:54:20 +01:00
|
|
|
/* Only when not in restricted mode, allow Appending, Prepending,
|
|
|
|
* making backups, and executing a command. */
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
|
|
|
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, 0);
|
|
|
|
}
|
2018-08-19 12:35:15 +02:00
|
|
|
add_to_sclist(MINSERTFILE, "M-N", 0, flip_convert, 0);
|
2017-04-19 13:24:41 +02:00
|
|
|
#endif
|
2017-05-08 13:20:07 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2018-03-22 19:54:20 +01:00
|
|
|
/* Only when not in restricted mode, allow multiple buffers. */
|
2018-05-15 22:20:11 -03:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
|
2018-05-28 11:31:30 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-05-15 22:20:11 -03:00
|
|
|
add_to_sclist(MEXTCMD, "M-\\", 0, flip_pipe, 0);
|
2018-05-28 11:31:30 +02:00
|
|
|
#endif
|
2018-05-15 22:20:11 -03:00
|
|
|
}
|
2017-05-08 13:20:07 +02:00
|
|
|
#endif
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2018-03-22 19:54:20 +01:00
|
|
|
/* Only when not in restricted mode, allow entering the file browser. */
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
|
2017-04-19 13:24:41 +02:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
|
|
|
|
/* Allow exiting from the file browser and the help viewer with
|
|
|
|
* the same key as they were entered. */
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
2015-11-08 19:40:13 +00:00
|
|
|
#endif
|
2017-04-25 17:51:45 +02:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 19:27:33 +01:00
|
|
|
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MHELP, "F1", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MHELP, "Home", KEY_HOME, to_first_line, 0);
|
|
|
|
add_to_sclist(MHELP, "End", KEY_END, to_last_line, 0);
|
2016-10-15 17:55:19 +02:00
|
|
|
#endif
|
2018-09-24 21:29:44 +02:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_sclist(MLINTER, "^X", 0, do_cancel, 0);
|
|
|
|
#endif
|
2018-10-07 14:42:42 +02:00
|
|
|
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
|
|
|
add_to_sclist(MMAIN, "F3", 0, do_writeout_void, 0);
|
|
|
|
#ifdef ENABLE_JUSTIFY
|
|
|
|
add_to_sclist(MMAIN, "F4", 0, do_justify_void, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search_forward, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
|
|
|
add_to_sclist(MMOST, "F9", 0, do_cut_text_void, 0);
|
|
|
|
add_to_sclist(MMOST, "F10", 0, do_uncut_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "F11", 0, do_cursorpos_void, 0);
|
|
|
|
#ifdef ENABLE_SPELLER
|
|
|
|
add_to_sclist(MMAIN, "F12", 0, do_spell, 0);
|
|
|
|
#endif
|
2001-01-03 07:11:47 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifdef DEBUG
|
2017-12-29 19:27:33 +01:00
|
|
|
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
|
|
|
|
2016-01-04 09:52:43 +00:00
|
|
|
const subnfunc *sctofunc(const sc *s)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
subnfunc *f = allfuncs;
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2018-02-24 19:31:11 +01:00
|
|
|
while (f != NULL && f->func != s->func)
|
2017-12-29 19:27:33 +01:00
|
|
|
f = f->next;
|
2004-07-12 03:10:30 +00:00
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
return f;
|
2004-07-12 03:10:30 +00:00
|
|
|
}
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2018-04-01 20:11:44 +02:00
|
|
|
/* Return the textual description that corresponds to the given flag. */
|
2009-11-29 06:13:22 +00:00
|
|
|
const char *flagtostr(int flag)
|
2004-07-12 03:10:30 +00:00
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
switch (flag) {
|
|
|
|
case NO_HELP:
|
2018-08-29 20:25:57 +02:00
|
|
|
/* TRANSLATORS: The next fourteen strings are toggle descriptions;
|
2017-12-29 19:27:33 +01:00
|
|
|
* they are best kept shorter than 40 characters, but may be longer. */
|
|
|
|
return N_("Help mode");
|
|
|
|
case CONSTANT_SHOW:
|
|
|
|
return N_("Constant cursor position display");
|
|
|
|
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_FROM_CURSOR:
|
|
|
|
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 USE_MOUSE:
|
|
|
|
return N_("Mouse support");
|
|
|
|
case SUSPEND:
|
|
|
|
return N_("Suspension");
|
|
|
|
case LINE_NUMBERS:
|
|
|
|
return N_("Line numbering");
|
|
|
|
default:
|
|
|
|
return "Bad toggle -- please report a bug";
|
|
|
|
}
|
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
|
|
|
|
2017-05-08 19:42:44 +02:00
|
|
|
#ifdef ENABLE_NANORC
|
2014-04-13 11:56:08 +00:00
|
|
|
/* Interpret a function string given in the rc file, and return a
|
2018-08-20 19:31:23 +02:00
|
|
|
* shortcut record 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
|
|
|
{
|
2017-12-29 19:27:33 +01:00
|
|
|
sc *s = nmalloc(sizeof(sc));
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2016-09-01 09:36:47 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
s->toggle = 0;
|
2016-09-01 09:36:47 +02:00
|
|
|
#endif
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-04-25 17:51:45 +02:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!strcasecmp(input, "help"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_help_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (!strcasecmp(input, "cancel"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cancel;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "exit"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_exit;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "discardbuffer"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = discard_buffer;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "writeout"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_writeout_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "savefile"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_savefile;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "insert"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_insertfile_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "whereis"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_search_forward;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "wherewas"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_search_backward;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "findprevious"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_findprevious;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "findnext"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_findnext;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "replace"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_replace;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "cut"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cut_text_void;
|
2018-06-01 12:47:04 +02:00
|
|
|
else if (!strcasecmp(input, "paste") ||
|
|
|
|
!strcasecmp(input, "uncut")) /* Deprecated. Remove end of 2018. */
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_uncut_text;
|
2014-04-27 15:26:25 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "cutrestoffile"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cut_till_eof;
|
2018-06-01 12:47:04 +02:00
|
|
|
else if (!strcasecmp(input, "copy") ||
|
|
|
|
!strcasecmp(input, "copytext")) /* Deprecated. Remove end of 2018. */
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_copy_text;
|
2018-10-23 20:25:22 -06:00
|
|
|
else if (!strcasecmp(input, "zap"))
|
|
|
|
s->func = zap_text;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "mark"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_mark;
|
2014-05-09 15:14:29 +00:00
|
|
|
#endif
|
2017-10-31 19:32:42 +01:00
|
|
|
#ifdef ENABLE_SPELLER
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "tospell") ||
|
|
|
|
!strcasecmp(input, "speller"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_spell;
|
2014-04-27 15:26:25 +00:00
|
|
|
#endif
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "linter"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_linter;
|
2017-12-29 19:27:33 +01:00
|
|
|
#endif
|
2018-02-04 13:51:13 +01:00
|
|
|
else if (!strcasecmp(input, "curpos"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cursorpos_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "gotoline"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_gotolinecolumn_void;
|
2017-10-31 17:34:07 +01:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "justify"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_justify_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "fulljustify"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_full_justify;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "beginpara"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_para_begin_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "endpara"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_para_end_void;
|
2008-03-16 12:55:41 +00:00
|
|
|
#endif
|
2016-05-25 22:13:50 +02:00
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "comment"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_comment;
|
2016-05-25 22:13:50 +02:00
|
|
|
#endif
|
2016-12-07 13:20:36 +01:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "complete"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = complete_a_word;
|
2016-12-07 13:20:36 +01:00
|
|
|
#endif
|
2008-03-16 12:55:41 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "indent"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_indent;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "unindent"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_unindent;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "cutwordleft"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cut_prev_word;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "cutwordright"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_cut_next_word;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "findbracket"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_find_bracket;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "wordcount"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_wordlinechar_count;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "recordmacro"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = record_macro;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "runmacro"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = run_macro;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "undo"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_undo;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "redo"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_redo;
|
2017-12-29 19:27:33 +01:00
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "left") ||
|
|
|
|
!strcasecmp(input, "back"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_left;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "right") ||
|
|
|
|
!strcasecmp(input, "forward"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_right;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "up") ||
|
|
|
|
!strcasecmp(input, "prevline"))
|
2018-03-12 18:28:44 +01:00
|
|
|
s->func = do_up;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "down") ||
|
|
|
|
!strcasecmp(input, "nextline"))
|
2018-03-12 18:28:44 +01:00
|
|
|
s->func = do_down;
|
2018-10-24 17:30:27 +02:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2018-03-31 16:50:26 +02:00
|
|
|
else if (!strcasecmp(input, "scrollup"))
|
|
|
|
s->func = do_scroll_up;
|
|
|
|
else if (!strcasecmp(input, "scrolldown"))
|
|
|
|
s->func = do_scroll_down;
|
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "prevword"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_prev_word_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "nextword"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_next_word_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "home"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_home;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "end"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_end;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "prevblock"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_prev_block;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "nextblock"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_next_block;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "pageup") ||
|
|
|
|
!strcasecmp(input, "prevpage"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_page_up;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "pagedown") ||
|
|
|
|
!strcasecmp(input, "nextpage"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_page_down;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "firstline"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = to_first_line;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "lastline"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = to_last_line;
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "prevbuf"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = switch_to_prev_buffer;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "nextbuf"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = switch_to_next_buffer;
|
2017-12-29 19:27:33 +01:00
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "verbatim"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_verbatim_input;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "tab"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_tab;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "enter"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_enter;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "delete"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_delete;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "backspace"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_backspace;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "refresh"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = total_refresh;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "suspend"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_suspend_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "casesens"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = case_sens_void;
|
2018-02-04 13:51:13 +01:00
|
|
|
else if (!strcasecmp(input, "regexp"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = regexp_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "backwards"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = backwards_void;
|
2018-02-04 13:51:13 +01:00
|
|
|
else if (!strcasecmp(input, "flipreplace"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = flip_replace;
|
2018-02-04 10:34:39 +01:00
|
|
|
else if (!strcasecmp(input, "flipgoto") ||
|
|
|
|
!strcasecmp(input, "gototext")) /* Deprecated. Remove end of 2018. */
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = flip_goto;
|
2017-10-29 19:42:12 +01:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2018-10-08 19:27:56 +02:00
|
|
|
else if (!strcasecmp(input, "older"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = get_history_older_void;
|
2018-10-08 19:27:56 +02:00
|
|
|
else if (!strcasecmp(input, "newer"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = get_history_newer_void;
|
2014-06-28 15:34:10 +00:00
|
|
|
#endif
|
2017-04-19 13:24:41 +02:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "dosformat"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = dos_format_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "macformat"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = mac_format_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "append"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = append_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "prepend"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = prepend_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "backup"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = backup_file_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "flipexecute"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = flip_execute;
|
2018-05-26 14:30:50 -05:00
|
|
|
else if (!strcasecmp(input, "flippipe"))
|
|
|
|
s->func = flip_pipe;
|
2018-08-19 12:35:15 +02:00
|
|
|
else if (!strcasecmp(input, "flipconvert"))
|
|
|
|
s->func = flip_convert;
|
2014-06-04 19:15:16 +00:00
|
|
|
#endif
|
2017-05-01 20:20:34 +02:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2018-02-04 13:51:13 +01:00
|
|
|
else if (!strcasecmp(input, "flipnewbuffer"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = flip_newbuffer;
|
2008-03-09 02:52:40 +00:00
|
|
|
#endif
|
2017-05-08 19:08:23 +02:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "tofiles") ||
|
|
|
|
!strcasecmp(input, "browser"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = to_files_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "gotodir"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = goto_dir_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "firstfile"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = to_first_file;
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "lastfile"))
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = to_last_file;
|
2017-12-29 19:27:33 +01:00
|
|
|
#endif
|
|
|
|
else {
|
2016-09-03 12:14:08 +02:00
|
|
|
#ifndef NANO_TINY
|
2018-02-24 19:31:11 +01:00
|
|
|
s->func = do_toggle_void;
|
2017-12-29 19:27:33 +01:00
|
|
|
if (!strcasecmp(input, "nohelp"))
|
|
|
|
s->toggle = NO_HELP;
|
2018-04-28 12:01:23 +02:00
|
|
|
else if (!strcasecmp(input, "constantshow") ||
|
|
|
|
!strcasecmp(input, "constupdate")) /* Deprecated. Remove end of 2018. */
|
2017-12-29 19:27:33 +01:00
|
|
|
s->toggle = CONSTANT_SHOW;
|
|
|
|
else if (!strcasecmp(input, "smoothscroll"))
|
|
|
|
s->toggle = SMOOTH_SCROLL;
|
|
|
|
else if (!strcasecmp(input, "softwrap"))
|
|
|
|
s->toggle = SOFTWRAP;
|
2018-04-28 11:44:53 +02:00
|
|
|
#ifdef ENABLE_LINENUMBERS
|
|
|
|
else if (!strcasecmp(input, "linenumbers"))
|
|
|
|
s->toggle = LINE_NUMBERS;
|
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "whitespacedisplay"))
|
|
|
|
s->toggle = WHITESPACE_DISPLAY;
|
2017-11-01 19:45:33 +01:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "nosyntax"))
|
|
|
|
s->toggle = NO_COLOR_SYNTAX;
|
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "smarthome"))
|
|
|
|
s->toggle = SMART_HOME;
|
|
|
|
else if (!strcasecmp(input, "autoindent"))
|
|
|
|
s->toggle = AUTOINDENT;
|
2018-04-28 12:01:23 +02:00
|
|
|
else if (!strcasecmp(input, "cutfromcursor") ||
|
|
|
|
!strcasecmp(input, "cuttoend")) /* Deprecated. Remove end of 2018. */
|
2017-12-29 19:27:33 +01:00
|
|
|
s->toggle = CUT_FROM_CURSOR;
|
2017-10-29 21:00:09 +01:00
|
|
|
#ifdef ENABLE_WRAPPING
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "nowrap"))
|
|
|
|
s->toggle = NO_WRAP;
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "tabstospaces"))
|
|
|
|
s->toggle = TABS_TO_SPACES;
|
2017-05-01 20:45:07 +02:00
|
|
|
#ifdef ENABLE_MOUSE
|
2017-12-29 19:27:33 +01:00
|
|
|
else if (!strcasecmp(input, "mouse"))
|
|
|
|
s->toggle = USE_MOUSE;
|
|
|
|
#endif
|
|
|
|
else if (!strcasecmp(input, "suspendenable"))
|
|
|
|
s->toggle = SUSPEND;
|
|
|
|
else
|
2014-06-28 15:00:29 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2017-12-29 19:27:33 +01:00
|
|
|
{
|
|
|
|
free(s);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-06-28 15:22:41 +00:00
|
|
|
}
|
2017-12-29 19:27:33 +01:00
|
|
|
return s;
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
2006-04-20 22:29:02 +00:00
|
|
|
|
2018-08-11 09:51:33 +02:00
|
|
|
/* Return the symbol that corresponds to the given menu name. */
|
|
|
|
int name_to_menu(const char *name)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2018-08-06 21:12:22 +02:00
|
|
|
int index = -1;
|
|
|
|
|
|
|
|
while (++index < NUMBER_OF_MENUS)
|
2018-08-11 09:51:33 +02:00
|
|
|
if (strcasecmp(name, menunames[index]) == 0)
|
2018-08-06 21:12:22 +02:00
|
|
|
return menusymbols[index];
|
|
|
|
|
2017-12-29 19:27:33 +01:00
|
|
|
return -1;
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
2018-08-06 21:29:01 +02:00
|
|
|
|
|
|
|
/* Return the name that corresponds to the given menu symbol. */
|
|
|
|
char *menu_to_name(int menu)
|
|
|
|
{
|
|
|
|
int index = -1;
|
|
|
|
|
|
|
|
while (++index < NUMBER_OF_MENUS)
|
|
|
|
if (menusymbols[index] == menu)
|
|
|
|
return menunames[index];
|
|
|
|
|
|
|
|
return "boooo";
|
|
|
|
}
|
2017-05-08 19:42:44 +02:00
|
|
|
#endif /* ENABLE_NANORC */
|