Adjusting some comments and whitespace.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5360 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-08-16 09:14:42 +00:00
parent 5440796f31
commit 427eff6780
2 changed files with 17 additions and 17 deletions

View File

@ -2,6 +2,7 @@
* src/help.c (help_init, help_line_len): Avoid wide paragraphs of text * src/help.c (help_init, help_line_len): Avoid wide paragraphs of text
in the help screens: wrap them at 74 columns if the screen is wider. in the help screens: wrap them at 74 columns if the screen is wider.
* src/help.c (help_init): Reduce the scope of a variable. * src/help.c (help_init): Reduce the scope of a variable.
* src/help.c: Adjust some comments and whitespace.
2015-08-13 Benno Schulenberg <bensberg@justemail.net> 2015-08-13 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_find_bracket): Remove mistaken comparison between * src/search.c (do_find_bracket): Remove mistaken comparison between

View File

@ -79,9 +79,9 @@ void do_help(void (*refresh_func)(void))
while (TRUE) { while (TRUE) {
size_t i; size_t i;
/* Get the last line of the help text. */
ptr = help_text; ptr = help_text;
/* Find the line number of the last line of the help text. */
for (last_line = 0; *ptr != '\0'; last_line++) { for (last_line = 0; *ptr != '\0'; last_line++) {
ptr += help_line_len(ptr); ptr += help_line_len(ptr);
if (*ptr == '\n') if (*ptr == '\n')
@ -91,21 +91,20 @@ void do_help(void (*refresh_func)(void))
if (last_line > 0) if (last_line > 0)
last_line--; last_line--;
/* Display the help text if we don't have a key, or if the help /* Redisplay if the text was scrolled or an invalid key was pressed. */
* text has moved. */ if (line != old_line || kbinput == ERR) {
if (kbinput == ERR || line != old_line) {
blank_edit(); blank_edit();
ptr = help_text; ptr = help_text;
/* Calculate where in the text we should be, based on the /* Advance in the text to the first line to be displayed. */
* page. */
for (i = 0; i < line; i++) { for (i = 0; i < line; i++) {
ptr += help_line_len(ptr); ptr += help_line_len(ptr);
if (*ptr == '\n') if (*ptr == '\n')
ptr++; ptr++;
} }
/* Now display as many lines as the window will hold. */
for (i = 0; i < editwinrows && *ptr != '\0'; i++) { for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
size_t j = help_line_len(ptr); size_t j = help_line_len(ptr);
@ -126,7 +125,7 @@ void do_help(void (*refresh_func)(void))
if (kbinput == KEY_WINCH) { if (kbinput == KEY_WINCH) {
kbinput = ERR; kbinput = ERR;
curs_set(0); curs_set(0);
continue; continue; /* Redraw the screen. */
} }
#endif #endif
@ -162,7 +161,7 @@ void do_help(void (*refresh_func)(void))
if (line + (editwinrows - 1) < last_line) if (line + (editwinrows - 1) < last_line)
line = last_line - (editwinrows - 1); line = last_line - (editwinrows - 1);
} else if (func == do_exit) { } else if (func == do_exit) {
/* Exit from the help browser. */ /* Exit from the help viewer. */
break; break;
} }
} }
@ -190,11 +189,11 @@ void do_help(void (*refresh_func)(void))
* help_text should be NULL initially. */ * help_text should be NULL initially. */
void help_init(void) void help_init(void)
{ {
size_t allocsize = 0; /* Space needed for help_text. */ size_t allocsize = 0;
const char *htx[3]; /* Untranslated help message. We break /* Space needed for help_text. */
* it up into three chunks in case the const char *htx[3];
* full string is too long for the /* Untranslated help introduction. We break it up into three chunks
* compiler to handle. */ * in case the full string is too long for the compiler to handle. */
char *ptr; char *ptr;
const subnfunc *f; const subnfunc *f;
const sc *s; const sc *s;
@ -494,7 +493,7 @@ functionptrtype parse_help_input(int *kbinput)
return func_from_key(kbinput); return func_from_key(kbinput);
} }
/* Calculate the next line of help_text, starting at ptr. */ /* Calculate the displayable length of the help-text line starting at ptr. */
size_t help_line_len(const char *ptr) size_t help_line_len(const char *ptr)
{ {
int help_cols = (COLS > 24) ? COLS - 1 : 24; int help_cols = (COLS > 24) ? COLS - 1 : 24;