mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-26 04:16:55 +03:00
Carl Drinkwater's titlebar spacing fixes, David Benbennick's help browser
fixes, and my regexp searching bug fix git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1223 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
834913c8b1
commit
c5967551f6
23
ChangeLog
23
ChangeLog
@ -5,12 +5,17 @@ CVS Code -
|
|||||||
Removed intl/ entirely, and a few more tweaks by gettextize.
|
Removed intl/ entirely, and a few more tweaks by gettextize.
|
||||||
- i18nized a few strings used in DEBUG mode. (DLR)
|
- i18nized a few strings used in DEBUG mode. (DLR)
|
||||||
- Some chars being assigned 0 are now assigned '\0'. (DLR)
|
- Some chars being assigned 0 are now assigned '\0'. (DLR)
|
||||||
- Put header files in a more consistent order. (DLR)
|
- Put header file #includes in a more consistent order. (DLR)
|
||||||
- Remove some unneeded blank lines and spaces, and make some
|
- Remove some unneeded blank lines and spaces, and make some
|
||||||
spacing more consistent. (DLR)
|
spacing more consistent. (DLR)
|
||||||
- When possible, use iscntrl() to determine whether a character
|
- When possible, use iscntrl() to determine whether a character
|
||||||
is a control character or not. (DLR)
|
is a control character or not. (DLR)
|
||||||
- Miscellaneous typo fixes. (DLR)
|
- Miscellaneous typo fixes. (DLR)
|
||||||
|
- Many fixes to the help browser and shortcut lists: efficiency
|
||||||
|
updates, consistency fixes, help text fixes and improvements,
|
||||||
|
and spacing improvements. (David Benbennick)
|
||||||
|
- Make more functions use const variables when possible. (David
|
||||||
|
Benbennick)
|
||||||
- files.c:
|
- files.c:
|
||||||
read_file(), read_line():
|
read_file(), read_line():
|
||||||
- Rework to properly handle nulls in the input file, fix
|
- Rework to properly handle nulls in the input file, fix
|
||||||
@ -52,10 +57,17 @@ CVS Code -
|
|||||||
with it, instead of calling clear_filename() in two places.
|
with it, instead of calling clear_filename() in two places.
|
||||||
Make startline an int instead of a long, since it's supposed to
|
Make startline an int instead of a long, since it's supposed to
|
||||||
hold a line number. (DLR)
|
hold a line number. (DLR)
|
||||||
|
- Properly handle multiple -r settings on the command line. (Carl
|
||||||
|
Drinkwater)
|
||||||
- search.c:
|
- search.c:
|
||||||
findnextstr():
|
findnextstr():
|
||||||
- Update the current line at current_x if we don't find a match.
|
- Update the current line at current_x if we don't find a match.
|
||||||
(DLR)
|
Also, pass current_x_find to strstrwrapper() so we know whether
|
||||||
|
we're at the beginning of a string or not (see changes to
|
||||||
|
strstrwrapper() below), and reset it between lines. (DLR)
|
||||||
|
do_gotoline():
|
||||||
|
- Make sure placewewant is zero after we go to a line. (David
|
||||||
|
Benbennick)
|
||||||
do_gotopos():
|
do_gotopos():
|
||||||
- Simplify the sanity check to only put x within the range of the
|
- Simplify the sanity check to only put x within the range of the
|
||||||
current line; don't call actual_x() anymore. (DLR)
|
current line; don't call actual_x() anymore. (DLR)
|
||||||
@ -64,6 +76,10 @@ CVS Code -
|
|||||||
other than the terminating null in strings to newlines and
|
other than the terminating null in strings to newlines and
|
||||||
back; they're used to handle null characters in files properly.
|
back; they're used to handle null characters in files properly.
|
||||||
(DLR)
|
(DLR)
|
||||||
|
strstrwrapper(): Set REG_NOTBOL when we're not at the beginning of a
|
||||||
|
string, to avoid false positives when searching for regular
|
||||||
|
expressions prefixed with ^. Make it take a new parameter,
|
||||||
|
line_pos, to determine where we are in the string. (DLR)
|
||||||
- winio.c:
|
- winio.c:
|
||||||
actual_x_from_start():
|
actual_x_from_start():
|
||||||
- Overhaul to make cursor placement more like that of Pico: add
|
- Overhaul to make cursor placement more like that of Pico: add
|
||||||
@ -74,6 +90,9 @@ CVS Code -
|
|||||||
- After the user presses Enter at the prompt, refresh the edit
|
- After the user presses Enter at the prompt, refresh the edit
|
||||||
window in case there's a list of possible filename matches
|
window in case there's a list of possible filename matches
|
||||||
(left over from attempted tab completion) on it. (DLR)
|
(left over from attempted tab completion) on it. (DLR)
|
||||||
|
titlebar():
|
||||||
|
- Tweak text spacing and printing so that the titlebar text looks
|
||||||
|
better on smaller terminals. (Carl Drinkwater)
|
||||||
update_line():
|
update_line():
|
||||||
- When marking control characters, make sure the mark moves
|
- When marking control characters, make sure the mark moves
|
||||||
forward by two characters inctead of one. Rework control
|
forward by two characters inctead of one. Rework control
|
||||||
|
35
global.c
35
global.c
@ -338,7 +338,7 @@ void shortcut_init(int unjustify)
|
|||||||
nano_exit_msg = _("Exit from nano");
|
nano_exit_msg = _("Exit from nano");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nano_goto_msg = _("Goto a specific line number");
|
nano_goto_msg = _("Go to a specific line number");
|
||||||
nano_justify_msg = _("Justify the current paragraph");
|
nano_justify_msg = _("Justify the current paragraph");
|
||||||
nano_unjustify_msg = _("Unjustify after a justify");
|
nano_unjustify_msg = _("Unjustify after a justify");
|
||||||
nano_replace_msg = _("Replace text within the editor");
|
nano_replace_msg = _("Replace text within the editor");
|
||||||
@ -369,7 +369,7 @@ void shortcut_init(int unjustify)
|
|||||||
_("Make the current search or replace case (in)sensitive");
|
_("Make the current search or replace case (in)sensitive");
|
||||||
nano_tofiles_msg = _("Go to file browser");
|
nano_tofiles_msg = _("Go to file browser");
|
||||||
nano_execute_msg = _("Execute external command");
|
nano_execute_msg = _("Execute external command");
|
||||||
nano_gotodir_msg = _("Goto Directory");
|
nano_gotodir_msg = _("Go to directory");
|
||||||
nano_cancel_msg = _("Cancel the current function");
|
nano_cancel_msg = _("Cancel the current function");
|
||||||
nano_append_msg = _("Append to the current file");
|
nano_append_msg = _("Append to the current file");
|
||||||
nano_prepend_msg = _("Prepend to the current file");
|
nano_prepend_msg = _("Prepend to the current file");
|
||||||
@ -541,10 +541,20 @@ void shortcut_init(int unjustify)
|
|||||||
IFHELP(nano_enter_msg, 0),
|
IFHELP(nano_enter_msg, 0),
|
||||||
KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
|
KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
|
||||||
|
|
||||||
sc_init_one(&main_list, NANO_GOTO_KEY, _("Goto Line"),
|
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
|
||||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
|
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
|
||||||
NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
|
||||||
|
IFHELP(_("Move forward one word"), 0),
|
||||||
|
0, 0, VIEW, do_next_word_void);
|
||||||
|
|
||||||
|
sc_init_one(&main_list, -9, _("Prev Word"),
|
||||||
|
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
||||||
|
VIEW, do_prev_word_void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (!defined NANO_SMALL) && (defined HAVE_REGEX_H)
|
#if (!defined NANO_SMALL) && (defined HAVE_REGEX_H)
|
||||||
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
sc_init_one(&main_list, -9, _("Find Other Bracket"),
|
||||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
|
||||||
@ -560,15 +570,6 @@ void shortcut_init(int unjustify)
|
|||||||
0, 0, VIEW, open_nextfile_void);
|
0, 0, VIEW, open_nextfile_void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
|
||||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
|
|
||||||
IFHELP(_("Move forward one word"), 0),
|
|
||||||
0, 0, VIEW, do_next_word_void);
|
|
||||||
sc_init_one(&main_list, -9, _("Prev Word"),
|
|
||||||
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
|
|
||||||
VIEW, do_prev_word_void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free_shortcutage(&whereis_list);
|
free_shortcutage(&whereis_list);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
@ -587,7 +588,7 @@ void shortcut_init(int unjustify)
|
|||||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
|
||||||
IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
|
IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
|
||||||
|
|
||||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
|
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
@ -620,7 +621,7 @@ void shortcut_init(int unjustify)
|
|||||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
|
||||||
IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
|
IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
|
||||||
|
|
||||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Goto Line"),
|
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
|
||||||
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
@ -747,8 +748,8 @@ void shortcut_init(int unjustify)
|
|||||||
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
|
||||||
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_EXIT_KEY, _("Exit"),
|
sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
|
||||||
IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);
|
IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
|
||||||
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
|
||||||
@ -758,7 +759,7 @@ void shortcut_init(int unjustify)
|
|||||||
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
|
||||||
KEY_NPAGE, VIEW, 0);
|
KEY_NPAGE, VIEW, 0);
|
||||||
|
|
||||||
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Goto"),
|
sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
|
||||||
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
|
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
|
||||||
NANO_GOTO_FKEY, 0, VIEW, 0);
|
NANO_GOTO_FKEY, 0, VIEW, 0);
|
||||||
|
|
||||||
|
232
nano.c
232
nano.c
@ -70,10 +70,6 @@ int wrap_at = 0;/* Right justified fill value, allows resize */
|
|||||||
struct termios oldterm; /* The user's original term settings */
|
struct termios oldterm; /* The user's original term settings */
|
||||||
static struct sigaction act; /* For all our fun signal handlers */
|
static struct sigaction act; /* For all our fun signal handlers */
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
|
||||||
static char *help_text_init = ""; /* Initial message, not including shortcuts */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *last_search = NULL; /* Last string we searched for */
|
char *last_search = NULL; /* Last string we searched for */
|
||||||
char *last_replace = NULL; /* Last replacement string */
|
char *last_replace = NULL; /* Last replacement string */
|
||||||
int search_last_line; /* Is this the last search line? */
|
int search_last_line; /* Is this the last search line? */
|
||||||
@ -248,33 +244,7 @@ void global_init(int save_cutbuffer)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
/* Make a copy of a node to a pointer (space will be malloc()ed). */
|
||||||
void init_help_msg(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
help_text_init =
|
|
||||||
_(" nano help text\n\n "
|
|
||||||
"The nano editor is designed to emulate the functionality and "
|
|
||||||
"ease-of-use of the UW Pico text editor. There are four main "
|
|
||||||
"sections of the editor: The top line shows the program "
|
|
||||||
"version, the current filename being edited, and whether "
|
|
||||||
"or not the file has been modified. Next is the main editor "
|
|
||||||
"window showing the file being edited. The status line is "
|
|
||||||
"the third line from the bottom and shows important messages. "
|
|
||||||
"The bottom two lines show the most commonly used shortcuts "
|
|
||||||
"in the editor.\n\n "
|
|
||||||
"The notation for shortcuts is as follows: Control-key "
|
|
||||||
"sequences are notated with a caret (^) symbol and are entered "
|
|
||||||
"with the Control (Ctrl) key. Escape-key sequences are notated "
|
|
||||||
"with the Meta (M) symbol and can be entered using either the "
|
|
||||||
"Esc, Alt or Meta key depending on your keyboard setup. The "
|
|
||||||
"following keystrokes are available in the main editor window. "
|
|
||||||
"Optional keys are shown in parentheses:\n\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Make a copy of a node to a pointer (space will be malloc()ed). This
|
|
||||||
does NOT copy the data members used only by open_files. */
|
|
||||||
filestruct *copy_node(filestruct * src)
|
filestruct *copy_node(filestruct * src)
|
||||||
{
|
{
|
||||||
filestruct *dst;
|
filestruct *dst;
|
||||||
@ -2514,17 +2484,16 @@ int do_justify(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
|
/* This function allocates help_text, and stores the help string in it.
|
||||||
|
* help_text should be NULL initially. */
|
||||||
void help_init(void)
|
void help_init(void)
|
||||||
{
|
{
|
||||||
int i, sofar = 0, helplen;
|
size_t allocsize = 1; /* space needed for help_text */
|
||||||
long allocsize = 1; /* How much space we're gonna need for the help text */
|
|
||||||
char *ptr = NULL;
|
char *ptr = NULL;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
toggle *t;
|
const toggle *t;
|
||||||
#endif
|
#endif
|
||||||
shortcut *s;
|
const shortcut *s;
|
||||||
|
|
||||||
helplen = length_of_list(currshortcut);
|
|
||||||
|
|
||||||
/* First set up the initial help text for the current function */
|
/* First set up the initial help text for the current function */
|
||||||
if (currshortcut == whereis_list || currshortcut == replace_list
|
if (currshortcut == whereis_list || currshortcut == replace_list
|
||||||
@ -2534,29 +2503,29 @@ void help_init(void)
|
|||||||
"for, then hit enter. If there is a match for the text you "
|
"for, then hit enter. If there is a match for the text you "
|
||||||
"entered, the screen will be updated to the location of the "
|
"entered, the screen will be updated to the location of the "
|
||||||
"nearest match for the search string.\n\n "
|
"nearest match for the search string.\n\n "
|
||||||
"If using Pico Mode via the -p or --pico flags, using the "
|
"If using Pico Mode via the -p or --pico flags, the "
|
||||||
"Meta-P toggle or using a nanorc file, the previous search "
|
"Meta-P toggle, or a nanorc file, the previous search "
|
||||||
"string will be shown in brackets after the Search: prompt. "
|
"string will be shown in brackets after the Search: prompt. "
|
||||||
"Hitting enter without entering any text will perform the "
|
"Hitting Enter without entering any text will perform the "
|
||||||
"previous search. Otherwise, the previous string will be "
|
"previous search. Otherwise, the previous string will be "
|
||||||
"placed in front of the cursor, and can be edited or deleted "
|
"placed before the cursor, and can be edited or deleted "
|
||||||
"before hitting enter.\n\n The following functions keys are "
|
"before hitting enter.\n\n The following function keys are "
|
||||||
"available in Search mode:\n\n");
|
"available in Search mode:\n\n");
|
||||||
else if (currshortcut == goto_list)
|
else if (currshortcut == goto_list)
|
||||||
ptr = _("Goto Line Help Text\n\n "
|
ptr = _("Go To Line Help Text\n\n "
|
||||||
"Enter the line number that you wish to go to and hit "
|
"Enter the line number that you wish to go to and hit "
|
||||||
"Enter. If there are fewer lines of text than the "
|
"Enter. If there are fewer lines of text than the "
|
||||||
"number you entered, you will be brought to the last line "
|
"number you entered, you will be brought to the last line "
|
||||||
"of the file.\n\n The following functions keys are "
|
"of the file.\n\n The following function keys are "
|
||||||
"available in Goto Line mode:\n\n");
|
"available in Go To Line mode:\n\n");
|
||||||
else if (currshortcut == insertfile_list)
|
else if (currshortcut == insertfile_list)
|
||||||
ptr = _("Insert File Help Text\n\n "
|
ptr = _("Insert File Help Text\n\n "
|
||||||
"Type in the name of a file to be inserted into the current "
|
"Type in the name of a file to be inserted into the current "
|
||||||
"file buffer at the current cursor location.\n\n "
|
"file buffer at the current cursor location.\n\n "
|
||||||
"If you have compiled nano with multiple file buffer "
|
"If you have compiled nano with multiple file buffer "
|
||||||
"support, and enable multiple buffers with the -F "
|
"support, and enable multiple buffers with the -F "
|
||||||
"or --multibuffer command line flags, the Meta-F toggle or "
|
"or --multibuffer command line flags, the Meta-F toggle, or "
|
||||||
"using a nanorc file, inserting a file will cause it to be "
|
"a nanorc file, inserting a file will cause it to be "
|
||||||
"loaded into a separate buffer (use Meta-< and > to switch "
|
"loaded into a separate buffer (use Meta-< and > to switch "
|
||||||
"between file buffers).\n\n If you need another blank "
|
"between file buffers).\n\n If you need another blank "
|
||||||
"buffer, do not enter any filename, or type in a "
|
"buffer, do not enter any filename, or type in a "
|
||||||
@ -2566,14 +2535,13 @@ void help_init(void)
|
|||||||
else if (currshortcut == writefile_list)
|
else if (currshortcut == writefile_list)
|
||||||
ptr = _("Write File Help Text\n\n "
|
ptr = _("Write File Help Text\n\n "
|
||||||
"Type the name that you wish to save the current file "
|
"Type the name that you wish to save the current file "
|
||||||
"as and hit enter to save the file.\n\n "
|
"as and hit Enter to save the file.\n\n If you have "
|
||||||
"If you are using the marker code with Ctrl-^ and have "
|
"selected text with Ctrl-^, you will be prompted to "
|
||||||
"selected text, you will be prompted to save only the "
|
"save only the selected portion to a separate file. To "
|
||||||
"selected portion to a separate file. To reduce the "
|
"reduce the chance of overwriting the current file with "
|
||||||
"chance of overwriting the current file with just a portion "
|
"just a portion of it, the current filename is not the "
|
||||||
"of it, the current filename is not the default in this "
|
"default in this mode.\n\n The following function keys "
|
||||||
"mode.\n\n The following function keys are available in "
|
"are available in Write File mode:\n\n");
|
||||||
"Write File mode:\n\n");
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
else if (currshortcut == browser_list)
|
else if (currshortcut == browser_list)
|
||||||
ptr = _("File Browser Help Text\n\n "
|
ptr = _("File Browser Help Text\n\n "
|
||||||
@ -2582,17 +2550,17 @@ void help_init(void)
|
|||||||
"or writing. You may use the arrow keys or Page Up/"
|
"or writing. You may use the arrow keys or Page Up/"
|
||||||
"Down to browse through the files, and S or Enter to "
|
"Down to browse through the files, and S or Enter to "
|
||||||
"choose the selected file or enter the selected "
|
"choose the selected file or enter the selected "
|
||||||
"directory. To move up one level, select the directory "
|
"directory. To move up one level, select the directory "
|
||||||
"called \"..\" at the top of the file list.\n\n The "
|
"called \"..\" at the top of the file list.\n\n The "
|
||||||
"following functions keys are available in the file "
|
"following function keys are available in the file "
|
||||||
"browser:\n\n");
|
"browser:\n\n");
|
||||||
else if (currshortcut == gotodir_list)
|
else if (currshortcut == gotodir_list)
|
||||||
ptr = _("Browser Goto Directory Help Text\n\n "
|
ptr = _("Browser Go To Directory Help Text\n\n "
|
||||||
"Enter the name of the directory you would like to "
|
"Enter the name of the directory you would like to "
|
||||||
"browse to.\n\n If tab completion has not been disabled, "
|
"browse to.\n\n If tab completion has not been disabled, "
|
||||||
"you can use the TAB key to (attempt to) automatically "
|
"you can use the TAB key to (attempt to) automatically "
|
||||||
"complete the directory name.\n\n The following function "
|
"complete the directory name.\n\n The following function "
|
||||||
"keys are available in Browser GotoDir mode:\n\n");
|
"keys are available in Browser Go To Directory mode:\n\n");
|
||||||
#endif
|
#endif
|
||||||
else if (currshortcut == spell_list)
|
else if (currshortcut == spell_list)
|
||||||
ptr = _("Spell Check Help Text\n\n "
|
ptr = _("Spell Check Help Text\n\n "
|
||||||
@ -2612,107 +2580,117 @@ void help_init(void)
|
|||||||
"available in this mode:\n\n");
|
"available in this mode:\n\n");
|
||||||
#endif
|
#endif
|
||||||
else /* Default to the main help list */
|
else /* Default to the main help list */
|
||||||
ptr = help_text_init;
|
ptr = _(" nano help text\n\n "
|
||||||
|
"The nano editor is designed to emulate the functionality and "
|
||||||
|
"ease-of-use of the UW Pico text editor. There are four main "
|
||||||
|
"sections of the editor: The top line shows the program "
|
||||||
|
"version, the current filename being edited, and whether "
|
||||||
|
"or not the file has been modified. Next is the main editor "
|
||||||
|
"window showing the file being edited. The status line is "
|
||||||
|
"the third line from the bottom and shows important messages. "
|
||||||
|
"The bottom two lines show the most commonly used shortcuts "
|
||||||
|
"in the editor.\n\n "
|
||||||
|
"The notation for shortcuts is as follows: Control-key "
|
||||||
|
"sequences are notated with a caret (^) symbol and are entered "
|
||||||
|
"with the Control (Ctrl) key. Escape-key sequences are notated "
|
||||||
|
"with the Meta (M) symbol and can be entered using either the "
|
||||||
|
"Esc, Alt or Meta key depending on your keyboard setup. The "
|
||||||
|
"following keystrokes are available in the main editor window. "
|
||||||
|
"Alternative keys are shown in parentheses:\n\n");
|
||||||
|
|
||||||
/* Compute the space needed for the shortcut lists - we add 15 to
|
assert(currshortcut != NULL);
|
||||||
have room for the shortcut abbrev and its possible alternate keys */
|
/* Compute the space needed for the shortcut lists */
|
||||||
s = currshortcut;
|
for (s = currshortcut; s != NULL; s = s->next) {
|
||||||
for (i = 0; i <= helplen - 1; i++) {
|
assert(s->help != NULL);
|
||||||
if (s->help != NULL)
|
/* Each shortcut has at most 24 chars for the shortcut keys, plus
|
||||||
allocsize += strlen(s->help) + 15;
|
* the help description, plus 1 for \n. */
|
||||||
s = s->next;
|
allocsize += strlen(s->help) + 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* If we're on the main list, we also allocate space for toggle help text. */
|
/* If we're on the main list, we also count the toggle help text. */
|
||||||
if (currshortcut == main_list) {
|
if (currshortcut == main_list) {
|
||||||
for (t = toggles; t != NULL; t = t->next)
|
for (t = toggles; t != NULL; t = t->next) {
|
||||||
if (t->desc != NULL)
|
size_t len;
|
||||||
allocsize += strlen(t->desc) + 30;
|
|
||||||
|
assert(t->desc != NULL);
|
||||||
|
len = strlen(t->desc);
|
||||||
|
|
||||||
|
/* 6 for "M-%c\t\t\t", which fills 24 columns. */
|
||||||
|
allocsize += 6 + (len < COLS-24 ? len : COLS-24);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
allocsize += strlen(ptr);
|
allocsize += strlen(ptr);
|
||||||
|
|
||||||
if (help_text != NULL)
|
/* Other routines should have set help_text to NULL before */
|
||||||
free(help_text);
|
assert(help_text == NULL);
|
||||||
|
|
||||||
/* Allocate space for the help text */
|
/* Allocate space for the help text */
|
||||||
help_text = charalloc(allocsize);
|
help_text = charalloc(allocsize);
|
||||||
|
|
||||||
/* Now add the text we want */
|
/* Now add the text we want */
|
||||||
strcpy(help_text, ptr);
|
strcpy(help_text, ptr);
|
||||||
sofar = strlen(help_text);
|
ptr = help_text + strlen(help_text);
|
||||||
|
|
||||||
/* Now add our shortcut info */
|
/* Now add our shortcut info */
|
||||||
s = currshortcut;
|
for (s = currshortcut; s != NULL; s = s->next) {
|
||||||
for (i = 0; i <= helplen - 1; i++) {
|
/* true if the character in s->altval is shown in first column */
|
||||||
int meta_shortcut = 0;
|
int meta_shortcut = 0;
|
||||||
|
|
||||||
if (s->val > 0 && s->val < 32)
|
if (s->val > 0 && s->val < 32)
|
||||||
sofar += sprintf(help_text + sofar, "^%c\t", s->val + 64);
|
ptr += sprintf(ptr, "^%c", s->val + 64);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
else if (s->val == NANO_CONTROL_SPACE)
|
else if (s->val == NANO_CONTROL_SPACE)
|
||||||
sofar += sprintf(help_text + sofar, "^%s\t", _("Space"));
|
ptr += snprintf(ptr, 8, "^%s", _("Space"));
|
||||||
#endif
|
else if (s->altval == NANO_ALT_SPACE) {
|
||||||
else if (s->altval > 0)
|
|
||||||
meta_shortcut = 1;
|
meta_shortcut = 1;
|
||||||
else
|
ptr += snprintf(ptr, 8, "M-%s", _("Space"));
|
||||||
help_text[sofar++] = '\t';
|
}
|
||||||
|
#endif
|
||||||
if (!meta_shortcut) {
|
else if (s->altval > 0) {
|
||||||
if (s->misc1 > KEY_F0 && s->misc1 <= KEY_F(64))
|
meta_shortcut = 1;
|
||||||
sofar += sprintf(help_text + sofar, "(F%d)",
|
ptr += sprintf(ptr, "M-%c", s->altval -
|
||||||
s->misc1 - KEY_F0);
|
(('A' <= s->altval && s->altval <= 'Z') ||
|
||||||
help_text[sofar++] = '\t';
|
'a' <= s->altval ? 32 : 0));
|
||||||
|
}
|
||||||
|
/* Hack */
|
||||||
|
else if (s->val >= 'a') {
|
||||||
|
meta_shortcut = 1;
|
||||||
|
ptr += sprintf(ptr, "M-%c", s->val - 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
*(ptr++) = '\t';
|
||||||
if (s->altval == NANO_ALT_SPACE)
|
|
||||||
sofar += sprintf(help_text + sofar, "M-%s", _("Space"));
|
if (s->misc1 > KEY_F0 && s->misc1 <= KEY_F(64))
|
||||||
else
|
ptr += sprintf(ptr, "(F%d)", s->misc1 - KEY_F0);
|
||||||
#endif
|
|
||||||
if (s->altval > 0)
|
*(ptr++) = '\t';
|
||||||
sofar += sprintf(help_text + sofar,
|
|
||||||
(meta_shortcut ? "M-%c" : "(M-%c)"), s->altval -
|
if (!meta_shortcut && s->altval > 0)
|
||||||
|
ptr += sprintf(ptr, "(M-%c)", s->altval -
|
||||||
(('A' <= s->altval && s->altval <= 'Z') || 'a' <= s->altval
|
(('A' <= s->altval && s->altval <= 'Z') || 'a' <= s->altval
|
||||||
? 32 : 0));
|
? 32 : 0));
|
||||||
/* Hack */
|
|
||||||
else if (s->val >= 'a')
|
|
||||||
sofar += sprintf(help_text + sofar,
|
|
||||||
(meta_shortcut ? "(M-%c)\t" : "M-%c\t"), s->val - 32);
|
|
||||||
|
|
||||||
help_text[sofar++] = '\t';
|
*(ptr++) = '\t';
|
||||||
|
|
||||||
if (meta_shortcut) {
|
ptr += sprintf(ptr, "%s\n", s->help);
|
||||||
if (s->misc1 > KEY_F0 && s->misc1 <= KEY_F(64))
|
|
||||||
sofar += sprintf(help_text + sofar,
|
|
||||||
"(F%d)", s->misc1 - KEY_F0);
|
|
||||||
help_text[sofar++] = '\t';
|
|
||||||
help_text[sofar++] = '\t';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s->help != NULL)
|
|
||||||
sofar += sprintf(help_text + sofar, "%s", s->help);
|
|
||||||
|
|
||||||
help_text[sofar++] = '\n';
|
|
||||||
|
|
||||||
s = s->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* And the toggles... */
|
/* And the toggles... */
|
||||||
if (currshortcut == main_list)
|
if (currshortcut == main_list)
|
||||||
for (t = toggles; t != NULL; t = t->next) {
|
for (t = toggles; t != NULL; t = t->next) {
|
||||||
sofar += sprintf(help_text + sofar, "M-%c\t\t\t",
|
ptr += sprintf(ptr, "M-%c\t\t\t", t->val - 32);
|
||||||
t->val - 32);
|
ptr += snprintf(ptr, COLS-24, _("%s enable/disable\n"),
|
||||||
if (t->desc != NULL) {
|
t->desc);
|
||||||
sofar += sprintf(help_text + sofar,
|
|
||||||
_("%s enable/disable"), t->desc);
|
|
||||||
}
|
|
||||||
help_text[sofar++] = '\n';
|
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_SMALL */
|
||||||
|
|
||||||
|
/* If all went well, we didn't overwrite the allocated space for
|
||||||
|
help_text. */
|
||||||
|
assert(strlen(help_text) < allocsize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3007,6 +2985,8 @@ int main(int argc, char *argv[])
|
|||||||
fill = atoi(optarg);
|
fill = atoi(optarg);
|
||||||
if (fill < 0)
|
if (fill < 0)
|
||||||
wrap_at = fill;
|
wrap_at = fill;
|
||||||
|
else if (fill > 0)
|
||||||
|
wrap_at = 0;
|
||||||
else if (fill == 0) {
|
else if (fill == 0) {
|
||||||
usage(); /* To stop bogus data (like a string) */
|
usage(); /* To stop bogus data (like a string) */
|
||||||
finish(1);
|
finish(1);
|
||||||
@ -3093,10 +3073,6 @@ int main(int argc, char *argv[])
|
|||||||
/* Set up some global variables */
|
/* Set up some global variables */
|
||||||
global_init(0);
|
global_init(0);
|
||||||
shortcut_init(0);
|
shortcut_init(0);
|
||||||
#ifndef DISABLE_HELP
|
|
||||||
init_help_msg();
|
|
||||||
help_init();
|
|
||||||
#endif
|
|
||||||
signal_init();
|
signal_init();
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
2
proto.h
2
proto.h
@ -114,7 +114,7 @@ void thanks_for_all_the_fish(void);
|
|||||||
char *revstrstr(char *haystack, char *needle, char *rev_start);
|
char *revstrstr(char *haystack, char *needle, char *rev_start);
|
||||||
char *stristr(char *haystack, char *needle);
|
char *stristr(char *haystack, char *needle);
|
||||||
char *revstristr(char *haystack, char *needle, char *rev_start);
|
char *revstristr(char *haystack, char *needle, char *rev_start);
|
||||||
char *strstrwrapper(char *haystack, char *needle, char *rev_start);
|
char *strstrwrapper(char *haystack, char *needle, char *rev_start, int line_pos);
|
||||||
int search_init(int replacing);
|
int search_init(int replacing);
|
||||||
int renumber(filestruct * fileptr);
|
int renumber(filestruct * fileptr);
|
||||||
int free_filestruct(filestruct * src);
|
int free_filestruct(filestruct * src);
|
||||||
|
27
search.c
27
search.c
@ -268,7 +268,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||||||
searchstr = &fileptr->data[current_x_find];
|
searchstr = &fileptr->data[current_x_find];
|
||||||
|
|
||||||
/* Look for needle in searchstr */
|
/* Look for needle in searchstr */
|
||||||
while ((found = strstrwrapper(searchstr, needle, rev_start)) == NULL) {
|
while ((found = strstrwrapper(searchstr, needle, rev_start, current_x_find)) == NULL) {
|
||||||
|
|
||||||
/* finished processing file, get out */
|
/* finished processing file, get out */
|
||||||
if (search_last_line) {
|
if (search_last_line) {
|
||||||
@ -279,6 +279,10 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_line(fileptr, 0);
|
update_line(fileptr, 0);
|
||||||
|
|
||||||
|
/* reset current_x_find between lines */
|
||||||
|
current_x_find = 0;
|
||||||
|
|
||||||
fileptr = fileptr->next;
|
fileptr = fileptr->next;
|
||||||
|
|
||||||
if (fileptr == editbot)
|
if (fileptr == editbot)
|
||||||
@ -286,7 +290,8 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||||||
|
|
||||||
/* EOF reached ?, wrap around once */
|
/* EOF reached ?, wrap around once */
|
||||||
if (fileptr == NULL) {
|
if (fileptr == NULL) {
|
||||||
if (bracket_mode) /* don't wrap if looking for bracket match */
|
/* don't wrap if looking for bracket match */
|
||||||
|
if (bracket_mode)
|
||||||
return NULL;
|
return NULL;
|
||||||
fileptr = fileage;
|
fileptr = fileage;
|
||||||
past_editbuff = 1;
|
past_editbuff = 1;
|
||||||
@ -332,7 +337,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||||||
searchstr = fileptr->data;
|
searchstr = fileptr->data;
|
||||||
|
|
||||||
/* Look for needle in searchstr */
|
/* Look for needle in searchstr */
|
||||||
while ((found = strstrwrapper(searchstr, needle, rev_start)) == NULL) {
|
while ((found = strstrwrapper(searchstr, needle, rev_start, current_x_find)) == NULL) {
|
||||||
|
|
||||||
/* finished processing file, get out */
|
/* finished processing file, get out */
|
||||||
if (search_last_line) {
|
if (search_last_line) {
|
||||||
@ -342,6 +347,10 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_line(fileptr, 0);
|
update_line(fileptr, 0);
|
||||||
|
|
||||||
|
/* reset current_x_find between lines */
|
||||||
|
current_x_find = 0;
|
||||||
|
|
||||||
fileptr = fileptr->prev;
|
fileptr = fileptr->prev;
|
||||||
|
|
||||||
if (fileptr == edittop->prev)
|
if (fileptr == edittop->prev)
|
||||||
@ -811,14 +820,8 @@ void goto_abort(void)
|
|||||||
|
|
||||||
int do_gotoline(int line, int save_pos)
|
int do_gotoline(int line, int save_pos)
|
||||||
{
|
{
|
||||||
int i = 1;
|
|
||||||
|
|
||||||
if (line <= 0) { /* Ask for it */
|
if (line <= 0) { /* Ask for it */
|
||||||
|
if (statusq(0, goto_list, "", _("Enter line number"))) {
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
j = statusq(0, goto_list, "", _("Enter line number"));
|
|
||||||
if (j != 0) {
|
|
||||||
statusbar(_("Aborted"));
|
statusbar(_("Aborted"));
|
||||||
goto_abort();
|
goto_abort();
|
||||||
return 0;
|
return 0;
|
||||||
@ -834,7 +837,7 @@ int do_gotoline(int line, int save_pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (current = fileage; ((current->next != NULL) && (i < line)); i++)
|
for (current = fileage; current->next != NULL && line > 1; line--)
|
||||||
current = current->next;
|
current = current->next;
|
||||||
|
|
||||||
current_x = 0;
|
current_x = 0;
|
||||||
@ -846,7 +849,7 @@ int do_gotoline(int line, int save_pos)
|
|||||||
else
|
else
|
||||||
edit_update(current, CENTER);
|
edit_update(current, CENTER);
|
||||||
|
|
||||||
placewewant = xplustabs();
|
placewewant = 0;
|
||||||
goto_abort();
|
goto_abort();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
13
utils.c
13
utils.c
@ -137,15 +137,15 @@ char *stristr(char *haystack, char *needle)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
char *strstrwrapper(char *haystack, char *needle, char *rev_start, int line_pos)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (ISSET(USE_REGEXP)) {
|
if (ISSET(USE_REGEXP)) {
|
||||||
if (!ISSET(REVERSE_SEARCH)) {
|
if (!ISSET(REVERSE_SEARCH)) {
|
||||||
result = regexec(&search_regexp, haystack, 10, regmatches, 0);
|
result = regexec(&search_regexp, haystack, 10, regmatches, (line_pos > 0) ? REG_NOTBOL : 0);
|
||||||
if (!result)
|
if (!result)
|
||||||
return haystack + regmatches[0].rm_so;
|
return haystack + regmatches[0].rm_so;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
@ -155,12 +155,13 @@ char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
|||||||
/* do a quick search forward first */
|
/* do a quick search forward first */
|
||||||
if (!(regexec(&search_regexp, haystack, 10, regmatches, 0))) {
|
if (!(regexec(&search_regexp, haystack, 10, regmatches, 0))) {
|
||||||
/* there's a match somewhere in the line - now search for it backwards, much slower */
|
/* there's a match somewhere in the line - now search for it backwards, much slower */
|
||||||
for(i = rev_start ; i >= haystack ; --i)
|
for (i = rev_start; i >= haystack; --i) {
|
||||||
if (!(result = regexec(&search_regexp, i, 10, regmatches, 0))) {
|
if (!(result = regexec(&search_regexp, i, 10, regmatches, (i > haystack) ? REG_NOTBOL : 0))) {
|
||||||
j = i + regmatches[0].rm_so;
|
j = i + regmatches[0].rm_so;
|
||||||
if (j <= rev_start)
|
if (j <= rev_start)
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -172,7 +173,7 @@ char *strstrwrapper(char *haystack, char *needle, char *rev_start)
|
|||||||
if (ISSET(REVERSE_SEARCH))
|
if (ISSET(REVERSE_SEARCH))
|
||||||
return revstrstr(haystack, needle, rev_start);
|
return revstrstr(haystack, needle, rev_start);
|
||||||
else
|
else
|
||||||
return strstr(haystack,needle);
|
return strstr(haystack, needle);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (ISSET(REVERSE_SEARCH))
|
if (ISSET(REVERSE_SEARCH))
|
||||||
|
69
winio.c
69
winio.c
@ -68,7 +68,7 @@ int do_last_line(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Like xplustabs, but for a specific index of a specific filestruct */
|
/* Like xplustabs, but for a specific index of a specific filestruct */
|
||||||
int xpt(filestruct * fileptr, int index)
|
int xpt(const filestruct *fileptr, int index)
|
||||||
{
|
{
|
||||||
int i, tabs = 0;
|
int i, tabs = 0;
|
||||||
|
|
||||||
@ -558,36 +558,37 @@ void titlebar(char *path)
|
|||||||
wattron(topwin, A_REVERSE);
|
wattron(topwin, A_REVERSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mvwaddnstr(topwin, 0, 2, VERMSG, COLS - 3);
|
||||||
mvwaddstr(topwin, 0, 3, VERMSG);
|
|
||||||
|
|
||||||
space = COLS - strlen(VERMSG) - strlen(VERSION) - 21;
|
space = COLS - strlen(VERMSG) - strlen(VERSION) - 21;
|
||||||
|
|
||||||
namelen = strlen(what);
|
namelen = strlen(what);
|
||||||
|
|
||||||
if (what[0] == '\0')
|
if (space > 0) {
|
||||||
mvwaddstr(topwin, 0, COLS / 2 - 6, _("New Buffer"));
|
if (what[0] == '\0')
|
||||||
else {
|
mvwaddstr(topwin, 0, COLS / 2 - 6, _("New Buffer"));
|
||||||
if (namelen > space) {
|
else {
|
||||||
if (path == NULL)
|
if (namelen > space) {
|
||||||
waddstr(topwin, _(" File: ..."));
|
if (path == NULL)
|
||||||
else
|
waddstr(topwin, _(" File: ..."));
|
||||||
waddstr(topwin, _(" DIR: ..."));
|
else
|
||||||
waddstr(topwin, &what[namelen - space]);
|
waddstr(topwin, _(" DIR: ..."));
|
||||||
} else {
|
waddstr(topwin, &what[namelen - space]);
|
||||||
if (path == NULL)
|
} else {
|
||||||
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
if (path == NULL)
|
||||||
_("File: "));
|
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
||||||
else
|
_("File: "));
|
||||||
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
else
|
||||||
_(" DIR: "));
|
mvwaddstr(topwin, 0, COLS / 2 - (namelen / 2 + 1),
|
||||||
waddstr(topwin, what);
|
_(" DIR: "));
|
||||||
|
waddstr(topwin, what);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} /* If we don't have space, we shouldn't bother */
|
||||||
if (ISSET(MODIFIED))
|
if (ISSET(MODIFIED))
|
||||||
mvwaddstr(topwin, 0, COLS - 10, _("Modified"));
|
mvwaddstr(topwin, 0, COLS - 11, _(" Modified "));
|
||||||
else if (ISSET(VIEW_MODE))
|
else if (ISSET(VIEW_MODE))
|
||||||
mvwaddstr(topwin, 0, COLS - 10, _("View"));
|
mvwaddstr(topwin, 0, COLS - 11, _(" View "));
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
color_off(topwin, COLOR_TITLEBAR);
|
color_off(topwin, COLOR_TITLEBAR);
|
||||||
@ -1733,12 +1734,11 @@ int do_cursorpos_void(void)
|
|||||||
return do_cursorpos(0);
|
return do_cursorpos(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Our broken, non-shortcut list compliant help function.
|
/* Our shortcut-list-compliant help function, which is
|
||||||
But, hey, it's better than nothing, and it's dynamic! */
|
* better than nothing, and dynamic! */
|
||||||
int do_help(void)
|
int do_help(void)
|
||||||
{
|
{
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
char *ptr, *end;
|
|
||||||
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
|
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp, kp2;
|
||||||
int no_help_flag = 0;
|
int no_help_flag = 0;
|
||||||
shortcut *oldshortcut;
|
shortcut *oldshortcut;
|
||||||
@ -1748,8 +1748,9 @@ int do_help(void)
|
|||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, A_REVERSE);
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
|
||||||
|
/* set help_text as the string to display */
|
||||||
help_init();
|
help_init();
|
||||||
ptr = help_text;
|
assert(help_text != NULL);
|
||||||
|
|
||||||
oldshortcut = currshortcut;
|
oldshortcut = currshortcut;
|
||||||
|
|
||||||
@ -1771,7 +1772,8 @@ int do_help(void)
|
|||||||
bottombars(help_list);
|
bottombars(help_list);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ptr = help_text;
|
const char *ptr = help_text;
|
||||||
|
|
||||||
switch (kbinput) {
|
switch (kbinput) {
|
||||||
#ifndef DISABLE_MOUSE
|
#ifndef DISABLE_MOUSE
|
||||||
#ifdef NCURSES_MOUSE_VERSION
|
#ifdef NCURSES_MOUSE_VERSION
|
||||||
@ -1842,14 +1844,10 @@ int do_help(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 1) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
while (i < editwinrows && *ptr != '\0') {
|
while (i < editwinrows && *ptr != '\0') {
|
||||||
end = ptr;
|
const char *end = ptr;
|
||||||
while (*end != '\n' && *end != '\0' && j != COLS - 5) {
|
while (*end != '\n' && *end != '\0' && j != COLS - 5) {
|
||||||
end++;
|
end++;
|
||||||
j++;
|
j++;
|
||||||
@ -1895,6 +1893,11 @@ int do_help(void)
|
|||||||
nano_disabled_msg();
|
nano_disabled_msg();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The help_init() at the beginning allocated help_text, which has
|
||||||
|
now been written to screen. */
|
||||||
|
free(help_text);
|
||||||
|
help_text = NULL;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user