From af4115ce2b5ad731cb0fdecd3a44f9cc5a210ebd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 3 Feb 2026 08:50:27 +0800 Subject: [PATCH] test(tty-test): enable VTI and VTP on Windows (#37677) --- test/functional/fixtures/tty-test.c | 11 +++++++++++ test/functional/terminal/altscreen_spec.lua | 12 +++++++----- test/functional/terminal/cursor_spec.lua | 7 ------- test/functional/terminal/highlight_spec.lua | 8 -------- test/functional/terminal/mouse_spec.lua | 2 -- test/functional/terminal/window_spec.lua | 1 - 6 files changed, 18 insertions(+), 23 deletions(-) diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c index f94af2fd12..5323bdd9d8 100644 --- a/test/functional/fixtures/tty-test.c +++ b/test/functional/fixtures/tty-test.c @@ -175,6 +175,17 @@ int main(int argc, char **argv) uv_tty_get_winsize(&tty_out, &width, &height); #endif uv_tty_set_mode(&tty, UV_TTY_MODE_RAW); +#ifdef MSWIN + DWORD dwMode; + if (GetConsoleMode(tty.handle, &dwMode)) { + dwMode |= ENABLE_VIRTUAL_TERMINAL_INPUT; + SetConsoleMode(tty.handle, dwMode); + } + if (GetConsoleMode(tty_out.handle, &dwMode)) { + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(tty_out.handle, dwMode); + } +#endif tty.data = &interrupted; uv_read_start((uv_stream_t *)&tty, alloc_cb, read_cb); #ifndef MSWIN diff --git a/test/functional/terminal/altscreen_spec.lua b/test/functional/terminal/altscreen_spec.lua index 631f7af7f8..2216044710 100644 --- a/test/functional/terminal/altscreen_spec.lua +++ b/test/functional/terminal/altscreen_spec.lua @@ -8,10 +8,6 @@ local feed_data = tt.feed_data local enter_altscreen = tt.enter_altscreen local exit_altscreen = tt.exit_altscreen -if t.skip(t.is_os('win')) then - return -end - describe(':terminal altscreen', function() local screen @@ -156,7 +152,13 @@ describe(':terminal altscreen', function() end) it('restore buffer state', function() - screen:expect([[ + screen:expect(t.is_os('win') and [[ + line6 | + line7 | + line8 | + ^ | + {5:-- TERMINAL --} | + ]] or [[ line5 | line6 | line7 | diff --git a/test/functional/terminal/cursor_spec.lua b/test/functional/terminal/cursor_spec.lua index 4835b939f5..8b22695719 100644 --- a/test/functional/terminal/cursor_spec.lua +++ b/test/functional/terminal/cursor_spec.lua @@ -96,7 +96,6 @@ describe(':terminal cursor', function() describe('when invisible', function() it('is not highlighted', function() - skip(is_os('win'), '#31587') hide_cursor() screen:expect([[ tty ready | @@ -123,7 +122,6 @@ describe(':terminal cursor', function() end) it('becomes visible when exiting Terminal mode', function() - skip(is_os('win'), '#31587') hide_cursor() screen:expect([[ tty ready | @@ -182,7 +180,6 @@ describe(':terminal cursor', function() end) it('becomes visible on TermLeave if hidden immediately by events #32456', function() - skip(is_os('win'), '#31587') -- Reproducing the issue is quite fragile; it's easiest done in a lone test case like this -- with no prior commands. feed([[]]) @@ -213,8 +210,6 @@ describe(':terminal cursor', function() end) it('can be modified by application #3681 #31685', function() - skip(is_os('win'), '#31587') - local states = { [1] = { blink = true, shape = 'block' }, [2] = { blink = false, shape = 'block' }, @@ -269,8 +264,6 @@ describe(':terminal cursor', function() end) it('can be modified per terminal', function() - skip(is_os('win'), '#31587') - -- Set cursor to vertical bar with blink tt.feed_csi('5 q') screen:expect({ diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 39d0581543..7f32682a8a 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -58,7 +58,6 @@ describe(':terminal highlight', function() end) local function pass_attrs() - skip(is_os('win')) screen:expect(sub([[ tty ready | {NUM:text}text^ | @@ -70,7 +69,6 @@ describe(':terminal highlight', function() it('will pass the corresponding attributes', pass_attrs) it('will pass the corresponding attributes on scrollback', function() - skip(is_os('win')) pass_attrs() local lines = {} for i = 1, 8 do @@ -244,11 +242,6 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi | ]]) - -- Skip the rest of these tests on Windows #31587 - if is_os('win') then - return - end - -- CursorLine and CursorColumn are combined with terminal colors. tt.set_reverse() tt.feed_data(' foobar') @@ -357,7 +350,6 @@ local function test_term_hl_custom_palette(buflocal) end) it('will use the custom color with jobstart()', function() - skip(is_os('win')) command(("call jobstart(['%s'], {'term': v:true})"):format(testprg('tty-test'))) feed('i') screen:expect([[ diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 9c8b06937b..7e7469e30f 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -392,8 +392,6 @@ describe(':terminal mouse', function() end) it('mouse forwarding works with resized grid', function() - skip(is_os('win')) - screen:detach() local Screen = require('test.functional.ui.screen') screen = Screen.new(50, 7, { ext_multigrid = true }) diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index 7b891214a3..2847819500 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -336,7 +336,6 @@ describe(':terminal window', function() end) it('has correct topline if scrolled by events', function() - skip(is_os('win'), '#31587') local lines = {} for i = 1, 10 do table.insert(lines, 'cool line ' .. i)