aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-03-06 16:50:27 +0100
committerLuuk van Baal <luukvbaal@gmail.com>2023-03-08 12:35:33 +0100
commit1fb585a9db32ddfa563328a4ffb18b6f1e1dec1e (patch)
treef7ff11c04a0357f892e7f9617a2f34b0c1a1b936
parent32ef36cb8739b056cfaed77f7ebaad9335d64624 (diff)
downloadrneovim-1fb585a9db32ddfa563328a4ffb18b6f1e1dec1e.tar.gz
rneovim-1fb585a9db32ddfa563328a4ffb18b6f1e1dec1e.tar.bz2
rneovim-1fb585a9db32ddfa563328a4ffb18b6f1e1dec1e.zip
test(statusline): UI elements are not redrawn on K_EVENT unnecessarily
-rw-r--r--test/functional/ui/statusline_spec.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index 1c184ff27d..c59ade0e31 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -10,6 +10,7 @@ local meths = helpers.meths
local exec = helpers.exec
local exec_lua = helpers.exec_lua
local eval = helpers.eval
+local sleep = helpers.sleep
describe('statusline clicks', function()
local screen
@@ -589,3 +590,35 @@ it('showcmdloc=statusline does not show if statusline is too narrow', function()
feed('1234')
screen:expect_unchanged()
end)
+
+it('K_EVENT does not trigger a statusline redraw unnecessarily', function()
+ clear()
+ local screen = Screen.new(40, 8)
+ screen:attach()
+ -- does not redraw on vim.schedule (#17937)
+ command([[
+ set laststatus=2
+ let g:counter = 0
+ func Status()
+ let g:counter += 1
+ lua vim.schedule(function() end)
+ return g:counter
+ endfunc
+ set statusline=%!Status()
+ ]])
+ sleep(50)
+ eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
+ -- also in insert mode
+ feed('i')
+ sleep(50)
+ eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
+ -- does not redraw on timer call (#14303)
+ command([[
+ let g:counter = 0
+ func Timer(timer)
+ endfunc
+ call timer_start(1, 'Timer', {'repeat': 100})
+ ]])
+ sleep(50)
+ eq(1, eval('g:counter < 50'), 'g:counter=' .. eval('g:counter'))
+end)