mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-03 22:25:57 +00:00
Add tests for strip_csi with multibyte
This commit is contained in:
parent
ebb733bad0
commit
0eaf44d33d
2 changed files with 3 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ strip_csi_(const char *title, char *buf, size_t bufsz) {
|
|||
} break;
|
||||
case IN_CSI: {
|
||||
if (!(('0' <= ch && ch <= '9') || ch == ';' || ch == ':')) {
|
||||
if (ch >= ' ' && ch != DEL) *(dest++) = ch;
|
||||
if (ch > DEL) *(dest++) = ch; // UTF-8 multibyte
|
||||
state = NORMAL;
|
||||
}
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -560,9 +560,10 @@ class TestDataTypes(BaseTest):
|
|||
def q(x, y=''):
|
||||
self.ae(y or x, strip_csi(x))
|
||||
q('test')
|
||||
q('a\x1bbc', 'ac')
|
||||
q('a\x1bbc', 'abc')
|
||||
q('a\x1b[bc', 'ac')
|
||||
q('a\x1b[12;34:43mbc', 'abc')
|
||||
q('a\x1b[12;34:43\U0001f638', 'a\U0001f638')
|
||||
|
||||
def test_single_key(self):
|
||||
from kitty.fast_data_types import GLFW_MOD_KITTY, GLFW_MOD_SHIFT, SingleKey
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue