From 178dd9181f40f29e9ca4d86241dfce6eababafc4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 19 Dec 2019 16:16:09 +0100 Subject: [PATCH] tweaks: slightly streamline the search for a possible wrapping point That is, elide an 'if' for the it-is-a-blank case. --- src/text.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/text.c b/src/text.c index 548f02ee..42efdbbc 100644 --- a/src/text.c +++ b/src/text.c @@ -1562,13 +1562,14 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl) /* Find the last blank that does not overshoot the target column. */ while (*line != '\0' && ((ssize_t)column <= goal)) { - if (is_blank_mbchar(line) || (snap_at_nl && *line == '\n')) { + if (is_blank_mbchar(line)) lastblank = index; - - if (*line == '\n') - break; +#ifdef ENABLE_HELP + else if (snap_at_nl && *line == '\n') { + lastblank = index; + break; } - +#endif charlen = advance_over(line, &column); line += charlen; index += charlen;