diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-02-17 11:32:18 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-02-22 21:15:16 +0100 |
commit | d3dc94615523a71606edcbe6bf528f8b49a78c7d (patch) | |
tree | d7a530ea641fc0959154ca508085f40d7d82349c /test | |
parent | 6bd6927656500c50787b16de1fadf1bc46b7aefa (diff) | |
download | rneovim-d3dc94615523a71606edcbe6bf528f8b49a78c7d.tar.gz rneovim-d3dc94615523a71606edcbe6bf528f8b49a78c7d.tar.bz2 rneovim-d3dc94615523a71606edcbe6bf528f8b49a78c7d.zip |
TUI: rework background-color detection
- Like Vim, use set_option_value() followed by reset_option_was_set().
- Do not use set_string_default(), so the default is predictable.
This affects `:set bg&`.
- Wait until end-of-startup (VimEnter) to handle the response. The
response is racey anyways, so timing is irrelevant. This allows
OptionSet to be triggered, unlike during startup.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 70356b7e2d..a0adb45630 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -836,6 +836,28 @@ describe('TUI background color', function() ..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]') end) + it("triggers OptionSet event on terminal-response", function() + feed_data('\027:autocmd OptionSet background echo "did OptionSet, yay!"\n') + + -- The child Nvim is running asynchronously; wait for it to register the + -- OptionSet handler. + feed_data('\027:autocmd OptionSet\n') + screen:expect({any='--- Autocommands ---'}) + + feed_data('\012') -- CTRL-L: clear the screen + screen:expect([[ + {1: } | + {4:~ }| + {4:~ }| + {4:~ }| + {5:[No Name] 0,0-1 All}| + | + {3:-- TERMINAL --} | + ]]) + feed_data('\027]11;rgb:ffff/ffff/ffff\007') + screen:expect{any='did OptionSet, yay!'} + end) + local function assert_bg(color, bg) it('handles '..color..' as '..bg, function() feed_data('\027]11;rgb:'..color..'\007:echo &background\n') |