test(tui_spec): doesn't use Unicode in cursor_address test (#21703)

Using Unicode makes the test flaky because of #16245.
This commit is contained in:
zeertzjq 2023-01-09 17:02:45 +08:00 committed by GitHub
parent c19bd47c0a
commit 53adccb6e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1437,33 +1437,33 @@ describe('TUI', function()
end) end)
it('draws correctly when cursor_address overflows #21643', function() it('draws correctly when cursor_address overflows #21643', function()
helpers.skip(helpers.is_ci('github'), 'FIXME: flaky on GitHub CI') helpers.skip(helpers.is_os('mac'), 'FIXME: crashes/errors on macOS')
screen:try_resize(75, 60) screen:try_resize(77, 834)
retry(nil, nil, function() retry(nil, nil, function()
eq({true, 57}, {child_session:request('nvim_win_get_height', 0)}) eq({true, 831}, {child_session:request('nvim_win_get_height', 0)})
end) end)
-- The composing character takes 3 bytes. -- Use full screen message so that redrawing afterwards is more deterministic.
local composing = ('a︠'):sub(2) child_session:notify('nvim_command', 'intro')
-- The composed character takes 1 + 5 * 3 = 16 bytes. screen:expect({any = 'Nvim'})
local c = 'a' .. composing:rep(5)
-- Going to top-left corner needs 3 bytes. -- Going to top-left corner needs 3 bytes.
-- Setting underline attribute needs 9 bytes. -- Setting underline attribute needs 9 bytes.
-- With screen width 75, 4088 characters need 54 full screen lines. -- With screen width 77, 63857 characters need 829 full screen lines.
-- Drawing each full screen line needs 75 * 16 + 2 = 1202 bytes (2 bytes for CR LF). -- Drawing each full screen line needs 77 + 2 = 79 bytes (2 bytes for CR LF).
-- The incomplete screen line needs 38 * 16 + 1 + 3 = 612 bytes. -- The incomplete screen line needs 24 + 3 = 27 bytes.
-- The whole line needs 3 + 9 + 54 * 1202 + 612 = 65532 bytes. -- The whole line needs 3 + 9 + 79 * 829 + 27 = 65530 bytes.
-- The cursor_address that comes after will overflow the 65535-byte buffer. -- The cursor_address that comes after will overflow the 65535-byte buffer.
local line = c:rep(4088) .. 'b' local line = ('a'):rep(63857) .. ''
child_session:request('nvim_exec_lua', [[ child_session:notify('nvim_exec_lua', [[
vim.api.nvim_buf_set_lines(0, 0, -1, true, {...}) vim.api.nvim_buf_set_lines(0, 0, -1, true, {...})
vim.o.cursorline = true vim.o.cursorline = true
]], {line, 'c'}) ]], {line, 'b'})
-- Close the :intro message and redraw the lines.
feed_data('\n')
screen:expect( screen:expect(
'{13:' .. c .. '}{12:' .. c:rep(74) .. '}|\n' '{13:a}{12:' .. ('a'):rep(76) .. '}|\n'
.. ('{12:' .. c:rep(75) .. '}|\n'):rep(53) .. ('{12:' .. ('a'):rep(77) .. '}|\n'):rep(828)
.. '{12:' .. c:rep(38) .. 'b℃' .. (' '):rep(35) .. '}|\n' .. dedent([[ .. '{12:' .. ('a'):rep(24) .. '' .. (' '):rep(52) .. '}|\n' .. dedent([[
c | b |
{4:~ }|
{5:[No Name] [+] }| {5:[No Name] [+] }|
| |
{3:-- TERMINAL --} |]])) {3:-- TERMINAL --} |]]))