Before, the test for whitespace checks for can_wrap_before and
can_wrap_after simutaniously. Now we separate these two checks, and
the logic needs to change a little bit. However, when we don't enable
the new wrapping feature, 'can_wrap_after' is equivalent to
'IT_DISPLAYING_WHITESPACE' and 'can_wrap_before' is equivalent to
'!IT_DISPLAYING_WHITESPACE'. And the new logic is equivalent with the
old one in that case.
Old logic:
if (whitespace) /* Which means can wrap after && can't wrap
before. */
may_wrap = true;
else if (may_wrap) /* aka (!whitespace && may_wrap)
(set wrap point) * aka (can't wrap after && can wrap before
may_wrap = false * && may_wrap)
*/
New logic:
if (can_wrap_after)
next_may_wrap = true
else
next_may_wrap = false;
if (may_wrap && can_wrap_before)
(set wrap point)
/* Update may_wrap. */
may_wrap = next_may_wrap;
* src/xdisp.c (it_char_has_category, char_can_wrap_before)
(char_can_wrap_after): New functions.
(move_it_in_display_line_to, display_line): Replace calls to
'IT_DISPLAYING_WHITESPACE' with either 'char_can_wrap_before' or
'char_can_wrap_after'.
(word-wrap-by-category): New variable.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): Add
'word-wrap-by-category' as a customizable variable.
* doc/emacs/display.texi (Visual Line Mode): Add a paragraph about the
new 'word-wrap-by-category' feature.
* etc/NEWS: Announce the change.