Skip to content

Terminal doesn't handle split UTF-8 sequence after ASCII#19337

Open
zeertzjq wants to merge 1 commit intovim:masterfrom
zeertzjq:vterm-utf8
Open

Terminal doesn't handle split UTF-8 sequence after ASCII#19337
zeertzjq wants to merge 1 commit intovim:masterfrom
zeertzjq:vterm-utf8

Conversation

@zeertzjq
Copy link
Member

@zeertzjq zeertzjq commented Feb 5, 2026

Problem: Terminal doesn't handle split UTF-8 sequence after ASCII.
Solution: Only use one UTF-8 encoding state per vterm state.

fixes: #16559

@zeertzjq zeertzjq changed the title Terminal doesn't handle split UTF-8 sequence Terminal doesn't handle split UTF-8 sequence after ASCII Feb 5, 2026
@zeertzjq zeertzjq force-pushed the vterm-utf8 branch 3 times, most recently from aebde01 to 9401a68 Compare February 5, 2026 09:10
@zeertzjq
Copy link
Member Author

zeertzjq commented Feb 5, 2026

This doesn't break any existing libvterm tests. I tried to add new a libvterm test case:

diff --git a/src/libvterm/t/14state_encoding.test b/src/libvterm/t/14state_encoding.test
index b1f5d6985..2c95066ed 100644
--- a/src/libvterm/t/14state_encoding.test
+++ b/src/libvterm/t/14state_encoding.test
@@ -103,3 +103,12 @@ PUSH "AB\xc4\x88D"
   putglyph 0x0042 1 0,1
   putglyph 0x0108 1 0,2
   putglyph 0x0044 1 0,3
+
+!Split UTF-8 after US-ASCII
+RESET
+PUSH "\e(BAB\xc4"
+  putglyph 0x0041 1 0,0
+  putglyph 0x0042 1 0,1
+PUSH "\x88D"
+  putglyph 0x0108 1 0,2
+  putglyph 0x0044 1 0,3

but it passes even without the patch.

The added test case in test_terminal3.vim does fail without the patch.

@zeertzjq
Copy link
Member Author

zeertzjq commented Feb 5, 2026

Oh, removing the \e(B seems to make the test case fail without the patch. I'll add the test case to the PR.

@zeertzjq zeertzjq force-pushed the vterm-utf8 branch 4 times, most recently from eb7c28b to 2371982 Compare February 5, 2026 10:43
Problem:  Terminal doesn't handle split UTF-8 sequence after ASCII.
Solution: Only use one UTF-8 encoding state per vterm state.

fixes: vim#16559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vim terminal does not properly handle emojis if output was delayed

1 participant