tweaks: optimize the trimming of trailing whitespace

When justifying a paragraph, always first squeeze() is called on
the text (which at that moment consists of a single long line),
which means that (in its wrappable part) this line contains only
single spaces as word separators (and maybe a double space after
a period).  So there is no need to call the general is_blank()
function -- checking for a space is enough.
master
Benno Schulenberg 2019-12-19 12:07:36 +01:00
parent ed520c89bc
commit d30ca576b7
1 changed files with 2 additions and 3 deletions

View File

@ -1854,10 +1854,9 @@ void rewrap_paragraph(linestruct **line, char *lead_string, size_t lead_len)
strncpy((*line)->next->data, lead_string, lead_len);
strcpy((*line)->next->data + lead_len, (*line)->data + break_pos);
/* When requested, snip all trailing blanks. */
/* When requested, snip the one or two trailing spaces. */
if (ISSET(TRIM_BLANKS)) {
while (break_pos > 0 &&
is_blank_mbchar(&(*line)->data[break_pos - 1]))
while (break_pos > 0 && (*line)->data[break_pos - 1] == ' ')
break_pos--;
}