commit db2e5f46f5aa5a6300395eaa9c4923835683c770
parent 48ca1d4ce8c0a142e90e06b3cd37f1315c5eb715
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 1 Sep 2022 16:37:29 +0800
fix(lua): make ui_attach()/ui_detach() take effect immediately (#20037)
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
@@ -749,7 +749,7 @@ void ui_comp_add_cb(uint32_t ns_id, LuaRef cb, bool *ext_widgets)
*item = event_cb;
ui_comp_update_ext();
- ui_schedule_refresh();
+ ui_refresh();
}
void ui_comp_remove_cb(uint32_t ns_id)
@@ -759,5 +759,5 @@ void ui_comp_remove_cb(uint32_t ns_id)
pmap_del(uint32_t)(&ui_event_cbs, ns_id);
}
ui_comp_update_ext();
- ui_schedule_refresh();
+ ui_refresh();
}
diff --git a/test/functional/lua/ui_event_spec.lua b/test/functional/lua/ui_event_spec.lua
@@ -88,10 +88,12 @@ describe('vim.ui_attach', function()
{ "popupmenu_hide" };
}
- -- ui_detach stops events, and reenables builtin pum
- exec_lua [[ vim.ui_detach(ns) ]]
+ -- vim.ui_detach() stops events, and reenables builtin pum immediately
+ exec_lua [[
+ vim.ui_detach(ns)
+ vim.fn.complete(1, {'food', 'foobar', 'foo'})
+ ]]
- funcs.complete(1, {'food', 'foobar', 'foo'})
screen:expect{grid=[[
food^ |
{3:food }{1: }|
@@ -102,6 +104,5 @@ describe('vim.ui_attach', function()
expect_events {
}
-
end)
end)