diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-11-11 22:15:19 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-11-14 12:40:57 +0100 |
commit | e61228a214ebda9845db9462dad0a8c362d3963f (patch) | |
tree | fc5908c85c0cc6affc3bc325cd75f6efaeea95d8 /test/functional/terminal/highlight_spec.lua | |
parent | 40dee8a2dcba996badaa6182eb34fde1694f92a3 (diff) | |
download | rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.tar.gz rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.tar.bz2 rneovim-e61228a214ebda9845db9462dad0a8c362d3963f.zip |
fix(tests): needing two calls to setup a screen is cringe
Before calling "attach" a screen object is just a dummy container for
(row, col) values whose purpose is to be sent as part of the "attach"
function call anyway.
Just create the screen in an attached state directly. Keep the complete
(row, col, options) config together. It is still completely valid to
later detach and re-attach as needed, including to another session.
Diffstat (limited to 'test/functional/terminal/highlight_spec.lua')
-rw-r--r-- | test/functional/terminal/highlight_spec.lua | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 05d68f6754..7822a27b93 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -17,7 +17,7 @@ describe(':terminal highlight', function() before_each(function() clear() - screen = Screen.new(50, 7) + screen = Screen.new(50, 7, { rgb = false }) screen:set_default_attr_ids({ [1] = { foreground = 45 }, [2] = { background = 46 }, @@ -33,7 +33,6 @@ describe(':terminal highlight', function() [12] = { bold = true, underdouble = true }, [13] = { italic = true, undercurl = true }, }) - screen:attach({ rgb = false }) command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') screen:expect([[ @@ -130,7 +129,7 @@ end) it(':terminal highlight has lower precedence than editor #9964', function() clear() - local screen = Screen.new(30, 4) + local screen = Screen.new(30, 4, { rgb = true }) screen:set_default_attr_ids({ -- "Normal" highlight emitted by the child nvim process. N_child = { @@ -150,7 +149,6 @@ it(':terminal highlight has lower precedence than editor #9964', function() bg_indexed = true, }, }) - screen:attach({ rgb = true }) -- Child nvim process in :terminal (with cterm colors). fn.termopen({ nvim_prog_abs(), @@ -202,7 +200,6 @@ it('CursorLine and CursorColumn work in :terminal buffer in Normal mode', functi [4] = { background = Screen.colors.Grey90, reverse = true }, [5] = { background = Screen.colors.Red }, }) - screen:attach() command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) screen:expect([[ ^tty ready | @@ -308,7 +305,6 @@ describe(':terminal highlight forwarding', function() [3] = { { fg_indexed = true, foreground = tonumber('0xe0e000') }, { foreground = 3 } }, [4] = { { foreground = tonumber('0xff8000') }, {} }, }) - screen:attach() command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') screen:expect([[ @@ -343,7 +339,7 @@ describe(':terminal highlight with custom palette', function() before_each(function() clear() - screen = Screen.new(50, 7) + screen = Screen.new(50, 7, { rgb = true }) screen:set_default_attr_ids({ [1] = { foreground = tonumber('0x123456') }, -- no fg_indexed when overridden [2] = { foreground = 12 }, @@ -354,7 +350,6 @@ describe(':terminal highlight with custom palette', function() [8] = { background = 11 }, [9] = { bold = true }, }) - screen:attach({ rgb = true }) api.nvim_set_var('terminal_color_3', '#123456') command(("enew | call termopen(['%s'])"):format(testprg('tty-test'))) feed('i') @@ -389,7 +384,6 @@ describe(':terminal', function() screen:add_extra_attr_ids { [100] = { url = 'https://example.com' }, } - screen:attach() local chan = api.nvim_open_term(0, {}) api.nvim_chan_send(chan, '\027]8;;https://example.com\027\\Example\027]8;;\027\\') screen:expect({ |