help: do not break a line inside the 17-column keystrokes area

When the description of a keystroke starts with a very long word,
or when it does not contain any spaces at all (like for Chinese
and Japanese), do not break in the blanks before the description
but instead break IN the description, at the edge of the screen.

In other words: when wrapping a help text, do not consider blanks in
the first 17 columns to be blanks (unless it is a continuation line).

This fixes https://savannah.gnu.org/bugs/?57987.

Bug existed since version 4.8, commit 1486f32d,
when the wrapping of help texts was improved.
This commit is contained in:
Benno Schulenberg 2020-03-15 13:44:06 +01:00
parent 09042f5499
commit 16f17f3f1b
1 changed files with 3 additions and 2 deletions

View File

@ -1368,9 +1368,10 @@ ssize_t break_line(const char *textstart, ssize_t goal, bool snap_at_nl)
while (*pointer != '\0' && is_blank_char(pointer))
pointer += advance_over(pointer, &column);
/* Find the last blank that does not overshoot the target column. */
/* Find the last blank that does not overshoot the target column.
* When treating a help text, do not break in the keystrokes area. */
while (*pointer != '\0' && ((ssize_t)column <= goal)) {
if (is_blank_char(pointer))
if (is_blank_char(pointer) && (!inhelp || column > 17 || goal < 32))
lastblank = pointer;
#ifdef ENABLE_HELP
else if (snap_at_nl && *pointer == '\n') {