2000-06-06 05:53:49 +00:00
|
|
|
/**************************************************************************
|
2016-09-03 10:14:08 +00:00
|
|
|
* global.c -- This file is part of GNU nano. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
2020-01-15 10:42:38 +00:00
|
|
|
* Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. *
|
2020-03-11 10:52:15 +00:00
|
|
|
* Copyright (C) 2014-2020 Benno Schulenberg *
|
2016-08-29 13:14:18 +00:00
|
|
|
* *
|
2016-08-29 15:10:49 +00:00
|
|
|
* GNU nano is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published *
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, *
|
|
|
|
* or (at your option) any later version. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
2016-08-29 15:10:49 +00:00
|
|
|
* GNU nano is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty *
|
|
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* See the GNU General Public License for more details. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
2016-08-29 15:10:49 +00:00
|
|
|
* along with this program. If not, see http://www.gnu.org/licenses/. *
|
2000-06-06 05:53:49 +00:00
|
|
|
* *
|
|
|
|
**************************************************************************/
|
|
|
|
|
2008-07-12 02:13:22 +00:00
|
|
|
#include "proto.h"
|
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#include <ctype.h>
|
2008-03-12 04:44:14 +00:00
|
|
|
#include <string.h>
|
2008-03-05 07:34:01 +00:00
|
|
|
#include <strings.h>
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2006-05-10 13:41:53 +00:00
|
|
|
/* Global variables. */
|
|
|
|
#ifndef NANO_TINY
|
2016-12-14 19:37:03 +00:00
|
|
|
volatile sig_atomic_t the_window_resized = FALSE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Set to TRUE by the handler whenever a SIGWINCH occurs. */
|
2006-05-10 13:41:53 +00:00
|
|
|
#endif
|
|
|
|
|
2019-05-13 10:50:31 +00:00
|
|
|
bool on_a_vt = FALSE;
|
|
|
|
/* Whether we're running on a Linux console (a VT). */
|
2020-01-21 11:31:34 +00:00
|
|
|
bool shifted_metas = FALSE;
|
|
|
|
/* Whether any Sh-M-<letter> combo has been bound. */
|
2016-08-11 10:37:11 +00:00
|
|
|
|
2014-06-30 18:04:33 +00:00
|
|
|
bool meta_key;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether the current keystroke is a Meta key. */
|
2016-04-24 09:28:28 +00:00
|
|
|
bool shift_held;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether Shift was being held together with a movement key. */
|
2020-01-23 11:32:28 +00:00
|
|
|
bool mute_modifiers = FALSE;
|
|
|
|
/* Whether to ignore modifier keys while running a macro or string bind. */
|
2020-01-03 23:52:21 +00:00
|
|
|
bool bracketed_paste = FALSE;
|
|
|
|
/* Whether text is being pasted into nano from outside. */
|
2020-01-23 11:32:28 +00:00
|
|
|
|
2020-02-02 16:05:06 +00:00
|
|
|
bool started_curses = FALSE;
|
|
|
|
/* Becomes TRUE when curses mode has been entered the first time. */
|
|
|
|
bool we_are_running = FALSE;
|
|
|
|
/* Becomes TRUE as soon as all options and files have been read. */
|
|
|
|
bool more_than_one = FALSE;
|
|
|
|
/* Whether more than one buffer is or has been open. */
|
|
|
|
|
2020-05-22 09:46:30 +00:00
|
|
|
bool ran_a_tool = FALSE;
|
|
|
|
/* Whether a tool has been run at the Execute-Command prompt. */
|
|
|
|
|
2020-02-02 16:05:06 +00:00
|
|
|
bool inhelp = FALSE;
|
|
|
|
/* Whether we are in the help viewer. */
|
|
|
|
char *title = NULL;
|
|
|
|
/* When not NULL: the title of the current help text. */
|
|
|
|
|
|
|
|
bool refresh_needed = FALSE;
|
|
|
|
/* Did a command mangle enough of the buffer that we should
|
|
|
|
* repaint the screen? */
|
2016-04-12 08:24:57 +00:00
|
|
|
bool focusing = TRUE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether an update of the edit window should center the cursor. */
|
2016-05-19 18:43:08 +00:00
|
|
|
|
2016-12-20 18:27:41 +00:00
|
|
|
bool as_an_at = TRUE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether a 0x0A byte should be shown as a ^@ instead of a ^J. */
|
2016-12-20 18:27:41 +00:00
|
|
|
|
2019-05-26 11:10:47 +00:00
|
|
|
bool control_C_was_pressed = FALSE;
|
|
|
|
/* Whether Ctrl+C was pressed (when a keyboard interrupt is enabled). */
|
|
|
|
|
2017-05-29 20:06:59 +00:00
|
|
|
bool suppress_cursorpos = FALSE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Should we skip constant position display for current keystroke? */
|
2017-05-29 20:06:59 +00:00
|
|
|
|
2016-05-19 18:43:08 +00:00
|
|
|
message_type lastmessage = HUSH;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
2014-06-30 18:04:33 +00:00
|
|
|
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *pletion_line = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The line where the last completion was found, if any. */
|
2016-12-07 04:13:47 +00:00
|
|
|
|
2017-12-24 11:26:55 +00:00
|
|
|
bool also_the_last = FALSE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether indenting/commenting should include the last line of
|
|
|
|
* the marked region. */
|
2019-06-28 18:07:42 +00:00
|
|
|
|
2020-02-02 16:05:06 +00:00
|
|
|
char *answer = NULL;
|
|
|
|
/* The answer string used by the status-bar prompt. */
|
|
|
|
|
|
|
|
char *last_search = NULL;
|
|
|
|
/* The last string we searched for. */
|
2017-05-03 10:41:24 +00:00
|
|
|
int didfind = 0;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether the last search found something. */
|
2017-05-03 10:41:24 +00:00
|
|
|
|
2020-02-02 16:05:06 +00:00
|
|
|
char *present_path = NULL;
|
|
|
|
/* The current browser directory when trying to do tab completion. */
|
|
|
|
|
|
|
|
unsigned flags[4] = {0, 0, 0, 0};
|
|
|
|
/* Our flags array, containing the states of all global options. */
|
|
|
|
|
2018-10-07 08:24:19 +00:00
|
|
|
int controlleft, controlright, controlup, controldown;
|
|
|
|
int controlhome, controlend;
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifndef NANO_TINY
|
2018-10-15 13:28:29 +00:00
|
|
|
int controldelete, controlshiftdelete;
|
2018-10-05 17:50:41 +00:00
|
|
|
int shiftleft, shiftright, shiftup, shiftdown;
|
2016-04-24 09:28:28 +00:00
|
|
|
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
2017-04-05 09:22:35 +00:00
|
|
|
int shiftcontrolhome, shiftcontrolend;
|
2017-08-11 12:23:56 +00:00
|
|
|
int altleft, altright, altup, altdown;
|
2018-12-04 01:45:18 +00:00
|
|
|
int altpageup, altpagedown;
|
|
|
|
int altinsert, altdelete;
|
2016-04-24 09:28:28 +00:00
|
|
|
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
2015-11-23 08:52:23 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 16:39:30 +00:00
|
|
|
#ifdef ENABLED_WRAPORJUSTIFY
|
2018-10-22 23:01:23 +00:00
|
|
|
ssize_t fill = -COLUMNS_FROM_EOL;
|
2018-10-17 23:01:01 +00:00
|
|
|
/* The relative column where we will wrap lines. */
|
2019-09-30 17:30:54 +00:00
|
|
|
size_t wrap_at = 0;
|
2018-10-22 23:01:23 +00:00
|
|
|
/* The actual column where we will wrap lines, based on fill. */
|
2005-12-08 07:09:08 +00:00
|
|
|
#endif
|
|
|
|
|
2017-05-18 08:16:52 +00:00
|
|
|
WINDOW *topwin = NULL;
|
2018-04-01 18:11:44 +00: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 08:16:52 +00:00
|
|
|
WINDOW *edit = NULL;
|
2018-04-01 18:11:44 +00: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 08:16:52 +00:00
|
|
|
WINDOW *bottomwin = NULL;
|
2018-04-01 18:11:44 +00:00
|
|
|
/* The bottom portion of the screen, where we display statusbar
|
2020-01-16 15:16:31 +00:00
|
|
|
* messages, the status-bar prompt, and a list of shortcuts. */
|
2005-12-08 07:09:08 +00:00
|
|
|
int editwinrows = 0;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* How many rows does the edit window take up? */
|
2018-04-01 17:53:51 +00: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. */
|
2019-03-14 18:32:10 +00:00
|
|
|
#ifndef NANO_TINY
|
2018-12-17 18:57:30 +00:00
|
|
|
ssize_t stripe_column = 0;
|
|
|
|
/* The column at which a vertical bar will be drawn. */
|
2019-03-14 18:32:10 +00:00
|
|
|
#endif
|
2005-12-08 07:09:08 +00:00
|
|
|
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *cutbuffer = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The buffer where we store cut text. */
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *cutbottom = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The last line in the cutbuffer. */
|
2018-12-30 12:36:29 +00:00
|
|
|
bool keep_cutbuffer = FALSE;
|
|
|
|
/* Whether to add to the cutbuffer instead of clearing it first. */
|
|
|
|
|
2005-07-08 19:57:25 +00:00
|
|
|
openfilestruct *openfile = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The list of all open file buffers. */
|
2019-04-22 17:45:42 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
openfilestruct *startfile = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The first open buffer. */
|
2019-04-22 17:45:42 +00:00
|
|
|
#endif
|
2001-07-11 02:08:33 +00:00
|
|
|
|
2006-01-06 21:51:10 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
char *matchbrackets = NULL;
|
2018-11-05 08:38:07 +00:00
|
|
|
/* The opening and closing brackets that bracket searches can find. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *whitespace = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The characters used when visibly showing tabs and spaces. */
|
2019-03-21 18:21:45 +00:00
|
|
|
int whitelen[2];
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The length in bytes of these characters. */
|
2004-05-29 16:47:52 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2005-12-08 07:09:08 +00:00
|
|
|
char *punct = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The closing punctuation that can end sentences. */
|
2005-12-08 07:09:08 +00:00
|
|
|
char *brackets = NULL;
|
2017-12-29 18:27:33 +00: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 18:27:33 +00: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 18:27:33 +00:00
|
|
|
/* The compiled regular expression from the quoting string. */
|
2017-10-31 16:34:07 +00:00
|
|
|
#endif
|
2004-02-28 16:24:31 +00:00
|
|
|
|
2016-06-30 16:02:45 +00:00
|
|
|
char *word_chars = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Nonalphanumeric characters that also form words. */
|
2016-06-30 16:02:45 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
ssize_t tabsize = -1;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The width of a tab in spaces. The default is set in main(). */
|
2000-08-03 22:51:21 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
char *backup_dir = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The directory where we store backup files. */
|
2005-12-08 07:09:08 +00:00
|
|
|
#endif
|
2017-10-29 20:08:07 +00:00
|
|
|
#ifdef ENABLE_OPERATINGDIR
|
2005-12-08 07:09:08 +00:00
|
|
|
char *operating_dir = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The path to our confining "operating" directory, when given. */
|
2001-09-19 03:19:43 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-31 18:32:42 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
2005-12-08 07:09:08 +00:00
|
|
|
char *alt_speller = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The command to use for the alternate spell checker. */
|
2001-04-18 04:28:54 +00:00
|
|
|
#endif
|
|
|
|
|
2017-11-01 18:45:33 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2002-12-22 16:30:00 +00:00
|
|
|
syntaxtype *syntaxes = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The global list of color syntaxes. */
|
2002-12-22 16:30:00 +00:00
|
|
|
char *syntaxstr = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The color syntax name specified on the command line. */
|
2017-11-26 17:01:02 +00:00
|
|
|
bool have_palette = FALSE;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Whether the colors for the current syntax have been initialized. */
|
2001-04-30 11:28:46 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-08 10:01:33 +00:00
|
|
|
int currmenu = MMOST;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The currently active menu, initialized to a dummy value. */
|
2019-04-03 15:34:05 +00:00
|
|
|
keystruct *sclist = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The start of the shortcuts list. */
|
2019-04-03 15:11:24 +00:00
|
|
|
funcstruct *allfuncs = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The start of the functions list. */
|
2019-04-03 15:11:24 +00:00
|
|
|
funcstruct *tailfunc;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The last function in the list. */
|
2019-04-03 15:11:24 +00:00
|
|
|
funcstruct *exitfunc;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* A pointer to the special Exit/Close item. */
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *search_history = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The current item in the list of strings that were searched for. */
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *execute_history = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The current item in the list of commands that were run with ^R ^X. */
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *replace_history = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The current item in the list of replace strings. */
|
2017-10-29 18:42:12 +00:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *searchtop = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The oldest item in the list of search strings. */
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *searchbot = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The newest item in the list of search strings. */
|
2017-09-17 15:16:36 +00:00
|
|
|
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *replacetop = NULL;
|
|
|
|
linestruct *replacebot = NULL;
|
2017-09-17 15:16:36 +00:00
|
|
|
|
2019-03-21 16:08:52 +00:00
|
|
|
linestruct *executetop = NULL;
|
|
|
|
linestruct *executebot = NULL;
|
2003-01-05 20:41:21 +00:00
|
|
|
#endif
|
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
regex_t search_regexp;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The compiled regular expression to use in searches. */
|
2005-12-08 07:09:08 +00:00
|
|
|
regmatch_t regmatches[10];
|
2017-12-29 18:27:33 +00: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 18:27:33 +00:00
|
|
|
/* The curses attribute we use to highlight something. */
|
2017-11-01 18:45:33 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2018-08-30 08:21:27 +00:00
|
|
|
colortype* color_combo[NUMBER_OF_ELEMENTS] = {NULL};
|
2018-01-15 15:07:24 +00:00
|
|
|
/* The color combinations for interface elements given in the rcfile. */
|
2014-05-03 18:24:45 +00:00
|
|
|
#endif
|
2018-08-30 08:21:27 +00:00
|
|
|
int interface_color_pair[NUMBER_OF_ELEMENTS] = {0};
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The processed color pairs for the interface elements. */
|
2003-02-03 03:32:08 +00:00
|
|
|
|
2005-12-08 07:09:08 +00:00
|
|
|
char *homedir = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The user's home directory, from $HOME or /etc/passwd. */
|
2017-10-27 21:15:06 +00:00
|
|
|
char *statedir = NULL;
|
2017-12-29 18:27:33 +00:00
|
|
|
/* The directory for nano's history files. */
|
2018-08-06 19:12:22 +00:00
|
|
|
|
2019-11-25 18:17:41 +00:00
|
|
|
#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
|
2019-10-20 12:25:22 +00:00
|
|
|
char *startup_problem = NULL;
|
|
|
|
/* An error message (if any) about nanorc files or history files. */
|
2018-08-04 08:53:34 +00:00
|
|
|
#endif
|
2020-01-14 11:41:22 +00:00
|
|
|
#ifdef ENABLE_NANORC
|
|
|
|
char *custom_nanorc = NULL;
|
|
|
|
#endif
|
2016-09-03 10:14:08 +00:00
|
|
|
|
2018-09-29 16:14:43 +00: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-07-01 18:52:21 +00:00
|
|
|
/* To make the functions and shortcuts lists clearer. */
|
2017-12-29 20:35:14 +00:00
|
|
|
#define VIEW TRUE /* Is allowed in view mode. */
|
2014-07-01 18:52:21 +00:00
|
|
|
#define NOVIEW FALSE
|
2017-12-29 20:35:14 +00:00
|
|
|
#define BLANKAFTER TRUE /* A blank line after this one. */
|
2014-07-01 18:52:21 +00:00
|
|
|
#define TOGETHER FALSE
|
2018-10-12 17:55:18 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2020-05-29 16:45:14 +00:00
|
|
|
#define CAN_OPEN_OTHER_BUFFER TRUE
|
2018-10-12 17:55:18 +00:00
|
|
|
#else
|
2020-05-29 16:45:14 +00:00
|
|
|
#define CAN_OPEN_OTHER_BUFFER FALSE
|
2018-10-12 17:55:18 +00:00
|
|
|
#endif
|
2014-07-01 18:52:21 +00:00
|
|
|
|
2018-04-01 18:11:44 +00: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 12:23:47 +00:00
|
|
|
void flip_replace(void)
|
|
|
|
{
|
|
|
|
}
|
2018-02-04 09:34:39 +00:00
|
|
|
void flip_goto(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2020-01-26 15:36:23 +00:00
|
|
|
void to_files(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2020-01-26 15:36:23 +00:00
|
|
|
void goto_dir(void)
|
2014-05-13 20:51:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
2017-05-08 10:57:15 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-02-05 10:41:31 +00:00
|
|
|
void do_nothing(void)
|
|
|
|
{
|
|
|
|
}
|
2018-04-17 08:34:57 +00: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 12:23:47 +00:00
|
|
|
void flip_execute(void)
|
2015-12-23 16:34:44 +00:00
|
|
|
{
|
|
|
|
}
|
2018-05-16 01:20:11 +00:00
|
|
|
void flip_pipe(void)
|
|
|
|
{
|
|
|
|
}
|
2018-08-19 10:35:15 +00:00
|
|
|
void flip_convert(void)
|
|
|
|
{
|
|
|
|
}
|
2017-05-08 12:23:47 +00:00
|
|
|
#endif
|
2017-05-08 11:20:07 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-05-08 12:23:47 +00:00
|
|
|
void flip_newbuffer(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2017-05-08 11:20:07 +00:00
|
|
|
#endif
|
2017-05-08 12:23:47 +00:00
|
|
|
void discard_buffer(void)
|
2011-02-07 14:45:56 +00:00
|
|
|
{
|
|
|
|
}
|
2018-04-17 08:34:57 +00:00
|
|
|
void do_cancel(void)
|
|
|
|
{
|
|
|
|
}
|
2011-02-07 14:45:56 +00:00
|
|
|
|
2019-10-03 15:19:29 +00:00
|
|
|
/* Add a function to the linked list of functions. */
|
|
|
|
void add_to_funcs(void (*func)(void), int menus, const char *desc,
|
|
|
|
const char *help, bool blank_after, bool viewok)
|
2008-03-05 07:34:01 +00:00
|
|
|
{
|
2019-04-03 15:11:24 +00:00
|
|
|
funcstruct *f = nmalloc(sizeof(funcstruct));
|
2017-12-29 18:27:33 +00:00
|
|
|
|
|
|
|
if (allfuncs == NULL)
|
|
|
|
allfuncs = f;
|
|
|
|
else
|
|
|
|
tailfunc->next = f;
|
|
|
|
tailfunc = f;
|
|
|
|
|
|
|
|
f->next = NULL;
|
2018-02-24 18:31:11 +00:00
|
|
|
f->func = func;
|
2017-12-29 18:27:33 +00:00
|
|
|
f->menus = menus;
|
|
|
|
f->desc = desc;
|
|
|
|
f->viewok = viewok;
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 18:27:33 +00:00
|
|
|
f->help = help;
|
|
|
|
f->blank_after = blank_after;
|
2008-03-05 07:34:01 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-03-19 14:08:07 +00: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)
|
|
|
|
{
|
|
|
|
if (keystring[0] == '^') {
|
|
|
|
if (keystring[2] == '\0') {
|
|
|
|
if (keystring[1] == '/')
|
|
|
|
return 31;
|
|
|
|
if (keystring[1] <= '_')
|
|
|
|
return keystring[1] - 64;
|
|
|
|
if (keystring[1] == '`')
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
} else if (strcasecmp(keystring, "^Space") == 0)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
} else if (keystring[0] == 'M') {
|
|
|
|
if (keystring[1] == '-' && keystring[3] == '\0')
|
|
|
|
return tolower((unsigned char)keystring[2]);
|
|
|
|
if (strcasecmp(keystring, "M-Space") == 0)
|
|
|
|
return (int)' ';
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
#ifdef ENABLE_NANORC
|
|
|
|
} else if (strncasecmp(keystring, "Sh-M-", 5) == 0 &&
|
|
|
|
'a' <= (keystring[5] | 0x20) && (keystring[5] | 0x20) <= 'z' &&
|
|
|
|
keystring[6] == '\0') {
|
|
|
|
shifted_metas = TRUE;
|
|
|
|
return (keystring[5] & 0x5F);
|
|
|
|
#endif
|
|
|
|
} else if (keystring[0] == 'F') {
|
|
|
|
int fn = atoi(&keystring[1]);
|
|
|
|
if (fn < 1 || fn > 24)
|
|
|
|
return -1;
|
|
|
|
return KEY_F0 + fn;
|
|
|
|
} else if (strcasecmp(keystring, "Ins") == 0)
|
|
|
|
return KEY_IC;
|
|
|
|
else if (strcasecmp(keystring, "Del") == 0)
|
|
|
|
return KEY_DC;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-03 15:19:29 +00:00
|
|
|
/* Add a key combo to the linked list of shortcuts. */
|
2016-10-15 15:55:19 +00:00
|
|
|
void add_to_sclist(int menus, const char *scstring, const int keycode,
|
2017-12-29 18:27:33 +00:00
|
|
|
void (*func)(void), int toggle)
|
2000-06-06 05:53:49 +00:00
|
|
|
{
|
2019-04-03 15:34:05 +00:00
|
|
|
static keystruct *tailsc;
|
2016-09-01 07:36:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00:00
|
|
|
static int counter = 0;
|
2016-09-01 07:36:47 +00:00
|
|
|
#endif
|
2020-02-04 16:20:37 +00:00
|
|
|
keystruct *sc = nmalloc(sizeof(keystruct));
|
2002-02-15 19:17:02 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Start the list, or tack on the next item. */
|
|
|
|
if (sclist == NULL)
|
2020-02-04 16:20:37 +00:00
|
|
|
sclist = sc;
|
2017-12-29 18:27:33 +00:00
|
|
|
else
|
2020-02-04 16:20:37 +00:00
|
|
|
tailsc->next = sc;
|
|
|
|
sc->next = NULL;
|
2014-07-27 19:13:46 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Fill in the data. */
|
2020-02-04 16:20:37 +00:00
|
|
|
sc->menus = menus;
|
|
|
|
sc->func = func;
|
2016-09-01 07:36:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-02-04 16:20:37 +00:00
|
|
|
sc->toggle = toggle;
|
2019-04-09 15:54:29 +00:00
|
|
|
/* When not the same toggle as the previous one, increment the ID. */
|
2017-12-29 18:27:33 +00:00
|
|
|
if (toggle)
|
2020-02-04 16:20:37 +00:00
|
|
|
sc->ordinal = (tailsc->toggle == toggle) ? counter : ++counter;
|
2016-09-01 07:36:47 +00:00
|
|
|
#endif
|
2020-02-04 16:20:37 +00:00
|
|
|
sc->keystr = scstring;
|
|
|
|
sc->keycode = (keycode ? keycode : keycode_from_string(scstring));
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
tailsc = sc;
|
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. */
|
2019-04-03 15:34:05 +00:00
|
|
|
const keystruct *first_sc_for(int menu, void (*func)(void))
|
2014-07-27 19:23:41 +00:00
|
|
|
{
|
2020-02-04 16:20:37 +00:00
|
|
|
for (keystruct *sc = sclist; sc != NULL; sc = sc->next)
|
|
|
|
if ((sc->menus & menu) && sc->func == func)
|
|
|
|
return sc;
|
2014-07-27 19:23:41 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
return NULL;
|
2014-07-27 19:23:41 +00:00
|
|
|
}
|
|
|
|
|
2016-12-22 11:02:11 +00:00
|
|
|
/* Return the first keycode that is bound to the given function in the
|
|
|
|
* current menu, if any; otherwise, return the given default value. */
|
|
|
|
int the_code_for(void (*func)(void), int defaultval)
|
2008-03-09 02:52:40 +00:00
|
|
|
{
|
2020-02-04 16:20:37 +00:00
|
|
|
const keystruct *sc = first_sc_for(currmenu, func);
|
2008-03-09 02:52:40 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
if (sc == NULL)
|
2017-12-29 18:27:33 +00:00
|
|
|
return defaultval;
|
2016-12-22 11:02:11 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
meta_key = (0x20 <= sc->keycode && sc->keycode <= 0x7E);
|
2020-01-22 12:22:27 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
return sc->keycode;
|
2008-03-09 02:52:40 +00:00
|
|
|
}
|
|
|
|
|
2019-09-27 17:07:25 +00:00
|
|
|
/* Return the number of entries that can be shown in the given menu. */
|
|
|
|
size_t shown_entries_for(int menu)
|
2019-09-27 16:41:22 +00:00
|
|
|
{
|
2019-09-28 09:58:25 +00:00
|
|
|
funcstruct *item = allfuncs;
|
2019-10-01 11:25:03 +00:00
|
|
|
size_t maximum = ((COLS + 40) / 20) * 2;
|
2019-09-27 16:53:44 +00:00
|
|
|
size_t count = 0;
|
2019-09-27 16:41:22 +00:00
|
|
|
|
2019-10-01 11:25:03 +00:00
|
|
|
while (count < maximum && item != NULL) {
|
2019-09-29 11:00:27 +00:00
|
|
|
if (item->menus & menu)
|
2019-09-27 16:53:44 +00:00
|
|
|
count++;
|
2019-09-28 09:58:25 +00:00
|
|
|
item = item->next;
|
|
|
|
}
|
2019-09-27 16:41:22 +00:00
|
|
|
|
2020-04-30 15:25:48 +00:00
|
|
|
/* When --saveonexit is not used, widen the grid of the WriteOut menu. */
|
2019-09-29 11:00:27 +00:00
|
|
|
if (menu == MWRITEFILE && first_sc_for(menu, discard_buffer) == NULL)
|
|
|
|
count--;
|
|
|
|
|
2019-09-28 09:58:25 +00:00
|
|
|
return count;
|
2019-09-27 16:41:22 +00:00
|
|
|
}
|
|
|
|
|
2020-01-22 12:12:52 +00:00
|
|
|
/* Return the first shortcut in the current menu that matches the given input. */
|
2020-02-04 16:31:15 +00:00
|
|
|
const keystruct *get_shortcut(int *keycode)
|
2019-09-27 15:41:17 +00:00
|
|
|
{
|
2020-01-22 15:15:30 +00:00
|
|
|
/* Plain characters and upper control codes cannot be shortcuts. */
|
2020-02-04 16:31:15 +00:00
|
|
|
if (!meta_key && 0x20 <= *keycode && *keycode <= 0xFF)
|
2020-01-22 15:15:30 +00:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* Lower control codes with Meta cannot be shortcuts either. */
|
2020-02-04 16:31:15 +00:00
|
|
|
if (meta_key && *keycode < 0x20)
|
2019-09-27 15:41:17 +00:00
|
|
|
return NULL;
|
|
|
|
|
2020-05-14 16:47:50 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-01-16 18:01:45 +00:00
|
|
|
/* During a paste at a prompt, ignore all command keycodes. */
|
2020-02-04 16:31:15 +00:00
|
|
|
if (bracketed_paste && *keycode != BRACKETED_PASTE_MARKER)
|
2020-01-12 11:32:20 +00:00
|
|
|
return NULL;
|
2020-05-14 16:47:50 +00:00
|
|
|
#endif
|
2020-01-03 23:52:21 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
for (keystruct *sc = sclist; sc != NULL; sc = sc->next) {
|
2020-02-04 16:31:15 +00:00
|
|
|
if ((sc->menus & currmenu) && *keycode == sc->keycode)
|
2020-02-04 16:20:37 +00:00
|
|
|
return sc;
|
2019-09-27 15:41:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-07-02 08:47:09 +00:00
|
|
|
/* Return a pointer to the function that is bound to the given key. */
|
2020-02-04 16:31:15 +00:00
|
|
|
functionptrtype func_from_key(int *keycode)
|
2014-07-02 08:47:09 +00:00
|
|
|
{
|
2020-02-04 16:31:15 +00:00
|
|
|
const keystruct *sc = get_shortcut(keycode);
|
2014-07-02 08:47:09 +00:00
|
|
|
|
2020-02-04 16:20:37 +00:00
|
|
|
return (sc) ? sc->func : NULL;
|
2014-07-02 08:47:09 +00:00
|
|
|
}
|
|
|
|
|
2020-01-26 14:22:22 +00:00
|
|
|
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
|
|
|
/* Return the function that is bound to the given key in the file browser or
|
|
|
|
* the help viewer. Accept also certain plain characters, for compatibility
|
|
|
|
* with Pico or to mimic 'less' and similar text viewers. */
|
|
|
|
functionptrtype interpret(int *keycode)
|
|
|
|
{
|
|
|
|
if (!meta_key) {
|
2020-01-26 14:34:50 +00:00
|
|
|
if (*keycode == 'N')
|
|
|
|
return do_findprevious;
|
|
|
|
if (*keycode == 'n')
|
|
|
|
return do_findnext;
|
|
|
|
|
|
|
|
switch (tolower(*keycode)) {
|
2020-01-26 14:22:22 +00:00
|
|
|
case '-':
|
|
|
|
return do_page_up;
|
|
|
|
case ' ':
|
|
|
|
return do_page_down;
|
|
|
|
case 'w':
|
|
|
|
case '/':
|
|
|
|
return do_search_forward;
|
2020-02-04 11:56:19 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2020-01-26 14:22:22 +00:00
|
|
|
case 'g':
|
2020-01-26 15:36:23 +00:00
|
|
|
return goto_dir;
|
2020-02-04 11:56:19 +00:00
|
|
|
#endif
|
2020-01-26 14:22:22 +00:00
|
|
|
case '?':
|
|
|
|
return do_help;
|
|
|
|
case 's':
|
|
|
|
return do_enter;
|
|
|
|
case 'e':
|
|
|
|
case 'q':
|
|
|
|
case 'x':
|
|
|
|
return do_exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return func_from_key(keycode);
|
|
|
|
}
|
|
|
|
#endif /* ENABLE_BROWSER || ENABLE_HELP */
|
|
|
|
|
2018-11-26 08:13:22 +00:00
|
|
|
/* These two tags are used elsewhere too, so they are global. */
|
|
|
|
/* TRANSLATORS: Try to keep the next two 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");
|
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 15:51:45 +00:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 18:27:33 +00: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");
|
2019-12-12 10:38:32 +00:00
|
|
|
const char *exit_gist = N_("Close the current buffer / Exit from nano");
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *writeout_gist =
|
2018-02-19 19:35:47 +00:00
|
|
|
N_("Write the current buffer (or the marked region) to disk");
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *readfile_gist =
|
2018-02-22 18:52:27 +00:00
|
|
|
N_("Insert another file into current buffer (or into new buffer)");
|
2017-12-29 18:27:33 +00: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");
|
|
|
|
const char *cut_gist =
|
2018-02-19 19:35:47 +00:00
|
|
|
N_("Cut current line (or marked region) and store it in cutbuffer");
|
2020-02-14 18:00:16 +00:00
|
|
|
const char *paste_gist =
|
2019-03-03 13:36:12 +00:00
|
|
|
N_("Paste the contents of cutbuffer at current cursor position");
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *cursorpos_gist = N_("Display the position of the cursor");
|
2017-10-31 18:32:42 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *spell_gist = N_("Invoke the spell checker, if available");
|
2014-04-03 21:06:30 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00: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 18:27:33 +00:00
|
|
|
const char *mark_gist = N_("Mark text starting from the cursor position");
|
|
|
|
const char *copy_gist =
|
2018-02-19 19:35:47 +00:00
|
|
|
N_("Copy current line (or marked region) and store it in cutbuffer");
|
2018-10-24 02:25:22 +00:00
|
|
|
const char *zap_gist = N_("Throw away the current line (or marked region)");
|
2017-12-29 18:27:33 +00: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 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 18:27:33 +00: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
|
2019-12-12 10:38:32 +00:00
|
|
|
const char *prevpage_gist = N_("Go one screenful up");
|
|
|
|
const char *nextpage_gist = N_("Go one screenful down");
|
2017-12-29 18:27:33 +00: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 18:27:33 +00:00
|
|
|
const char *bracket_gist = N_("Go to the matching bracket");
|
2018-03-31 14:50:26 +00:00
|
|
|
#endif
|
2018-10-24 15:30:27 +00:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *scrollup_gist =
|
2018-03-22 10:14:32 +00:00
|
|
|
N_("Scroll up one line without moving the cursor textually");
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *scrolldown_gist =
|
2018-03-22 10:14:32 +00:00
|
|
|
N_("Scroll down one line without moving the cursor textually");
|
2004-09-11 21:41:13 +00:00
|
|
|
#endif
|
2017-05-01 18:20:34 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 18:27:33 +00: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
|
2019-02-24 16:27:22 +00:00
|
|
|
const char *chopwordleft_gist =
|
2019-02-24 10:00:06 +00:00
|
|
|
N_("Delete backward from cursor to word start");
|
2019-02-24 16:27:22 +00:00
|
|
|
const char *chopwordright_gist =
|
2019-02-24 10:00:06 +00:00
|
|
|
N_("Delete forward from cursor to next word start");
|
2017-12-29 18:27:33 +00:00
|
|
|
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 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 18:27:33 +00: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 18:27:33 +00:00
|
|
|
const char *wordcount_gist =
|
|
|
|
N_("Count the number of words, lines, and characters");
|
2004-08-07 21:27:37 +00:00
|
|
|
#endif
|
2020-03-19 13:55:39 +00: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 12:10:40 +00:00
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *completion_gist = N_("Try and complete the current word");
|
2016-12-07 12:10:40 +00:00
|
|
|
#endif
|
2016-12-07 18:56:27 +00:00
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *comment_gist =
|
|
|
|
N_("Comment/uncomment the current line (or marked lines)");
|
2016-12-07 18:56:27 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00: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 19:27:06 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *recordmacro_gist = N_("Start/stop recording a macro");
|
|
|
|
const char *runmacro_gist = N_("Run the last recorded macro");
|
2020-04-06 15:42:29 +00:00
|
|
|
const char *anchor_gist = N_("Place or remove an anchor at the current line");
|
|
|
|
const char *prevanchor_gist = N_("Jump backward to the nearest anchor");
|
|
|
|
const char *nextanchor_gist = N_("Jump forward to the nearest anchor");
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
2019-12-12 10:38:32 +00:00
|
|
|
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 18:42:12 +00:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2020-03-19 13:55:39 +00:00
|
|
|
const char *older_gist = N_("Recall the previous search/replace string");
|
|
|
|
const char *newer_gist = 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 18:27:33 +00: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");
|
2020-05-22 12:28:42 +00:00
|
|
|
const char *execute_gist = N_("Execute a function or an external command");
|
2018-05-29 07:05:58 +00:00
|
|
|
const char *pipe_gist =
|
|
|
|
N_("Pipe the current buffer (or marked region) to the command");
|
2018-08-19 10:35:15 +00:00
|
|
|
const char *convert_gist = N_("Do not convert from DOS/Mac format");
|
2017-05-08 19:59:36 +00:00
|
|
|
#endif
|
2017-05-01 18:20:34 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *newbuffer_gist = N_("Toggle the use of a new buffer");
|
2017-04-25 18:42:05 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *discardbuffer_gist = N_("Close buffer without saving it");
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 18:27:33 +00: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");
|
2019-12-12 10:38:32 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
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
|
|
|
|
const char *browserwhereis_gist = N_("Search forward for a string");
|
|
|
|
const char *browserwherewas_gist = N_("Search backward for a string");
|
|
|
|
const char *browserrefresh_gist = N_("Refresh the file list");
|
2017-12-29 18:27:33 +00:00
|
|
|
const char *gotodir_gist = N_("Go to directory");
|
2000-06-06 05:53:49 +00:00
|
|
|
#endif
|
2017-11-01 18:45:33 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 18:27:33 +00: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");
|
2019-10-25 15:17:48 +00:00
|
|
|
const char *formatter_gist =
|
|
|
|
N_("Invoke a program to format/arrange/manipulate the buffer");
|
2019-10-09 17:42:22 +00:00
|
|
|
#endif
|
2017-04-25 15:51:45 +00:00
|
|
|
#endif /* ENABLE_HELP */
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_HELP
|
2020-05-29 16:45:14 +00:00
|
|
|
#define WITHORSANS(help) help
|
2004-03-02 22:52:57 +00:00
|
|
|
#else
|
2020-05-29 16:45:14 +00:00
|
|
|
#define WITHORSANS(help) ""
|
2002-04-23 10:56:06 +00:00
|
|
|
#endif
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Start populating the different menus with functions. */
|
2014-04-13 12:16:37 +00:00
|
|
|
|
2019-12-15 18:47:05 +00:00
|
|
|
add_to_funcs(do_help, (MMOST | MBROWSER) & ~MFINDINHELP,
|
2019-09-24 15:07:15 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next eleven strings at most 10 characters. */
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Help"), WITHORSANS(help_gist), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2019-02-06 15:27:27 +00:00
|
|
|
add_to_funcs(do_cancel, ((MMOST & ~MMAIN) | MYESNO),
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Cancel"), WITHORSANS(cancel_gist), BLANKAFTER, VIEW);
|
2008-03-05 07:34:01 +00:00
|
|
|
|
2017-12-29 18:27:33 +00: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 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_exit, MBROWSER,
|
2018-12-03 08:54:30 +00:00
|
|
|
close_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 18:27:33 +00: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 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2019-05-08 11:48:52 +00:00
|
|
|
/* In restricted mode, replace Insert with Justify, when possible;
|
|
|
|
* otherwise, show Insert anyway, to keep the help items paired. */
|
|
|
|
if (!ISSET(RESTRICTED))
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
|
|
|
add_to_funcs(do_insertfile_void, MMAIN,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Read File"), WITHORSANS(readfile_gist), BLANKAFTER,
|
2017-12-29 18:27:33 +00:00
|
|
|
/* We allow inserting files in view mode if multibuffer mode
|
2019-05-08 11:48:52 +00:00
|
|
|
* is available, so that the user can view multiple files. */
|
2018-10-12 17:55:18 +00:00
|
|
|
CAN_OPEN_OTHER_BUFFER);
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2019-05-08 11:48:52 +00:00
|
|
|
else
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Justify"), WITHORSANS(justify_gist), BLANKAFTER, NOVIEW);
|
2015-07-30 10:37:28 +00:00
|
|
|
#endif
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2018-07-30 19:03:08 +00: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 18:45:15 +00:00
|
|
|
N_("Where Is"), WITHORSANS(whereis_gist), TOGETHER, VIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_replace, MMAIN,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Replace"), WITHORSANS(replace_gist), TOGETHER, NOVIEW);
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2019-05-03 17:51:15 +00:00
|
|
|
add_to_funcs(cut_text, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Cut"), WITHORSANS(cut_gist), TOGETHER, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2019-05-03 17:47:08 +00:00
|
|
|
add_to_funcs(paste_text, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Paste"), WITHORSANS(paste_gist), BLANKAFTER, NOVIEW);
|
2000-06-06 05:53:49 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2020-05-22 12:28:42 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(do_execute, MMAIN,
|
|
|
|
N_("Execute"), WITHORSANS(execute_gist), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_justify_void, MMAIN,
|
2020-05-22 12:28:42 +00:00
|
|
|
N_("Justify"), WITHORSANS(justify_gist), BLANKAFTER, NOVIEW);
|
2015-03-27 16:55:49 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2014-02-24 10:18:15 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_cursorpos_void, MMAIN,
|
2019-09-24 15:07:15 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next thirteen strings at most 12 characters. */
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Location"), WITHORSANS(cursorpos_gist), TOGETHER, VIEW);
|
2016-09-03 11:41:02 +00:00
|
|
|
|
2020-03-13 11:14:48 +00:00
|
|
|
#if ((defined(ENABLE_JUSTIFY) && defined(ENABLE_SPELLER)) || \
|
|
|
|
(!defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER)))
|
2017-12-29 18:27:33 +00:00
|
|
|
/* 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 18:45:15 +00:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2016-09-03 11:41:02 +00:00
|
|
|
#endif
|
|
|
|
|
2017-03-23 10:31:56 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00: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 10:31:56 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_mark, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Set Mark"), WITHORSANS(mark_gist), TOGETHER, VIEW);
|
2019-05-03 17:47:08 +00:00
|
|
|
add_to_funcs(copy_text, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Copy"), WITHORSANS(copy_gist), BLANKAFTER, NOVIEW);
|
2017-03-23 10:31:56 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(case_sens_void, MWHEREIS|MREPLACE,
|
|
|
|
N_("Case Sens"), WITHORSANS(case_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(regexp_void, MWHEREIS|MREPLACE,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Reg.exp."), WITHORSANS(regexp_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
|
2020-05-24 09:53:02 +00:00
|
|
|
N_("Backwards"), WITHORSANS(reverse_gist), BLANKAFTER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(flip_replace, MWHEREIS,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Replace"), WITHORSANS(replace_gist), BLANKAFTER, VIEW);
|
2014-04-27 14:21:57 +00:00
|
|
|
|
2017-12-29 18:27:33 +00: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 17:48:02 +00: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
|
2014-04-27 19:51:03 +00:00
|
|
|
|
2018-02-04 09:34:39 +00:00
|
|
|
add_to_funcs(flip_goto, MWHEREIS,
|
2020-05-24 09:53:02 +00:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2019-02-17 09:10:10 +00:00
|
|
|
|
2018-07-24 22:11:25 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2020-01-26 15:36:23 +00:00
|
|
|
add_to_funcs(goto_dir, MBROWSER,
|
2019-09-24 15:07:15 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next seven strings at most 10 characters. */
|
2019-09-23 11:03:52 +00:00
|
|
|
N_("Go To Dir"), WITHORSANS(gotodir_gist), TOGETHER, VIEW);
|
|
|
|
|
|
|
|
add_to_funcs(total_refresh, MBROWSER,
|
|
|
|
N_("Refresh"), WITHORSANS(browserrefresh_gist), BLANKAFTER, VIEW);
|
|
|
|
|
2018-07-24 22:11:25 +00:00
|
|
|
add_to_funcs(do_search_forward, MBROWSER,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Where Is"), WITHORSANS(browserwhereis_gist), TOGETHER, VIEW);
|
2018-07-24 22:11:25 +00:00
|
|
|
add_to_funcs(do_search_backward, MBROWSER,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Where Was"), WITHORSANS(browserwherewas_gist), TOGETHER, VIEW);
|
2018-07-24 22:11:25 +00:00
|
|
|
#endif
|
2019-02-17 20:02:29 +00:00
|
|
|
|
|
|
|
#ifndef NANO_TINY
|
2019-09-23 11:03:52 +00:00
|
|
|
add_to_funcs(do_find_bracket, MMAIN,
|
|
|
|
N_("To Bracket"), WITHORSANS(bracket_gist), BLANKAFTER, VIEW);
|
|
|
|
|
2018-07-24 22:11:25 +00:00
|
|
|
add_to_funcs(do_search_backward, MMAIN|MHELP,
|
2018-07-25 19:27:06 +00:00
|
|
|
/* TRANSLATORS: This starts a backward search. */
|
|
|
|
N_("Where Was"), WITHORSANS(wherewas_gist), TOGETHER, VIEW);
|
2019-02-17 20:02:29 +00:00
|
|
|
#endif
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_funcs(do_findprevious, MMAIN|MBROWSER|MHELP,
|
2018-11-05 08:51:28 +00:00
|
|
|
/* TRANSLATORS: This refers to searching the preceding occurrence. */
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Previous"), WITHORSANS(findprev_gist), TOGETHER, VIEW);
|
2019-02-17 20:02:29 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_funcs(do_findnext, MMAIN|MBROWSER|MHELP,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Next"), WITHORSANS(findnext_gist), BLANKAFTER, VIEW);
|
2019-02-17 20:02:29 +00:00
|
|
|
#else
|
|
|
|
/* In the tiny version, arrange things a bit differently, so that
|
|
|
|
* the useful M-W and M-Q are shown in the help lines. */
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_funcs(do_findnext, MMAIN|MBROWSER|MHELP,
|
2019-02-17 20:02:29 +00:00
|
|
|
N_("Next"), WITHORSANS(findnext_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_search_backward, MMAIN|MHELP,
|
|
|
|
N_("Where Was"), WITHORSANS(wherewas_gist), BLANKAFTER, VIEW);
|
|
|
|
add_to_funcs(total_refresh, MMAIN,
|
|
|
|
N_("Refresh"), WITHORSANS(refresh_gist), BLANKAFTER, VIEW);
|
|
|
|
#endif
|
2003-08-23 21:11:06 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_left, MMAIN,
|
2018-08-29 18:05:37 +00:00
|
|
|
/* TRANSLATORS: This means move the cursor one character back. */
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Back"), WITHORSANS(back_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(do_right, MMAIN,
|
|
|
|
N_("Forward"), WITHORSANS(forward_gist), TOGETHER, VIEW);
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 18:27:33 +00: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
|
|
|
|
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_funcs(to_prev_word, MMAIN,
|
2019-09-24 15:07:15 +00:00
|
|
|
/* TRANSLATORS: Try to keep the next eighteen strings at most 12 characters. */
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Prev Word"), WITHORSANS(prevword_gist), TOGETHER, VIEW);
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_funcs(to_next_word, MMAIN,
|
2017-12-29 18:27:33 +00:00
|
|
|
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);
|
|
|
|
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_funcs(do_up, MMAIN|MBROWSER|MHELP,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Prev Line"), WITHORSANS(prevline_gist), TOGETHER, VIEW);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_funcs(do_down, MMAIN|MBROWSER|MHELP,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Next Line"), WITHORSANS(nextline_gist), TOGETHER, VIEW);
|
2018-10-24 15:30:27 +00:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2017-12-29 18:27:33 +00: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 10:31:56 +00:00
|
|
|
#endif
|
2001-10-22 03:15:31 +00:00
|
|
|
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_funcs(to_prev_block, MMAIN,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Prev Block"), WITHORSANS(prevblock_gist), TOGETHER, VIEW);
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_funcs(to_next_block, MMAIN,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Next Block"), WITHORSANS(nextblock_gist), TOGETHER, VIEW);
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-03-11 18:47:21 +00:00
|
|
|
add_to_funcs(to_para_begin, MMAIN|MGOTOLINE,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Begin of Paragr."), WITHORSANS(parabegin_gist), TOGETHER, VIEW);
|
2020-03-11 18:47:21 +00:00
|
|
|
add_to_funcs(to_para_end, MMAIN|MGOTOLINE,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("End of Paragraph"), 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 18:27:33 +00:00
|
|
|
add_to_funcs(do_page_up, MMAIN|MHELP,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Prev Page"), WITHORSANS(prevpage_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_page_down, MMAIN|MHELP,
|
2018-08-28 19:39:01 +00:00
|
|
|
N_("Next Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
2017-03-23 10:31:56 +00:00
|
|
|
|
2019-02-12 18:01:35 +00:00
|
|
|
add_to_funcs(to_first_line, MMAIN|MHELP|MGOTOLINE,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("First Line"), WITHORSANS(firstline_gist), TOGETHER, VIEW);
|
2019-02-12 18:01:35 +00:00
|
|
|
add_to_funcs(to_last_line, MMAIN|MHELP|MGOTOLINE,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Last Line"), WITHORSANS(lastline_gist), BLANKAFTER, VIEW);
|
2003-11-28 19:47:42 +00:00
|
|
|
|
2017-05-01 18:20:34 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 18:27:33 +00: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
|
|
|
|
|
2020-03-13 11:14:48 +00:00
|
|
|
#if ((!defined(ENABLE_JUSTIFY) && defined(ENABLE_SPELLER)) || \
|
|
|
|
(defined(ENABLE_JUSTIFY) && !defined(ENABLE_SPELLER)))
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_gotolinecolumn_void, MMAIN,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Go To Line"), WITHORSANS(gotoline_gist), BLANKAFTER, VIEW);
|
2014-05-27 12:17:49 +00:00
|
|
|
#endif
|
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_tab, MMAIN,
|
2019-06-19 17:14:47 +00:00
|
|
|
/* TRANSLATORS: The next four strings are names of keyboard keys. */
|
2017-12-29 18:27:33 +00:00
|
|
|
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 18:27:33 +00:00
|
|
|
add_to_funcs(do_backspace, MMAIN,
|
2018-11-07 19:48:04 +00:00
|
|
|
N_("Backspace"), WITHORSANS(backspace_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(do_delete, MMAIN,
|
|
|
|
N_("Delete"), WITHORSANS(delete_gist),
|
2006-04-22 20:00:23 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00:00
|
|
|
TOGETHER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#else
|
2017-12-29 18:27:33 +00:00
|
|
|
BLANKAFTER,
|
2006-04-22 20:00:23 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
NOVIEW);
|
2008-03-12 04:44:14 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2019-02-24 16:27:22 +00:00
|
|
|
add_to_funcs(chop_previous_word, MMAIN,
|
2019-02-24 15:29:49 +00:00
|
|
|
/* TRANSLATORS: The next two strings refer to deleting words. */
|
2019-02-24 16:27:22 +00:00
|
|
|
N_("Chop Left"), WITHORSANS(chopwordleft_gist), TOGETHER, NOVIEW);
|
|
|
|
add_to_funcs(chop_next_word, MMAIN,
|
|
|
|
N_("Chop Right"), WITHORSANS(chopwordright_gist), TOGETHER, NOVIEW);
|
2019-05-03 17:51:15 +00:00
|
|
|
add_to_funcs(cut_till_eof, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Cut Till End"), 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 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_full_justify, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Full Justify"), 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 18:27:33 +00: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 18:27:33 +00:00
|
|
|
add_to_funcs(do_verbatim_input, MMAIN,
|
|
|
|
N_("Verbatim"), WITHORSANS(verbatim_gist), BLANKAFTER, NOVIEW);
|
2017-04-11 11:15:00 +00:00
|
|
|
|
2019-02-17 20:02:29 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(total_refresh, MMAIN,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Refresh"), WITHORSANS(refresh_gist), TOGETHER, VIEW);
|
2019-02-17 20:02:29 +00:00
|
|
|
#endif
|
2008-03-13 08:23:52 +00:00
|
|
|
|
2017-12-29 18:27:33 +00: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 10:31:56 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_indent, MMAIN,
|
2018-08-29 18:17:41 +00:00
|
|
|
N_("Indent"), WITHORSANS(indent_gist), TOGETHER, NOVIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_unindent, MMAIN,
|
2018-08-29 18:17:41 +00:00
|
|
|
N_("Unindent"), WITHORSANS(unindent_gist), BLANKAFTER, NOVIEW);
|
2017-03-23 10:31:56 +00:00
|
|
|
#endif
|
2016-05-25 20:13:50 +00:00
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_comment, MMAIN,
|
|
|
|
N_("Comment Lines"), WITHORSANS(comment_gist), TOGETHER, NOVIEW);
|
2017-12-26 20:36:29 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(complete_a_word, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Complete Word"), WITHORSANS(completion_gist), BLANKAFTER, NOVIEW);
|
2016-05-25 20:13:50 +00:00
|
|
|
#endif
|
2015-07-25 19:25:50 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00: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 19:27:06 +00:00
|
|
|
|
2020-04-06 15:42:29 +00:00
|
|
|
add_to_funcs(put_or_lift_anchor, MMAIN,
|
|
|
|
N_("Anchor"), WITHORSANS(anchor_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(to_prev_anchor, MMAIN,
|
|
|
|
N_("Up to anchor"), WITHORSANS(prevanchor_gist), TOGETHER, VIEW);
|
|
|
|
add_to_funcs(to_next_anchor, MMAIN,
|
|
|
|
N_("Down to anchor"), WITHORSANS(nextanchor_gist), BLANKAFTER, VIEW);
|
new feature: bindable functions for toggling and jumping to "bookmarks"
With the 'bookmark' function, the user can place a bookmark on any
line in the buffer. Multiple lines can be bookmarked in this way.
With 'prevbookmark' and 'nextbookmark', the user can then easily
return to the bookmarked lines. The search for a bookmark wraps
around, as if start and end of buffer are connected.
[However, in this implementation, when a bookmarked line is deleted,
the bookmark is deleted too. This is undesirable. Also, when such
a deleted line is pasted elsewhere, the bookmark reappears with it,
and when pasted multiple times, the bookmark will be there as many
times. This is thoroughly undesirable. These behaviors will be
changed in a later commit.]
A bookmark is not yet visible in any way.
This fulfills https://savannah.gnu.org/bugs/?57577.
Requested-by: Ken Tyler <kent@werple.net.au>
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-11-12 20:30:47 +00:00
|
|
|
|
2018-10-24 02:25:22 +00:00
|
|
|
add_to_funcs(zap_text, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Zap"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
|
2018-10-24 02:25:22 +00:00
|
|
|
|
2019-10-09 17:42:22 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2020-05-22 12:28:42 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
|
|
|
add_to_funcs(do_spell, MMAIN,
|
|
|
|
N_("Spell Check"), WITHORSANS(spell_gist), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COLOR
|
2018-09-30 11:57:33 +00:00
|
|
|
add_to_funcs(do_linter, MMAIN,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
|
2019-10-25 15:17:48 +00:00
|
|
|
add_to_funcs(do_formatter, MMAIN,
|
|
|
|
N_("Formatter"), WITHORSANS(formatter_gist), BLANKAFTER, NOVIEW);
|
2019-10-09 17:42:22 +00:00
|
|
|
}
|
2019-02-17 20:02:29 +00:00
|
|
|
#endif
|
2020-05-24 10:03:05 +00:00
|
|
|
#endif /* NANO_TINY */
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_savefile, MMAIN,
|
|
|
|
N_("Save"), WITHORSANS(savefile_gist), BLANKAFTER, NOVIEW);
|
2016-05-14 10:29:51 +00:00
|
|
|
|
2020-05-28 10:24:29 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
|
|
|
/* Multiple buffers are only available when not in restricted mode. */
|
|
|
|
if (!ISSET(RESTRICTED))
|
|
|
|
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXECUTE,
|
|
|
|
N_("New Buffer"), WITHORSANS(newbuffer_gist), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_funcs(flip_pipe, MEXECUTE,
|
|
|
|
N_("Pipe Text"), WITHORSANS(pipe_gist), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
2020-05-22 09:46:30 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
|
|
|
add_to_funcs(do_spell, MEXECUTE,
|
|
|
|
N_("Spell Check"), WITHORSANS(spell_gist), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_funcs(do_linter, MEXECUTE,
|
|
|
|
N_("Linter"), WITHORSANS(lint_gist), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-05-29 17:02:26 +00:00
|
|
|
add_to_funcs(do_full_justify, MEXECUTE,
|
2020-05-22 09:46:30 +00:00
|
|
|
N_("Full Justify"), WITHORSANS(fulljustify_gist), TOGETHER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_funcs(do_formatter, MEXECUTE,
|
|
|
|
N_("Formatter"), WITHORSANS(formatter_gist), BLANKAFTER, NOVIEW);
|
|
|
|
#endif
|
|
|
|
|
2018-02-04 09:34:39 +00:00
|
|
|
add_to_funcs(flip_goto, MGOTOLINE,
|
2017-12-29 18:27:33 +00: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 18:27:33 +00: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);
|
|
|
|
}
|
2020-05-28 10:24:29 +00:00
|
|
|
|
2018-08-19 11:29:43 +00:00
|
|
|
add_to_funcs(flip_convert, MINSERTFILE,
|
2020-05-24 09:53:02 +00:00
|
|
|
N_("No Conversion"), WITHORSANS(convert_gist), BLANKAFTER, NOVIEW);
|
2018-08-19 11:29:43 +00:00
|
|
|
|
|
|
|
/* Command execution is only available when not in restricted mode. */
|
2019-03-31 18:05:30 +00:00
|
|
|
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE)) {
|
2018-08-19 11:29:43 +00:00
|
|
|
add_to_funcs(flip_execute, MINSERTFILE,
|
2020-05-24 09:53:02 +00:00
|
|
|
N_("Execute Command"), WITHORSANS(execute_gist), BLANKAFTER, NOVIEW);
|
2018-08-19 11:29:43 +00:00
|
|
|
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_funcs(cut_till_eof, MEXECUTE,
|
|
|
|
N_("Cut Till End"), WITHORSANS(cuttilleof_gist), BLANKAFTER, NOVIEW);
|
2020-05-28 10:09:56 +00:00
|
|
|
|
|
|
|
add_to_funcs(do_suspend_void, MEXECUTE,
|
|
|
|
N_("Suspend"), WITHORSANS(suspend_gist), BLANKAFTER, VIEW);
|
2018-08-19 11:29:43 +00:00
|
|
|
}
|
2020-05-28 10:24:29 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2018-03-22 18:54:20 +00:00
|
|
|
/* The file browser is only available when not in restricted mode. */
|
2017-12-29 18:27:33 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2020-01-26 15:36:23 +00:00
|
|
|
add_to_funcs(to_files, MWRITEFILE|MINSERTFILE,
|
2020-05-24 09:53:02 +00:00
|
|
|
N_("Browse"), WITHORSANS(tofiles_gist), BLANKAFTER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
|
|
|
|
add_to_funcs(do_page_up, MBROWSER,
|
2018-07-30 18:45:15 +00:00
|
|
|
N_("Prev Page"), WITHORSANS(prevpage_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_page_down, MBROWSER,
|
2018-10-09 19:54:54 +00:00
|
|
|
N_("Next Page"), WITHORSANS(nextpage_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00: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 10:48:47 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_funcs(to_prev_word, MBROWSER,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Left Column"), WITHORSANS(browserlefthand_gist), TOGETHER, VIEW);
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_funcs(to_next_word, MBROWSER,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Right Column"), WITHORSANS(browserrighthand_gist), TOGETHER, VIEW);
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_funcs(to_prev_block, MBROWSER,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Top Row"), WITHORSANS(browsertoprow_gist), TOGETHER, VIEW);
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_funcs(to_next_block, MBROWSER,
|
2017-12-29 18:27:33 +00:00
|
|
|
N_("Bottom Row"), WITHORSANS(browserbottomrow_gist), BLANKAFTER, VIEW);
|
2016-05-02 07:34:23 +00:00
|
|
|
#endif
|
2017-08-19 16:11:59 +00:00
|
|
|
#endif /* ENABLE_BROWSER */
|
|
|
|
|
2017-12-29 18:27:33 +00: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 18:45:33 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_page_up, MLINTER,
|
2019-09-24 15:07:15 +00:00
|
|
|
/* TRANSLATORS: The next two strings may be up to 37 characters each. */
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Previous Linter message"), WITHORSANS(prevlint_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_funcs(do_page_down, MLINTER,
|
2020-04-16 17:21:54 +00:00
|
|
|
N_("Next Linter message"), WITHORSANS(nextlint_gist), TOGETHER, VIEW);
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Link key combos to functions in certain menus. */
|
2020-03-19 13:55:39 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER, "^M", '\r', do_enter, 0);
|
2018-11-07 18:48:33 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER, "Enter", KEY_ENTER, do_enter, 0);
|
2020-03-19 13:27:57 +00:00
|
|
|
add_to_sclist(MMOST, "^H", '\b', do_backspace, 0);
|
2018-11-07 18:48:33 +00:00
|
|
|
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
|
|
|
add_to_sclist(MMOST, "Sh-Del", SHIFT_DELETE, do_backspace, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMOST, "Del", KEY_DC, do_delete, 0);
|
2020-03-19 13:55:39 +00:00
|
|
|
add_to_sclist(MMOST, "^I", '\t', do_tab, 0);
|
2020-03-19 13:27:57 +00:00
|
|
|
add_to_sclist(MMOST, "Tab", '\t', do_tab, 0);
|
2019-12-15 18:47:05 +00:00
|
|
|
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help, 0);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^X", 0, do_exit, 0);
|
2018-12-03 08:44:03 +00:00
|
|
|
if (!ISSET(PRESERVE))
|
|
|
|
add_to_sclist(MMAIN, "^S", 0, do_savefile, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
|
|
|
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMAIN, "Ins", KEY_IC, do_insertfile_void, 0);
|
2018-12-03 08:44:03 +00:00
|
|
|
if (!ISSET(PRESERVE))
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^Q", 0, do_search_backward, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^W", 0, do_search_forward, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
2019-05-03 17:51:15 +00:00
|
|
|
add_to_sclist(MMOST, "^K", 0, cut_text, 0);
|
2019-05-03 17:47:08 +00:00
|
|
|
add_to_sclist(MMOST, "^U", 0, paste_text, 0);
|
2020-05-22 12:28:42 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
add_to_sclist(MMAIN, "^T", 0, do_execute, 0);
|
|
|
|
#endif
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-03-19 13:55:39 +00:00
|
|
|
add_to_sclist(MMAIN, "^J", '\n', do_justify_void, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2017-10-31 18:32:42 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^S", 0, do_spell, 0);
|
2020-05-22 12:28:42 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^T", 0, do_spell, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
2018-09-23 14:15:55 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^L", 0, do_linter, 0);
|
2019-10-25 15:17:48 +00:00
|
|
|
add_to_sclist(MMAIN, "M-F", 0, do_formatter, 0);
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^O", 0, do_formatter, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
2018-03-01 08:44:38 +00:00
|
|
|
add_to_sclist(MMAIN, "^_", 0, do_gotolinecolumn_void, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-G", 0, do_gotolinecolumn_void, 0);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "^Y", 0, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "^V", 0, do_page_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
2020-01-21 14:47:03 +00:00
|
|
|
add_to_sclist(MBROWSER|MHELP, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
|
|
|
add_to_sclist(MBROWSER|MHELP, "Sh-Del", SHIFT_DELETE, do_page_up, 0);
|
|
|
|
add_to_sclist(MBROWSER|MHELP, "Space", 0x20, do_page_down, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
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);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "M-W", 0, do_findnext, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "M-Q", 0, do_findprevious, 0);
|
2016-09-08 19:00:51 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00: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);
|
2019-05-03 17:47:08 +00:00
|
|
|
add_to_sclist(MMAIN, "M-6", 0, copy_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-^", 0, copy_text, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-}", 0, do_indent, 0);
|
2019-09-28 10:24:54 +00:00
|
|
|
add_to_sclist(MMAIN, "Tab", INDENT_KEY, do_indent, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
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);
|
2019-02-24 16:27:22 +00:00
|
|
|
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
|
|
|
|
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, chop_next_word, 0);
|
2018-10-24 09:17:28 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
|
2020-04-06 15:42:29 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Ins", ALT_INSERT, put_or_lift_anchor, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-PgUp", ALT_PAGEUP, to_prev_anchor, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-PgDn", ALT_PAGEDOWN, to_next_anchor, 0);
|
2016-12-07 12:10:40 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_WORDCOMPLETION
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
|
2016-05-25 20:13:50 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_COMMENT
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
2014-06-28 14:42:18 +00:00
|
|
|
#endif
|
2018-11-07 18:48:33 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER, "^B", 0, do_left, 0);
|
|
|
|
add_to_sclist(MMOST|MBROWSER, "^F", 0, do_right, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 18:27:33 +00:00
|
|
|
if (using_utf8()) {
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER|MHELP, "\xE2\x97\x80", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST|MBROWSER|MHELP, "\xE2\x96\xb6", KEY_RIGHT, do_right, 0);
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_sclist(MSOME, "^\xE2\x97\x80", CONTROL_LEFT, to_prev_word, 0);
|
|
|
|
add_to_sclist(MSOME, "^\xE2\x96\xb6", CONTROL_RIGHT, to_next_word, 0);
|
2019-05-13 10:07:32 +00:00
|
|
|
#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER)
|
2019-05-13 10:50:31 +00:00
|
|
|
if (!on_a_vt) {
|
|
|
|
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);
|
|
|
|
}
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER|MHELP, "Left", KEY_LEFT, do_left, 0);
|
|
|
|
add_to_sclist(MMOST|MBROWSER|MHELP, "Right", KEY_RIGHT, do_right, 0);
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, to_prev_word, 0);
|
|
|
|
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, to_next_word, 0);
|
2019-05-13 09:21:07 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2019-05-13 10:50:31 +00:00
|
|
|
if (!on_a_vt) {
|
|
|
|
add_to_sclist(MMAIN, "M-Left", ALT_LEFT, switch_to_prev_buffer, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-Right", ALT_RIGHT, switch_to_next_buffer, 0);
|
|
|
|
}
|
2019-05-13 09:21:07 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2018-12-10 10:09:36 +00:00
|
|
|
#ifdef NANO_TINY
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_sclist(MMAIN, "M-B", 0, to_prev_word, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-D", 0, to_prev_word, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-F", 0, to_next_word, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-N", 0, to_next_word, 0);
|
2018-12-10 10:09:36 +00:00
|
|
|
#endif
|
2020-03-11 18:43:03 +00:00
|
|
|
add_to_sclist(MMOST, "M-Space", 0, to_prev_word, 0);
|
|
|
|
add_to_sclist(MMOST, "^Space", 0, to_next_word, 0);
|
2018-11-07 18:48:33 +00:00
|
|
|
add_to_sclist(MMOST, "^A", 0, do_home, 0);
|
|
|
|
add_to_sclist(MMOST, "Home", KEY_HOME, do_home, 0);
|
|
|
|
add_to_sclist(MMOST, "^E", 0, do_end, 0);
|
|
|
|
add_to_sclist(MMOST, "End", KEY_END, do_end, 0);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^P", 0, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^N", 0, do_down, 0);
|
2016-10-29 08:19:28 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 18:27:33 +00:00
|
|
|
if (using_utf8()) {
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "\xE2\x96\xb2", KEY_UP, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "\xE2\x96\xbc", KEY_DOWN, do_down, 0);
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xb2", CONTROL_UP, to_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^\xE2\x96\xbc", CONTROL_DOWN, to_next_block, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "Up", KEY_UP, do_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "Down", KEY_DOWN, do_down, 0);
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Up", CONTROL_UP, to_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MLINTER, "^Down", CONTROL_DOWN, to_next_block, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2020-03-11 18:45:06 +00:00
|
|
|
add_to_sclist(MMAIN, "M-7", 0, to_prev_block, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-8", 0, to_next_block, 0);
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-03-11 18:47:21 +00:00
|
|
|
add_to_sclist(MMAIN, "M-(", 0, to_para_begin, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-9", 0, to_para_begin, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-)", 0, to_para_end, 0);
|
|
|
|
add_to_sclist(MMAIN, "M-0", 0, to_para_end, 0);
|
2014-03-17 12:15:23 +00:00
|
|
|
#endif
|
2019-05-13 09:21:07 +00:00
|
|
|
#ifndef NANO_TINY
|
|
|
|
#ifdef ENABLE_UTF8
|
2018-12-16 08:34:08 +00:00
|
|
|
if (using_utf8()) {
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-\xE2\x96\xb2", ALT_UP, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-\xE2\x96\xbc", ALT_DOWN, do_scroll_down, 0);
|
2019-05-13 09:21:07 +00:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-Up", ALT_UP, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-Down", ALT_DOWN, do_scroll_down, 0);
|
2018-12-16 08:34:08 +00:00
|
|
|
}
|
|
|
|
#endif
|
2019-02-24 10:23:48 +00:00
|
|
|
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
2018-12-17 16:05:56 +00:00
|
|
|
add_to_sclist(MMAIN|MHELP, "M--", 0, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-_", 0, do_scroll_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-+", 0, do_scroll_down, 0);
|
|
|
|
add_to_sclist(MMAIN|MHELP, "M-=", 0, do_scroll_down, 0);
|
2006-03-30 07:03:04 +00:00
|
|
|
#endif
|
2017-05-01 18:20:34 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2017-12-29 18:27:33 +00: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 18:27:33 +00:00
|
|
|
add_to_sclist(MMOST, "M-V", 0, do_verbatim_input, 0);
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2019-05-03 17:51:15 +00:00
|
|
|
add_to_sclist(MMAIN, "M-T", 0, cut_till_eof, 0);
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^V", 0, cut_till_eof, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-D", 0, do_wordlinechar_count, 0);
|
2014-04-07 09:44:52 +00:00
|
|
|
#endif
|
2017-10-31 16:34:07 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-05-22 09:46:30 +00:00
|
|
|
add_to_sclist(MEXECUTE, "^J", 0, do_full_justify, 0);
|
2011-02-07 14:45:56 +00:00
|
|
|
#endif
|
2018-12-03 08:44:03 +00:00
|
|
|
if (!ISSET(PRESERVE))
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^L", 0, total_refresh, 0);
|
2018-12-03 08:44:03 +00:00
|
|
|
else
|
|
|
|
add_to_sclist(MMAIN|MBROWSER, "^L", 0, total_refresh, 0);
|
2020-05-28 10:09:56 +00:00
|
|
|
add_to_sclist(MMAIN|MEXECUTE, "^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 18:27:33 +00: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);
|
2019-04-05 07:28:09 +00:00
|
|
|
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SOFTWRAP);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
|
2016-10-20 08:44:29 +00:00
|
|
|
#ifdef ENABLE_LINENUMBERS
|
2019-04-05 07:28:09 +00:00
|
|
|
add_to_sclist(MMAIN, "M-N", 0, do_toggle_void, LINE_NUMBERS);
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
|
2016-10-20 08:44:29 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-P", 0, do_toggle_void, WHITESPACE_DISPLAY);
|
2017-11-01 18:45:33 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
2020-05-01 11:25:15 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Y", 0, do_toggle_void, NO_SYNTAX);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2017-12-29 18:27:33 +00: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 20:00:09 +00:00
|
|
|
#ifdef ENABLE_WRAPPING
|
2019-01-29 19:03:59 +00:00
|
|
|
add_to_sclist(MMAIN, "M-L", 0, do_toggle_void, BREAK_LONG_LINES);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2018-07-13 11:57:06 +00: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 18:27:33 +00:00
|
|
|
/* Group of "Peripheral-feature" toggles. */
|
2017-05-01 18:45:07 +00:00
|
|
|
#ifdef ENABLE_MOUSE
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MMAIN, "M-M", 0, do_toggle_void, USE_MOUSE);
|
2014-05-09 12:20:20 +00:00
|
|
|
#endif
|
2020-03-13 15:17:10 +00:00
|
|
|
add_to_sclist(MMAIN, "M-Z", 0, do_toggle_void, SUSPENDABLE);
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|
2014-03-17 12:15:23 +00:00
|
|
|
|
2018-11-07 18:48:33 +00:00
|
|
|
add_to_sclist(((MMOST & ~MMAIN) | MYESNO), "^C", 0, do_cancel, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
|
2018-02-04 09:34:39 +00:00
|
|
|
add_to_sclist(MWHEREIS|MGOTOLINE, "^T", 0, flip_goto, 0);
|
2017-10-29 18:42:12 +00:00
|
|
|
#ifdef ENABLE_HISTORIES
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^P", 0, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "^N", 0, get_history_newer_void, 0);
|
2017-04-09 21:30:38 +00:00
|
|
|
#ifdef ENABLE_UTF8
|
2017-12-29 18:27:33 +00:00
|
|
|
if (using_utf8()) {
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xb2", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "\xE2\x96\xbc", KEY_DOWN, get_history_newer_void, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
} else
|
2017-04-09 21:30:38 +00:00
|
|
|
#endif
|
2017-12-29 18:27:33 +00:00
|
|
|
{
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Up", KEY_UP, get_history_older_void, 0);
|
|
|
|
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP|MEXECUTE, "Down", KEY_DOWN, get_history_newer_void, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2019-02-12 18:18:11 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-03-11 18:47:21 +00:00
|
|
|
add_to_sclist(MGOTOLINE, "^W", 0, to_para_begin, 0);
|
|
|
|
add_to_sclist(MGOTOLINE, "^O", 0, to_para_end, 0);
|
2014-05-03 19:19:31 +00:00
|
|
|
#endif
|
2019-02-12 18:01:35 +00:00
|
|
|
add_to_sclist(MGOTOLINE, "^Y", 0, to_first_line, 0);
|
|
|
|
add_to_sclist(MGOTOLINE, "^V", 0, to_last_line, 0);
|
2019-03-31 11:23:25 +00:00
|
|
|
/* Some people are used to having these keystrokes in the Search menu. */
|
|
|
|
add_to_sclist(MWHEREIS, "^Y", 0, to_first_line, 0);
|
|
|
|
add_to_sclist(MWHEREIS, "^V", 0, to_last_line, 0);
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 18:27:33 +00: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);
|
2020-01-26 15:36:23 +00:00
|
|
|
add_to_sclist(MBROWSER, "^_", 0, goto_dir, 0);
|
|
|
|
add_to_sclist(MBROWSER, "M-G", 0, goto_dir, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
#endif
|
2020-04-30 15:25:48 +00:00
|
|
|
if (ISSET(SAVE_ON_EXIT) && !ISSET(PRESERVE))
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
|
2017-04-19 11:24:41 +00:00
|
|
|
#ifndef NANO_TINY
|
2017-12-29 18:27:33 +00: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 18:54:20 +00:00
|
|
|
/* Only when not in restricted mode, allow Appending, Prepending,
|
|
|
|
* making backups, and executing a command. */
|
2019-03-31 18:05:30 +00:00
|
|
|
if (!ISSET(RESTRICTED) && !ISSET(VIEW_MODE)) {
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
|
|
|
|
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MINSERTFILE|MEXECUTE, "^X", 0, flip_execute, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2018-08-19 10:35:15 +00:00
|
|
|
add_to_sclist(MINSERTFILE, "M-N", 0, flip_convert, 0);
|
2017-04-19 11:24:41 +00:00
|
|
|
#endif
|
2017-05-08 11:20:07 +00:00
|
|
|
#ifdef ENABLE_MULTIBUFFER
|
2018-03-22 18:54:20 +00:00
|
|
|
/* Only when not in restricted mode, allow multiple buffers. */
|
2018-05-16 01:20:11 +00:00
|
|
|
if (!ISSET(RESTRICTED)) {
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MINSERTFILE|MEXECUTE, "M-F", 0, flip_newbuffer, 0);
|
2018-05-28 09:31:30 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-05-22 08:04:33 +00:00
|
|
|
add_to_sclist(MEXECUTE, "M-\\", 0, flip_pipe, 0);
|
2018-05-28 09:31:30 +00:00
|
|
|
#endif
|
2018-05-16 01:20:11 +00:00
|
|
|
}
|
2017-05-08 11:20:07 +00:00
|
|
|
#endif
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2018-03-22 18:54:20 +00:00
|
|
|
/* Only when not in restricted mode, allow entering the file browser. */
|
2017-12-29 18:27:33 +00:00
|
|
|
if (!ISSET(RESTRICTED))
|
2020-01-26 15:36:23 +00:00
|
|
|
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files, 0);
|
2017-04-19 11:24:41 +00:00
|
|
|
#endif
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MBROWSER|MHELP, "^C", 0, do_exit, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
/* Allow exiting from the file browser and the help viewer with
|
|
|
|
* the same key as they were entered. */
|
2017-05-08 17:08:23 +00:00
|
|
|
#ifdef ENABLE_BROWSER
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
2015-11-08 19:40:13 +00:00
|
|
|
#endif
|
2017-04-25 15:51:45 +00:00
|
|
|
#ifdef ENABLE_HELP
|
2017-12-29 18:27:33 +00:00
|
|
|
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MHELP, "F1", KEY_F(1), do_exit, 0);
|
2017-12-29 18:27:33 +00:00
|
|
|
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 15:55:19 +00:00
|
|
|
#endif
|
2018-09-24 19:29:44 +00:00
|
|
|
#ifdef ENABLE_COLOR
|
|
|
|
add_to_sclist(MLINTER, "^X", 0, do_cancel, 0);
|
|
|
|
#endif
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMOST & ~MFINDINHELP, "F1", KEY_F(1), do_help, 0);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "F2", KEY_F(2), do_exit, 0);
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMAIN, "F3", KEY_F(3), do_writeout_void, 0);
|
2018-10-07 12:42:42 +00:00
|
|
|
#ifdef ENABLE_JUSTIFY
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMAIN, "F4", KEY_F(4), do_justify_void, 0);
|
|
|
|
#endif
|
|
|
|
add_to_sclist(MMAIN, "F5", KEY_F(5), do_insertfile_void, 0);
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "F6", KEY_F(6), do_search_forward, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "F7", KEY_F(7), do_page_up, 0);
|
|
|
|
add_to_sclist(MMAIN|MBROWSER|MHELP|MLINTER, "F8", KEY_F(8), do_page_down, 0);
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMOST, "F9", KEY_F(9), cut_text, 0);
|
|
|
|
add_to_sclist(MMOST, "F10", KEY_F(10), paste_text, 0);
|
|
|
|
add_to_sclist(MMAIN, "F11", KEY_F(11), do_cursorpos_void, 0);
|
2018-10-07 12:42:42 +00:00
|
|
|
#ifdef ENABLE_SPELLER
|
2020-01-21 14:40:28 +00:00
|
|
|
add_to_sclist(MMAIN, "F12", KEY_F(12), do_spell, 0);
|
2018-10-07 12:42:42 +00:00
|
|
|
#endif
|
2020-01-22 11:55:32 +00:00
|
|
|
#ifndef NANO_TINY
|
2020-01-03 23:52:21 +00:00
|
|
|
/* Catch and ignore bracketed paste marker keys. */
|
2020-02-04 10:41:05 +00:00
|
|
|
add_to_sclist(MMOST|MBROWSER|MHELP|MYESNO, "", BRACKETED_PASTE_MARKER, do_nothing, 0);
|
2020-01-22 11:55:32 +00:00
|
|
|
#endif
|
2002-04-23 10:56:06 +00:00
|
|
|
}
|
2002-02-27 04:14:16 +00:00
|
|
|
|
2008-03-05 07:34:01 +00:00
|
|
|
#ifndef NANO_TINY
|
2018-04-01 18:11:44 +00: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 18:27:33 +00:00
|
|
|
switch (flag) {
|
|
|
|
case NO_HELP:
|
2019-09-29 13:08:57 +00:00
|
|
|
/* TRANSLATORS: The next thirteen strings are toggle descriptions;
|
2017-12-29 18:27:33 +00: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 SOFTWRAP:
|
|
|
|
return N_("Soft wrapping of overlong lines");
|
|
|
|
case WHITESPACE_DISPLAY:
|
|
|
|
return N_("Whitespace display");
|
2020-05-01 11:25:15 +00:00
|
|
|
case NO_SYNTAX:
|
2017-12-29 18:27:33 +00:00
|
|
|
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");
|
2019-01-29 19:03:59 +00:00
|
|
|
case BREAK_LONG_LINES:
|
2017-12-29 18:27:33 +00:00
|
|
|
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");
|
2020-03-13 15:17:10 +00:00
|
|
|
case SUSPENDABLE:
|
2017-12-29 18:27:33 +00:00
|
|
|
return N_("Suspension");
|
|
|
|
case LINE_NUMBERS:
|
|
|
|
return N_("Line numbering");
|
|
|
|
default:
|
2020-02-28 18:15:23 +00:00
|
|
|
die("Bad toggle -- please report a bug\n");
|
|
|
|
return "";
|
2017-12-29 18:27:33 +00:00
|
|
|
}
|
2008-03-05 07:34:01 +00:00
|
|
|
}
|
2014-03-17 14:15:57 +00:00
|
|
|
#endif /* !NANO_TINY */
|