diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 17:54:48 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 17:54:48 +0300 |
| commit | d505017cec86c000f891b003f5ca3481f5ffae61 (patch) | |
| tree | 90995e7f64e7115040764775a41171212b2de0ad | |
| parent | 4384435941b8c7658856b381d071aee2e0035e89 (diff) | |
term: fix the two Kitty suite failures and run the suite by default
Both failures were stale expectations in our copy of the suite.
8c2464c moved the terminal to xterm behavior and added spec tests for
it. The Kitty bridge did not compile then, so nobody updated the suite.
- A cursor report with a pending wrap gives the last column (1;5).
Kitty gives the start of the next line.
- HT only moves the cursor. Kitty writes a tab cell, which erases the
text under the tab. REP after the tab then repeats nothing.
The suite went weeks without running, because it needed
-Dkitty_tests=true. Now every unsanitized Linux build runs it in the
unit suite, and the main option only makes it mandatory. The README
lists the deliberate differences from Kitty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | meson.options | 8 | ||||
| -rw-r--r-- | tests/extern/README.md | 17 | ||||
| -rw-r--r-- | tests/extern/kitty/parser.py | 9 | ||||
| -rw-r--r-- | tests/meson.build | 14 |
4 files changed, 34 insertions, 14 deletions
diff --git a/meson.options b/meson.options index 27bc018..3a339a3 100644 --- a/meson.options +++ b/meson.options @@ -18,8 +18,8 @@ option( description: 'Seed count for write-fuzz-test', ) option( - 'kitty_tests', - type: 'boolean', - value: false, - description: 'Build the Linux Kitty parser compatibility tests (use an unsanitized build)', + 'kitty', + type: 'feature', + value: 'auto', + description: 'The Kitty parser compatibility tests. auto runs them on an unsanitized Linux build', ) diff --git a/tests/extern/README.md b/tests/extern/README.md index cff42ed..2a52e29 100644 --- a/tests/extern/README.md +++ b/tests/extern/README.md @@ -2,7 +2,9 @@ This directory holds test suites imported from external projects. These are kept for reference and cross-checking against our own terminal emulator's -behavior. On Linux, `make test` builds and runs the adapted Kitty parser suite. +behavior. Every unsanitized Linux build runs the adapted Kitty parser +suite with the unit tests. `-Dkitty_tests=true` makes a missing suite an +error. ## kitty/ @@ -35,9 +37,20 @@ Kitty parser test suite against it via a Python compatibility layer. ### Test status (14 tests) All 14 tests pass. Features implemented for Kitty parity include DEC -Special Graphics charset translation (G0/G1, SO/SI), literal `\t` cells, +Special Graphics charset translation (G0/G1, SO/SI), LNM-default-off linefeed semantics, CSI insert-character and REP edge cases, DECRQM mode reports, DECRQSS (DCS `$q`) and XTGETTCAP (DCS `+q`) responses, DECCARA/DECSACE (CSI `$r` / `*x`), secondary device attributes (CSI `=c`), XTWINOPS cell-size report (CSI `14t`), underline styles 0–5, and SGR underline color (58/59) including colon-form subparameters. + +### Deliberate differences from Kitty + +The terminal follows xterm in two places. `parser.py` checks the xterm +result there, with a comment at each check. + +- A cursor position report (CSI 6n) with a pending wrap reports the last + column. Kitty reports the first column of the next line. +- HT only moves the cursor. Kitty writes a tab cell and blanks the cells + it skips, so a tab erases the text under it. `spec-test` checks that a + tab does not erase. diff --git a/tests/extern/kitty/parser.py b/tests/extern/kitty/parser.py index 537e1c0..76357fd 100644 --- a/tests/extern/kitty/parser.py +++ b/tests/extern/kitty/parser.py @@ -757,7 +757,9 @@ class TestParser(BaseTest): pb('12345', '12345') c.clear() pb('\033[6n', ('report_device_status', 6, 0)) - self.ae(c.wtcbuf, b'\033[2;1R') + # A pending wrap reports the last column, as xterm does. Kitty + # reports the start of the next line. + self.ae(c.wtcbuf, b'\033[1;5R') c.clear() s.cursor_key_mode = True pb('\033[?1$p', ('report_mode_status', 1, 1)) @@ -815,8 +817,9 @@ class TestParser(BaseTest): self.ae(str(s.line(0)), ' ') s.reset() pb('\t\033[b', ('screen_tab',), ('screen_repeat_character', 1)) - # The terminal includes blank tab padding in its line text. - self.ae(str(s.line(0)).rstrip(' '), '\t') + # HT only moves the cursor, as in xterm. Kitty writes a tab cell + # there. REP then has no graphic character to repeat. + self.ae(str(s.line(0)), '') self.ae(s.cursor.x, 7) self.ae(s.cursor.y, 0) s.reset() diff --git a/tests/meson.build b/tests/meson.build index 42c442e..8372574 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -109,10 +109,14 @@ test('term-cross-test', bash, timeout: 600, ) -if get_option('kitty_tests') - if host_machine.system() != 'linux' or get_option('b_sanitize') != 'none' - error('Kitty tests require an unsanitized Linux build') - endif +# The bridge is a shared library that Python loads, so a sanitized build +# cannot run it. +kitty_tests = get_option('kitty').require( + host_machine.system() == 'linux' and get_option('b_sanitize') == 'none', + error_message: 'The Kitty tests need an unsanitized Linux build', +) +term_kitty_tests = kitty_tests.allowed() +if term_kitty_tests kitty_bridge = shared_library('term', 'extern/kitty/screen_bridge.c', dependencies: term_internal_dep, ) @@ -122,7 +126,7 @@ if get_option('kitty_tests') args: files('extern/kitty/parser.py'), depends: kitty_bridge, env: kitty_env, - suite: 'kitty', + suite: ['unit', 'kitty'], is_parallel: false, ) endif |
