David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 1 | /************************************************************************** |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 2 | * help.c -- This file is part of GNU nano. * |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 3 | * * |
Chris Allegretta | 8a07a96 | 2009-12-02 03:36:22 +0000 | [diff] [blame] | 4 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, * |
Benno Schulenberg | 7a9f4a4 | 2014-04-30 20:18:26 +0000 | [diff] [blame] | 5 | * 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. * |
Benno Schulenberg | 406e524 | 2016-08-29 15:14:18 +0200 | [diff] [blame] | 6 | * Copyright (C) 2014, 2015, 2016 Benno Schulenberg * |
| 7 | * * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 8 | * GNU nano is free software: you can redistribute it and/or modify * |
| 9 | * it under the terms of the GNU General Public License as published * |
| 10 | * by the Free Software Foundation, either version 3 of the License, * |
| 11 | * or (at your option) any later version. * |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 12 | * * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 13 | * GNU nano is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty * |
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
| 16 | * See the GNU General Public License for more details. * |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 17 | * * |
| 18 | * You should have received a copy of the GNU General Public License * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 19 | * along with this program. If not, see http://www.gnu.org/licenses/. * |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 20 | * * |
| 21 | **************************************************************************/ |
| 22 | |
David Lawrence Ramsey | 034b994 | 2005-12-08 02:47:10 +0000 | [diff] [blame] | 23 | #include "proto.h" |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 24 | |
| 25 | #include <stdio.h> |
| 26 | #include <string.h> |
| 27 | #include <ctype.h> |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 28 | |
| 29 | #ifndef DISABLE_HELP |
| 30 | |
| 31 | static char *help_text = NULL; |
| 32 | /* The text displayed in the help window. */ |
| 33 | |
Benno Schulenberg | a9aa0ef | 2015-08-16 08:43:56 +0000 | [diff] [blame] | 34 | static char *end_of_intro = NULL; |
| 35 | /* The point in the help text where the introductory paragraphs end |
| 36 | * and the shortcut descriptions begin. */ |
| 37 | |
Benno Schulenberg | 7a1959f | 2015-08-16 09:28:33 +0000 | [diff] [blame] | 38 | /* Our main help-viewer function. */ |
| 39 | void do_help(void) |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 40 | { |
David Lawrence Ramsey | a662c55 | 2006-06-30 21:13:55 +0000 | [diff] [blame] | 41 | int kbinput = ERR; |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 42 | bool old_no_help = ISSET(NO_HELP); |
David Lawrence Ramsey | 6e7d24d | 2006-05-06 02:26:18 +0000 | [diff] [blame] | 43 | size_t line = 0; |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 44 | /* The line number in help_text of the first displayed help |
| 45 | * line. This variable is zero-based. */ |
David Lawrence Ramsey | f629aad | 2006-05-06 02:42:42 +0000 | [diff] [blame] | 46 | size_t last_line = 0; |
David Lawrence Ramsey | 6e7d24d | 2006-05-06 02:26:18 +0000 | [diff] [blame] | 47 | /* The line number in help_text of the last help line. This |
| 48 | * variable is zero-based. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 49 | int oldmenu = currmenu; |
Benno Schulenberg | 8f61511 | 2014-04-14 09:57:06 +0000 | [diff] [blame] | 50 | /* The menu we were called from. */ |
David Lawrence Ramsey | 6e7d24d | 2006-05-06 02:26:18 +0000 | [diff] [blame] | 51 | const char *ptr; |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 52 | /* The current line of the help text. */ |
David Lawrence Ramsey | 60d22f0 | 2006-07-05 02:24:23 +0000 | [diff] [blame] | 53 | size_t old_line = (size_t)-1; |
| 54 | /* The line we were on before the current line. */ |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 55 | functionptrtype func; |
| 56 | /* The function of the key the user typed in. */ |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 57 | |
Benno Schulenberg | 568d2a3 | 2016-02-13 19:41:12 +0000 | [diff] [blame] | 58 | /* Don't show a cursor in the help screen. */ |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 59 | curs_set(0); |
| 60 | blank_edit(); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 61 | blank_statusbar(); |
| 62 | |
| 63 | /* Set help_text as the string to display. */ |
| 64 | help_init(); |
| 65 | |
| 66 | assert(help_text != NULL); |
| 67 | |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 68 | if (ISSET(NO_HELP)) { |
| 69 | /* Make sure that the help screen's shortcut list will actually |
| 70 | * be displayed. */ |
| 71 | UNSET(NO_HELP); |
| 72 | window_init(); |
| 73 | } |
| 74 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 75 | bottombars(MHELP); |
David Lawrence Ramsey | 51b7b0e | 2006-07-05 06:38:47 +0000 | [diff] [blame] | 76 | wnoutrefresh(bottomwin); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 77 | |
Benno Schulenberg | 75d64e6 | 2015-05-28 13:02:29 +0000 | [diff] [blame] | 78 | while (TRUE) { |
| 79 | size_t i; |
| 80 | |
Benno Schulenberg | 59187b8 | 2015-05-28 13:28:37 +0000 | [diff] [blame] | 81 | ptr = help_text; |
David Lawrence Ramsey | 6e7d24d | 2006-05-06 02:26:18 +0000 | [diff] [blame] | 82 | |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 83 | /* Find the line number of the last line of the help text. */ |
Benno Schulenberg | 59187b8 | 2015-05-28 13:28:37 +0000 | [diff] [blame] | 84 | for (last_line = 0; *ptr != '\0'; last_line++) { |
| 85 | ptr += help_line_len(ptr); |
| 86 | if (*ptr == '\n') |
| 87 | ptr++; |
| 88 | } |
| 89 | |
| 90 | if (last_line > 0) |
| 91 | last_line--; |
David Lawrence Ramsey | 6e7d24d | 2006-05-06 02:26:18 +0000 | [diff] [blame] | 92 | |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 93 | /* Redisplay if the text was scrolled or an invalid key was pressed. */ |
| 94 | if (line != old_line || kbinput == ERR) { |
David Lawrence Ramsey | c0ba4bf | 2006-07-05 01:10:18 +0000 | [diff] [blame] | 95 | blank_edit(); |
| 96 | |
| 97 | ptr = help_text; |
| 98 | |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 99 | /* Advance in the text to the first line to be displayed. */ |
David Lawrence Ramsey | c0ba4bf | 2006-07-05 01:10:18 +0000 | [diff] [blame] | 100 | for (i = 0; i < line; i++) { |
| 101 | ptr += help_line_len(ptr); |
| 102 | if (*ptr == '\n') |
| 103 | ptr++; |
| 104 | } |
| 105 | |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 106 | /* Now display as many lines as the window will hold. */ |
David Lawrence Ramsey | c0ba4bf | 2006-07-05 01:10:18 +0000 | [diff] [blame] | 107 | for (i = 0; i < editwinrows && *ptr != '\0'; i++) { |
| 108 | size_t j = help_line_len(ptr); |
| 109 | |
| 110 | mvwaddnstr(edit, i, 0, ptr, j); |
| 111 | ptr += j; |
| 112 | if (*ptr == '\n') |
| 113 | ptr++; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | wnoutrefresh(edit); |
| 118 | |
David Lawrence Ramsey | 60d22f0 | 2006-07-05 02:24:23 +0000 | [diff] [blame] | 119 | old_line = line; |
| 120 | |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 121 | lastmessage = HUSH; |
Benno Schulenberg | 2535f51 | 2016-04-30 17:31:43 +0200 | [diff] [blame] | 122 | |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 123 | kbinput = get_kbinput(edit); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 124 | |
Benno Schulenberg | 75d64e6 | 2015-05-28 13:02:29 +0000 | [diff] [blame] | 125 | #ifndef NANO_TINY |
| 126 | if (kbinput == KEY_WINCH) { |
| 127 | kbinput = ERR; |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 128 | continue; /* Redraw the screen. */ |
Benno Schulenberg | 75d64e6 | 2015-05-28 13:02:29 +0000 | [diff] [blame] | 129 | } |
| 130 | #endif |
| 131 | |
Chris Allegretta | c0b7872 | 2008-03-11 04:52:57 +0000 | [diff] [blame] | 132 | #ifndef DISABLE_MOUSE |
Benno Schulenberg | 8f61511 | 2014-04-14 09:57:06 +0000 | [diff] [blame] | 133 | if (kbinput == KEY_MOUSE) { |
Benno Schulenberg | cfa1338 | 2014-06-23 20:22:42 +0000 | [diff] [blame] | 134 | int mouse_x, mouse_y; |
| 135 | get_mouseinput(&mouse_x, &mouse_y, TRUE); |
| 136 | continue; /* Redraw the screen. */ |
Chris Allegretta | c0b7872 | 2008-03-11 04:52:57 +0000 | [diff] [blame] | 137 | } |
| 138 | #endif |
| 139 | |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 140 | func = parse_help_input(&kbinput); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 141 | |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 142 | if (func == total_refresh) { |
Benno Schulenberg | cfa1338 | 2014-06-23 20:22:42 +0000 | [diff] [blame] | 143 | total_redraw(); |
Benno Schulenberg | 8b636de | 2016-07-01 12:41:35 +0200 | [diff] [blame] | 144 | } else if (func == do_up_void) { |
| 145 | if (line > 0) |
| 146 | line--; |
| 147 | } else if (func == do_down_void) { |
| 148 | if (line + (editwinrows - 1) < last_line) |
| 149 | line++; |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 150 | } else if (func == do_page_up) { |
Benno Schulenberg | cfa1338 | 2014-06-23 20:22:42 +0000 | [diff] [blame] | 151 | if (line > editwinrows - 2) |
| 152 | line -= editwinrows - 2; |
| 153 | else |
| 154 | line = 0; |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 155 | } else if (func == do_page_down) { |
Benno Schulenberg | cfa1338 | 2014-06-23 20:22:42 +0000 | [diff] [blame] | 156 | if (line + (editwinrows - 1) < last_line) |
| 157 | line += editwinrows - 2; |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 158 | } else if (func == do_first_line) { |
Benno Schulenberg | 40ae394 | 2014-06-25 09:17:38 +0000 | [diff] [blame] | 159 | line = 0; |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 160 | } else if (func == do_last_line) { |
Benno Schulenberg | 40ae394 | 2014-06-25 09:17:38 +0000 | [diff] [blame] | 161 | if (line + (editwinrows - 1) < last_line) |
| 162 | line = last_line - (editwinrows - 1); |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 163 | } else if (func == do_exit) { |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 164 | /* Exit from the help viewer. */ |
Benno Schulenberg | 623b1b6 | 2014-04-15 19:32:45 +0000 | [diff] [blame] | 165 | break; |
Benno Schulenberg | e0c4f9c | 2016-04-27 14:37:31 +0200 | [diff] [blame] | 166 | } else |
| 167 | unbound_key(kbinput); |
David Lawrence Ramsey | a43b108 | 2006-06-30 22:28:37 +0000 | [diff] [blame] | 168 | } |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 169 | |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 170 | if (old_no_help) { |
| 171 | blank_bottombars(); |
| 172 | wnoutrefresh(bottomwin); |
Benno Schulenberg | d8b6dbf | 2015-04-07 14:16:07 +0000 | [diff] [blame] | 173 | currmenu = oldmenu; |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 174 | SET(NO_HELP); |
| 175 | window_init(); |
| 176 | } else |
Benno Schulenberg | d8b6dbf | 2015-04-07 14:16:07 +0000 | [diff] [blame] | 177 | bottombars(oldmenu); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 178 | |
Benno Schulenberg | 7a1959f | 2015-08-16 09:28:33 +0000 | [diff] [blame] | 179 | #ifndef DISABLE_BROWSER |
| 180 | if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR) |
| 181 | browser_refresh(); |
| 182 | else |
| 183 | #endif |
| 184 | edit_refresh(); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 185 | |
Benno Schulenberg | 86bbe50 | 2015-08-16 17:53:28 +0000 | [diff] [blame] | 186 | /* We're exiting from the help screen. */ |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 187 | free(help_text); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 188 | } |
| 189 | |
Benno Schulenberg | 86bbe50 | 2015-08-16 17:53:28 +0000 | [diff] [blame] | 190 | /* Allocate space for the help text for the current menu, and concatenate |
| 191 | * the different pieces of text into it. */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 192 | void help_init(void) |
| 193 | { |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 194 | size_t allocsize = 0; |
| 195 | /* Space needed for help_text. */ |
| 196 | const char *htx[3]; |
| 197 | /* Untranslated help introduction. We break it up into three chunks |
| 198 | * in case the full string is too long for the compiler to handle. */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 199 | char *ptr; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 200 | const subnfunc *f; |
| 201 | const sc *s; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 202 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 203 | #ifndef NANO_TINY |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 204 | bool old_whitespace = ISSET(WHITESPACE_DISPLAY); |
| 205 | |
| 206 | UNSET(WHITESPACE_DISPLAY); |
| 207 | #endif |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 208 | |
| 209 | /* First, set up the initial help text for the current function. */ |
Benno Schulenberg | e167afe | 2014-04-16 09:26:15 +0000 | [diff] [blame] | 210 | if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 211 | htx[0] = N_("Search Command Help Text\n\n " |
| 212 | "Enter the words or characters you would like to " |
| 213 | "search for, and then press Enter. If there is a " |
| 214 | "match for the text you entered, the screen will be " |
| 215 | "updated to the location of the nearest match for the " |
| 216 | "search string.\n\n The previous search string will be " |
| 217 | "shown in brackets after the search prompt. Hitting " |
| 218 | "Enter without entering any text will perform the " |
| 219 | "previous search. "); |
| 220 | htx[1] = N_("If you have selected text with the mark and then " |
| 221 | "search to replace, only matches in the selected text " |
| 222 | "will be replaced.\n\n The following function keys are " |
| 223 | "available in Search mode:\n\n"); |
| 224 | htx[2] = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 225 | } else if (currmenu == MGOTOLINE) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 226 | htx[0] = N_("Go To Line Help Text\n\n " |
| 227 | "Enter the line number that you wish to go to and hit " |
| 228 | "Enter. If there are fewer lines of text than the " |
| 229 | "number you entered, you will be brought to the last " |
| 230 | "line of the file.\n\n The following function keys are " |
| 231 | "available in Go To Line mode:\n\n"); |
| 232 | htx[1] = NULL; |
| 233 | htx[2] = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 234 | } else if (currmenu == MINSERTFILE) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 235 | htx[0] = N_("Insert File Help Text\n\n " |
| 236 | "Type in the name of a file to be inserted into the " |
| 237 | "current file buffer at the current cursor " |
| 238 | "location.\n\n If you have compiled nano with multiple " |
| 239 | "file buffer support, and enable multiple file buffers " |
| 240 | "with the -F or --multibuffer command line flags, the " |
| 241 | "Meta-F toggle, or a nanorc file, inserting a file " |
| 242 | "will cause it to be loaded into a separate buffer " |
| 243 | "(use Meta-< and > to switch between file buffers). "); |
| 244 | htx[1] = N_("If you need another blank buffer, do not enter " |
| 245 | "any filename, or type in a nonexistent filename at " |
| 246 | "the prompt and press Enter.\n\n The following " |
| 247 | "function keys are available in Insert File mode:\n\n"); |
| 248 | htx[2] = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 249 | } else if (currmenu == MWRITEFILE) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 250 | htx[0] = N_("Write File Help Text\n\n " |
| 251 | "Type the name that you wish to save the current file " |
| 252 | "as and press Enter to save the file.\n\n If you have " |
| 253 | "selected text with the mark, you will be prompted to " |
| 254 | "save only the selected portion to a separate file. To " |
| 255 | "reduce the chance of overwriting the current file with " |
| 256 | "just a portion of it, the current filename is not the " |
| 257 | "default in this mode.\n\n The following function keys " |
| 258 | "are available in Write File mode:\n\n"); |
| 259 | htx[1] = NULL; |
| 260 | htx[2] = NULL; |
| 261 | } |
| 262 | #ifndef DISABLE_BROWSER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 263 | else if (currmenu == MBROWSER) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 264 | htx[0] = N_("File Browser Help Text\n\n " |
| 265 | "The file browser is used to visually browse the " |
| 266 | "directory structure to select a file for reading " |
| 267 | "or writing. You may use the arrow keys or Page Up/" |
| 268 | "Down to browse through the files, and S or Enter to " |
| 269 | "choose the selected file or enter the selected " |
| 270 | "directory. To move up one level, select the " |
| 271 | "directory called \"..\" at the top of the file " |
| 272 | "list.\n\n The following function keys are available " |
| 273 | "in the file browser:\n\n"); |
| 274 | htx[1] = NULL; |
| 275 | htx[2] = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 276 | } else if (currmenu == MWHEREISFILE) { |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 277 | htx[0] = N_("Browser Search Command Help Text\n\n " |
| 278 | "Enter the words or characters you would like to " |
| 279 | "search for, and then press Enter. If there is a " |
| 280 | "match for the text you entered, the screen will be " |
| 281 | "updated to the location of the nearest match for the " |
| 282 | "search string.\n\n The previous search string will be " |
| 283 | "shown in brackets after the search prompt. Hitting " |
| 284 | "Enter without entering any text will perform the " |
David Lawrence Ramsey | 9c2f7ab | 2006-06-09 12:44:34 +0000 | [diff] [blame] | 285 | "previous search.\n\n"); |
| 286 | htx[1] = N_(" The following function keys are available in " |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 287 | "Browser Search mode:\n\n"); |
| 288 | htx[2] = NULL; |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 289 | } else if (currmenu == MGOTODIR) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 290 | htx[0] = N_("Browser Go To Directory Help Text\n\n " |
| 291 | "Enter the name of the directory you would like to " |
| 292 | "browse to.\n\n If tab completion has not been " |
| 293 | "disabled, you can use the Tab key to (attempt to) " |
| 294 | "automatically complete the directory name.\n\n The " |
| 295 | "following function keys are available in Browser Go " |
| 296 | "To Directory mode:\n\n"); |
| 297 | htx[1] = NULL; |
| 298 | htx[2] = NULL; |
| 299 | } |
David Lawrence Ramsey | e006c51 | 2006-03-25 15:23:55 +0000 | [diff] [blame] | 300 | #endif /* !DISABLE_BROWSER */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 301 | #ifndef DISABLE_SPELLER |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 302 | else if (currmenu == MSPELL) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 303 | htx[0] = N_("Spell Check Help Text\n\n " |
| 304 | "The spell checker checks the spelling of all text in " |
| 305 | "the current file. When an unknown word is " |
| 306 | "encountered, it is highlighted and a replacement can " |
| 307 | "be edited. It will then prompt to replace every " |
| 308 | "instance of the given misspelled word in the current " |
| 309 | "file, or, if you have selected text with the mark, in " |
David Lawrence Ramsey | af7677e | 2006-05-19 23:07:02 +0000 | [diff] [blame] | 310 | "the selected text.\n\n The following function keys " |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 311 | "are available in Spell Check mode:\n\n"); |
| 312 | htx[1] = NULL; |
| 313 | htx[2] = NULL; |
| 314 | } |
David Lawrence Ramsey | e006c51 | 2006-03-25 15:23:55 +0000 | [diff] [blame] | 315 | #endif /* !DISABLE_SPELLER */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 316 | #ifndef NANO_TINY |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 317 | else if (currmenu == MEXTCMD) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 318 | htx[0] = N_("Execute Command Help Text\n\n " |
David Lawrence Ramsey | 9e553b2 | 2006-06-08 02:16:37 +0000 | [diff] [blame] | 319 | "This mode allows you to insert the output of a " |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 320 | "command run by the shell into the current buffer (or " |
David Lawrence Ramsey | a7e778e | 2007-01-29 15:34:45 +0000 | [diff] [blame] | 321 | "a new buffer in multiple file buffer mode). If you " |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 322 | "need another blank buffer, do not enter any " |
David Lawrence Ramsey | af7677e | 2006-05-19 23:07:02 +0000 | [diff] [blame] | 323 | "command.\n\n The following function keys are " |
| 324 | "available in Execute Command mode:\n\n"); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 325 | htx[1] = NULL; |
| 326 | htx[2] = NULL; |
| 327 | } |
David Lawrence Ramsey | e006c51 | 2006-03-25 15:23:55 +0000 | [diff] [blame] | 328 | #endif /* !NANO_TINY */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 329 | else { |
| 330 | /* Default to the main help list. */ |
David Lawrence Ramsey | 7b0531a | 2006-07-31 01:30:31 +0000 | [diff] [blame] | 331 | htx[0] = N_("Main nano help text\n\n " |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 332 | "The nano editor is designed to emulate the " |
| 333 | "functionality and ease-of-use of the UW Pico text " |
| 334 | "editor. There are four main sections of the editor. " |
| 335 | "The top line shows the program version, the current " |
| 336 | "filename being edited, and whether or not the file " |
| 337 | "has been modified. Next is the main editor window " |
| 338 | "showing the file being edited. The status line is " |
| 339 | "the third line from the bottom and shows important " |
David Lawrence Ramsey | 5c55e85 | 2006-08-19 11:11:51 +0000 | [diff] [blame] | 340 | "messages. "); |
| 341 | htx[1] = N_("The bottom two lines show the most commonly used " |
Benno Schulenberg | 4a9b97b | 2016-04-05 15:42:58 +0200 | [diff] [blame] | 342 | "shortcuts in the editor.\n\n Shortcuts are written as " |
| 343 | "follows: Control-key sequences are notated with a '^' " |
| 344 | "and can be entered either by using the Ctrl key or " |
| 345 | "pressing the Esc key twice. Meta-key sequences are " |
| 346 | "notated with 'M-' and can be entered using either the " |
| 347 | "Alt, Cmd, or Esc key, depending on your keyboard setup. "); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 348 | htx[2] = N_("Also, pressing Esc twice and then typing a " |
| 349 | "three-digit decimal number from 000 to 255 will enter " |
| 350 | "the character with the corresponding value. The " |
| 351 | "following keystrokes are available in the main editor " |
| 352 | "window. Alternative keys are shown in " |
| 353 | "parentheses:\n\n"); |
| 354 | } |
| 355 | |
| 356 | htx[0] = _(htx[0]); |
| 357 | if (htx[1] != NULL) |
| 358 | htx[1] = _(htx[1]); |
| 359 | if (htx[2] != NULL) |
| 360 | htx[2] = _(htx[2]); |
| 361 | |
| 362 | allocsize += strlen(htx[0]); |
| 363 | if (htx[1] != NULL) |
| 364 | allocsize += strlen(htx[1]); |
| 365 | if (htx[2] != NULL) |
| 366 | allocsize += strlen(htx[2]); |
| 367 | |
Benno Schulenberg | 71c9a52 | 2014-05-13 20:14:01 +0000 | [diff] [blame] | 368 | /* Calculate the length of the shortcut help text. Each entry has |
| 369 | * one or two keys, which fill 16 columns, plus translated text, |
| 370 | * plus one or two \n's. */ |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 371 | for (f = allfuncs; f != NULL; f = f->next) |
| 372 | if (f->menus & currmenu) |
| 373 | allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2; |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 374 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 375 | #ifndef NANO_TINY |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 376 | /* If we're on the main list, we also count the toggle help text. |
Benno Schulenberg | 71c9a52 | 2014-05-13 20:14:01 +0000 | [diff] [blame] | 377 | * Each entry has "M-%c\t\t", five chars which fill 16 columns, |
| 378 | * plus a space, plus translated text, plus one or two '\n's. */ |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 379 | if (currmenu == MMAIN) { |
David Lawrence Ramsey | 23ed015 | 2006-06-19 16:04:42 +0000 | [diff] [blame] | 380 | size_t endis_len = strlen(_("enable/disable")); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 381 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 382 | for (s = sclist; s != NULL; s = s->next) |
Benno Schulenberg | 5bd359d | 2014-04-15 15:02:43 +0000 | [diff] [blame] | 383 | if (s->scfunc == do_toggle_void) |
Benno Schulenberg | 71c9a52 | 2014-05-13 20:14:01 +0000 | [diff] [blame] | 384 | allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 8; |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 385 | } |
| 386 | #endif |
| 387 | |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 388 | /* Allocate space for the help text. */ |
| 389 | help_text = charalloc(allocsize + 1); |
| 390 | |
| 391 | /* Now add the text we want. */ |
| 392 | strcpy(help_text, htx[0]); |
| 393 | if (htx[1] != NULL) |
| 394 | strcat(help_text, htx[1]); |
| 395 | if (htx[2] != NULL) |
| 396 | strcat(help_text, htx[2]); |
| 397 | |
| 398 | ptr = help_text + strlen(help_text); |
| 399 | |
Benno Schulenberg | a9aa0ef | 2015-08-16 08:43:56 +0000 | [diff] [blame] | 400 | /* Remember this end-of-introduction, start-of-shortcuts. */ |
| 401 | end_of_intro = ptr; |
| 402 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 403 | /* Now add our shortcut info. */ |
| 404 | for (f = allfuncs; f != NULL; f = f->next) { |
Benno Schulenberg | 5440796 | 2015-08-16 08:49:29 +0000 | [diff] [blame] | 405 | int scsfound = 0; |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 406 | |
Benno Schulenberg | 8f61511 | 2014-04-14 09:57:06 +0000 | [diff] [blame] | 407 | if ((f->menus & currmenu) == 0) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 408 | continue; |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 409 | |
Benno Schulenberg | cb7d11b | 2014-04-22 20:10:43 +0000 | [diff] [blame] | 410 | /* Let's simply show the first two shortcuts from the list. */ |
Benno Schulenberg | 5440796 | 2015-08-16 08:49:29 +0000 | [diff] [blame] | 411 | for (s = sclist; s != NULL; s = s->next) { |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 412 | |
Benno Schulenberg | 1f866c2 | 2015-07-15 20:13:05 +0000 | [diff] [blame] | 413 | if ((s->menus & currmenu) == 0) |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 414 | continue; |
| 415 | |
Benno Schulenberg | 8f61511 | 2014-04-14 09:57:06 +0000 | [diff] [blame] | 416 | if (s->scfunc == f->scfunc) { |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 417 | scsfound++; |
Benno Schulenberg | cb7d11b | 2014-04-22 20:10:43 +0000 | [diff] [blame] | 418 | /* Make the first column narrower (6) than the second (10), |
| 419 | * but allow it to spill into the second, for "M-Space". */ |
| 420 | if (scsfound == 1) { |
| 421 | sprintf(ptr, "%s ", s->keystr); |
Benno Schulenberg | 7a274d6 | 2016-10-12 12:21:44 +0200 | [diff] [blame] | 422 | /* Unicode arrows take three bytes instead of one. */ |
| 423 | if (s->keystr[1] == '\xE2') |
| 424 | ptr += 8; |
| 425 | else |
| 426 | ptr += 6; |
Benno Schulenberg | cb7d11b | 2014-04-22 20:10:43 +0000 | [diff] [blame] | 427 | } else { |
| 428 | ptr += sprintf(ptr, "(%s)\t", s->keystr); |
Benno Schulenberg | 3218771 | 2014-05-13 20:34:15 +0000 | [diff] [blame] | 429 | break; |
Benno Schulenberg | cb7d11b | 2014-04-22 20:10:43 +0000 | [diff] [blame] | 430 | } |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 431 | } |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 432 | } |
Benno Schulenberg | cb7d11b | 2014-04-22 20:10:43 +0000 | [diff] [blame] | 433 | |
| 434 | if (scsfound == 0) |
| 435 | ptr += sprintf(ptr, "\t\t"); |
| 436 | else if (scsfound == 1) |
| 437 | ptr += 10; |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 438 | |
David Lawrence Ramsey | 23ed015 | 2006-06-19 16:04:42 +0000 | [diff] [blame] | 439 | /* The shortcut's help text. */ |
Chris Allegretta | d3659f8 | 2008-03-16 23:57:14 +0000 | [diff] [blame] | 440 | ptr += sprintf(ptr, "%s\n", _(f->help)); |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 441 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 442 | if (f->blank_after) |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 443 | ptr += sprintf(ptr, "\n"); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 444 | } |
| 445 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 446 | #ifndef NANO_TINY |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 447 | /* And the toggles... */ |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 448 | if (currmenu == MMAIN) { |
| 449 | int maximum = 0, counter = 0; |
| 450 | |
| 451 | /* First see how many toggles there are. */ |
Benno Schulenberg | 6095ff3 | 2015-07-06 19:17:27 +0000 | [diff] [blame] | 452 | for (s = sclist; s != NULL; s = s->next) |
Benno Schulenberg | 17cf833 | 2016-05-30 09:09:36 +0200 | [diff] [blame] | 453 | maximum = (s->toggle && s->ordinal > maximum) ? s->ordinal : maximum; |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 454 | |
| 455 | /* Now show them in the original order. */ |
| 456 | while (counter < maximum) { |
| 457 | counter++; |
Benno Schulenberg | 6095ff3 | 2015-07-06 19:17:27 +0000 | [diff] [blame] | 458 | for (s = sclist; s != NULL; s = s->next) |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 459 | if (s->toggle && s->ordinal == counter) { |
Benno Schulenberg | 1f866c2 | 2015-07-15 20:13:05 +0000 | [diff] [blame] | 460 | ptr += sprintf(ptr, "%s\t\t%s %s\n", (s->menus == MMAIN ? s->keystr : ""), |
Benno Schulenberg | 17cf833 | 2016-05-30 09:09:36 +0200 | [diff] [blame] | 461 | _(flagtostr(s->toggle)), _("enable/disable")); |
Benno Schulenberg | 6095ff3 | 2015-07-06 19:17:27 +0000 | [diff] [blame] | 462 | if (s->toggle == NO_COLOR_SYNTAX || s->toggle == TABS_TO_SPACES) |
| 463 | ptr += sprintf(ptr, "\n"); |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 464 | break; |
Benno Schulenberg | 6095ff3 | 2015-07-06 19:17:27 +0000 | [diff] [blame] | 465 | } |
Benno Schulenberg | 5ac6a87 | 2015-07-06 17:51:17 +0000 | [diff] [blame] | 466 | } |
| 467 | } |
David Lawrence Ramsey | 1df3e2d | 2006-04-22 19:45:26 +0000 | [diff] [blame] | 468 | |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 469 | if (old_whitespace) |
| 470 | SET(WHITESPACE_DISPLAY); |
Benno Schulenberg | 71c9a52 | 2014-05-13 20:14:01 +0000 | [diff] [blame] | 471 | #endif /* !NANO_TINY */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 472 | |
Benno Schulenberg | 86bbe50 | 2015-08-16 17:53:28 +0000 | [diff] [blame] | 473 | /* If all went well, we didn't overwrite the allocated space. */ |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 474 | assert(strlen(help_text) <= allocsize + 1); |
| 475 | } |
| 476 | |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 477 | /* Return the function that is bound to the given key, accepting certain |
| 478 | * plain characters too, for consistency with the file browser. */ |
| 479 | functionptrtype parse_help_input(int *kbinput) |
David Lawrence Ramsey | bc80cb1 | 2006-04-24 23:03:21 +0000 | [diff] [blame] | 480 | { |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 481 | if (!meta_key) { |
David Lawrence Ramsey | bc80cb1 | 2006-04-24 23:03:21 +0000 | [diff] [blame] | 482 | switch (*kbinput) { |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 483 | case ' ': |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 484 | return do_page_down; |
David Lawrence Ramsey | cf1879b | 2006-04-27 23:39:49 +0000 | [diff] [blame] | 485 | case '-': |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 486 | return do_page_up; |
David Lawrence Ramsey | 1755e28 | 2006-10-02 21:25:41 +0000 | [diff] [blame] | 487 | case 'E': |
| 488 | case 'e': |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 489 | return do_exit; |
David Lawrence Ramsey | bc80cb1 | 2006-04-24 23:03:21 +0000 | [diff] [blame] | 490 | } |
| 491 | } |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 492 | return func_from_key(kbinput); |
David Lawrence Ramsey | bc80cb1 | 2006-04-24 23:03:21 +0000 | [diff] [blame] | 493 | } |
| 494 | |
Benno Schulenberg | 427eff6 | 2015-08-16 09:14:42 +0000 | [diff] [blame] | 495 | /* Calculate the displayable length of the help-text line starting at ptr. */ |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 496 | size_t help_line_len(const char *ptr) |
| 497 | { |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 498 | size_t wrapping_point = (COLS > 24) ? COLS - 1 : 24; |
Benno Schulenberg | a9aa0ef | 2015-08-16 08:43:56 +0000 | [diff] [blame] | 499 | /* The target width for wrapping long lines. */ |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 500 | ssize_t wrap_location; |
| 501 | /* Actual position where the line can be wrapped. */ |
| 502 | size_t length = 0; |
| 503 | /* Full length of the line, until the first newline. */ |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 504 | |
Benno Schulenberg | a9aa0ef | 2015-08-16 08:43:56 +0000 | [diff] [blame] | 505 | /* Avoid overwide paragraphs in the introductory text. */ |
| 506 | if (ptr < end_of_intro && COLS > 74) |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 507 | wrapping_point = 74; |
Benno Schulenberg | a9aa0ef | 2015-08-16 08:43:56 +0000 | [diff] [blame] | 508 | |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 509 | wrap_location = break_line(ptr, wrapping_point, TRUE); |
Benno Schulenberg | 9e438cd | 2015-08-16 12:15:11 +0000 | [diff] [blame] | 510 | |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 511 | /* Get the length of the entire line up to a null or a newline. */ |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 512 | while (*(ptr + length) != '\0' && *(ptr + length) != '\n') |
| 513 | length = move_mbright(ptr, length); |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 514 | |
Benno Schulenberg | a5b2953 | 2015-08-16 12:20:24 +0000 | [diff] [blame] | 515 | /* If the entire line will just fit the screen, don't wrap it. */ |
| 516 | if (strnlenpt(ptr, length) <= wrapping_point + 1) |
| 517 | return length; |
| 518 | else if (wrap_location > 0) |
| 519 | return wrap_location; |
| 520 | else |
| 521 | return 0; |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 522 | } |
| 523 | |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 524 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 525 | |
Benno Schulenberg | 7a1959f | 2015-08-16 09:28:33 +0000 | [diff] [blame] | 526 | /* Start the help viewer. */ |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 527 | void do_help_void(void) |
| 528 | { |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 529 | #ifndef DISABLE_HELP |
Benno Schulenberg | 7a1959f | 2015-08-16 09:28:33 +0000 | [diff] [blame] | 530 | do_help(); |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 531 | #else |
| 532 | if (currmenu == MMAIN) |
Benno Schulenberg | 6847616 | 2015-07-30 18:10:16 +0000 | [diff] [blame] | 533 | say_there_is_no_help(); |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 534 | else |
| 535 | beep(); |
Benno Schulenberg | bb06fae | 2014-03-26 19:59:45 +0000 | [diff] [blame] | 536 | #endif /* !DISABLE_HELP */ |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 537 | } |