From 2ebe376be2be7e19075d6d7467a1fdc8f85cd8a0 Mon Sep 17 00:00:00 2001 From: scgbckbone Date: Thu, 15 May 2025 10:03:47 +0200 Subject: [PATCH] word_wrap: if last character is double wide on Q move to next line --- shared/utils.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/shared/utils.py b/shared/utils.py index 8ebf1dff..7a264d37 100644 --- a/shared/utils.py +++ b/shared/utils.py @@ -483,13 +483,19 @@ def word_wrap(ln, w): if ch in DOUBLE_WIDE: ln_len += 1 else: - if (ln_len == w) and (ch in ".,:;"): - # boundary of allowed width - # if . or , allow one more character - # even if only half visible on Mk4 - # on Q it's OK as (CHARS_W-1) is used as w + if ln_len == w: + if ch in ".,:;": + # boundary of allowed width + # if one of .,:; is last -> allow one more character + # even if only half visible on Mk4 + # on Q it's OK as (CHARS_W-1) is used as w + sp = None + idx += 1 + else: + # Q: double wide char was last + # put on next line sp = None - idx += 1 + idx -= 1 break else: