diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-16 20:55:06 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-16 20:57:10 +0100 |
commit | 6ce307e016880026a030b844e070a0c58f609f67 (patch) | |
tree | 1288ead55b63c7db1a971c12f45dcf4880c3dff6 /src/layout | |
parent | 64edbb578941737af7ecf64c35ba1db1d77e9f6b (diff) | |
download | chawan-6ce307e016880026a030b844e070a0c58f609f67.tar.gz |
layout: avoid wrapping on dash inside double-width lines
Without this we were wrapping on the last dash (if any) inside CJK sentences.
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/engine.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 7de2585e..a9dca1e6 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -647,6 +647,10 @@ proc checkWrap(ictx: var InlineContext, state: var InlineState, r: Rune) = state.prevrw = rw if ictx.word.str.len == 0: state.firstrw = rw + if rw >= 2: + # remove wrap opportunity, so we wrap properly on the last CJK char (instead + # of any dash inside CJK sentences) + ictx.wrappos = -1 case state.computed{"word-break"} of WORD_BREAK_NORMAL: if rw == 2 or ictx.wrappos != -1: # break on cjk and wrap opportunities |