Commit: patch 9.2.0964: 'isprint' is applied to the leading byte of a character

5 views
Skip to first unread message

Christian Brabandt

unread,
Aug 17, 2026, 4:45:17 PM (18 hours ago) Aug 17
to vim...@googlegroups.com
patch 9.2.0964: 'isprint' is applied to the leading byte of a character

Commit: https://github.com/vim/vim/commit/2e6a408f3bc2b5dd83f883c56729cf57fe520762
Author: Hirohito Higashi <h.eas...@gmail.com>
Date: Mon Aug 17 20:35:13 2026 +0000

patch 9.2.0964: 'isprint' is applied to the leading byte of a character

Problem: Excluding a value with 'isprint' also breaks the display of
unrelated characters whose leading byte has that value. After
":set isprint+=^226" the character U+222B is displayed as "<"
(Emilien Breton).
Solution: Apply 'isprint' to the character value only, not to the leading
byte of its UTF-8 encoding (Hirohito Higashi).

fixes: #21053
closes: #21055

Co-Authored-By: Claude Opus 5 (1M context) <nor...@anthropic.com>
Signed-off-by: Hirohito Higashi <h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/drawline.c b/src/drawline.c
index c799291ba..edd5ef6ea 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -3325,8 +3325,9 @@ win_line(
}
}

- // Handling of non-printable characters.
- if (!vim_isprintc(c))
+ // Handling of non-printable characters. 'isprint' does not apply
+ // to a UTF-8 leading byte, the character was checked above.
+ if (!vim_isprintc(c) && !(enc_utf8 && c >= 0x80))
{
// when getting a character from the file, we may have to
// turn it into something else on the way to putting it
diff --git a/src/testdir/test_utf8.vim b/src/testdir/test_utf8.vim
index 3070d4cc4..34bd9a801 100644
--- a/src/testdir/test_utf8.vim
+++ b/src/testdir/test_utf8.vim
@@ -388,4 +388,22 @@ func Test_overlong_utf8_cells()
bwipe!
endfunc

+func Test_isprint_leading_byte()
+ new
+ let save_isprint = &isprint
+ " 226 is the leading byte of U+222B, which must not be affected.
+ set isprint+=^226
+ call setline(1, "∫")
+ redraw
+ call assert_equal("∫", ScreenLines(1, 1)[0])
+
+ " U+00E2 has the character value 226 and is still excluded.
+ call setline(1, "â")
+ redraw
+ call assert_equal('<e2>', ScreenLines(1, 4)[0])
+
+ let &isprint = save_isprint
+ bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 56e866a62..bd636ef46 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 964,
/**/
963,
/**/
Reply all
Reply to author
Forward
0 new messages