test(tty-test): enable VTI and VTP on Windows (#37677)

This commit is contained in:
zeertzjq
2026-02-03 08:50:27 +08:00
committed by GitHub
parent 19eb75831b
commit af4115ce2b
6 changed files with 18 additions and 23 deletions

View File

@@ -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

View File

@@ -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 |

View File

@@ -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([[<C-\><C-N>]])
@@ -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({

View File

@@ -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([[

View File

@@ -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 })

View File

@@ -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)