help_init(): - Fix off by one error that was making ^G help in normal mode and ^_ in pico mode not be displayed in the help.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@412 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-12-18 03:40:00 +00:00
parent 51b3eec536
commit 220ba692e6
2 changed files with 6 additions and 3 deletions

View File

@ -34,6 +34,9 @@ General
modify_control_key. Removed #ifdef _POSIX_VDISABLE check modify_control_key. Removed #ifdef _POSIX_VDISABLE check
around Control-S,Q,Z handlers because we need it now for around Control-S,Q,Z handlers because we need it now for
the Alt-Alt-x code. the Alt-Alt-x code.
help_init()
- Fix off by one error that was making ^G help in normal mode and
^_ in pico mode not be displayed in the help.
- nano.1, nano.1.html: - nano.1, nano.1.html:
- Updated man page for -b, -e, -f and expanded explanation for -p. - Updated man page for -b, -e, -f and expanded explanation for -p.
- utils.c: - utils.c:

6
nano.c
View File

@ -1912,11 +1912,11 @@ void help_init(void)
{ {
int i, sofar = 0; int i, sofar = 0;
long allocsize = 1; /* How much space we're gonna need for the help text */ long allocsize = 1; /* How much space we're gonna need for the help text */
char buf[BUFSIZ]; char buf[BUFSIZ] = "";
/* Compute the space needed for the shortcut lists - we add 15 to /* Compute the space needed for the shortcut lists - we add 15 to
have room for the shortcut abbrev and its possible alternate keys */ have room for the shortcut abbrev and its possible alternate keys */
for (i = 0; i < MAIN_LIST_LEN; i++) for (i = 0; i <= MAIN_LIST_LEN - 1; i++)
if (main_list[i].help != NULL) if (main_list[i].help != NULL)
allocsize += strlen(main_list[i].help) + 15; allocsize += strlen(main_list[i].help) + 15;
@ -1937,7 +1937,7 @@ void help_init(void)
strcpy(help_text, help_text_init); strcpy(help_text, help_text_init);
/* Now add our shortcut info */ /* Now add our shortcut info */
for (i = 0; i < MAIN_LIST_LEN - 1; i++) { for (i = 0; i <= MAIN_LIST_LEN - 1; i++) {
sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64); sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64)) if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))