diff options
author | Yuan Fu <casouri@gmail.com> | 2020-05-26 22:47:27 -0400 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2020-08-23 09:50:26 +0300 |
commit | 0d1ca2ac3805443690f3bcb6877251d9b74902c9 (patch) | |
tree | 442f68ac4ab9bacab33964d0a748c56c9baf30fe /lib/string.in.h | |
parent | 065ab1ba44e891e18c6468c94e7e734e20a7903b (diff) | |
download | emacs-0d1ca2ac3805443690f3bcb6877251d9b74902c9.tar.gz emacs-0d1ca2ac3805443690f3bcb6877251d9b74902c9.tar.bz2 emacs-0d1ca2ac3805443690f3bcb6877251d9b74902c9.zip |
Improve word wrapping for CJK characters
Note about the change around line 9257 and 23372:
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.
Diffstat (limited to 'lib/string.in.h')
0 files changed, 0 insertions, 0 deletions