+2015-08-16 Benno Schulenberg <bensberg@justemail.net>
+ * 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.
+
2015-08-13 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_find_bracket): Remove mistaken comparison between
pointer and literal character. Found with cppcheck.
static char *help_text = NULL;
/* The text displayed in the help window. */
+static char *end_of_intro = NULL;
+ /* The point in the help text where the introductory paragraphs end
+ * and the shortcut descriptions begin. */
+
/* Our main help browser function. refresh_func is the function we will
* call to refresh the edit window. */
void do_help(void (*refresh_func)(void))
ptr = help_text + strlen(help_text);
+ /* Remember this end-of-introduction, start-of-shortcuts. */
+ end_of_intro = ptr;
+
/* Now add our shortcut info. */
for (f = allfuncs; f != NULL; f = f->next) {
size_t help_line_len(const char *ptr)
{
int help_cols = (COLS > 24) ? COLS - 1 : 24;
+ /* The target width for wrapping long lines. */
+
+ /* Avoid overwide paragraphs in the introductory text. */
+ if (ptr < end_of_intro && COLS > 74)
+ help_cols = 74;
- /* Try to break the line at (COLS - 1) columns if we have more than
- * 24 columns, and at 24 columns otherwise. */
ssize_t wrap_loc = break_line(ptr, help_cols, TRUE);
size_t retval = (wrap_loc < 0) ? 0 : wrap_loc;
size_t retval_save = retval;