mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
test(ui/embed_spec): use notification instead of request (#25555)
This avoid the hang mentioned in #24888, and also matches TUI better.
This commit is contained in:
parent
dadc06ced2
commit
f96f8566b5
@ -98,6 +98,7 @@ describe('--embed UI', function()
|
||||
|
||||
-- attach immediately after startup, for early UI
|
||||
local screen = Screen.new(40, 8)
|
||||
screen.rpc_async = true -- Avoid hanging. #24888
|
||||
screen:attach {stdin_fd=3}
|
||||
screen:set_default_attr_ids {
|
||||
[1] = {bold = true, foreground = Screen.colors.Blue1};
|
||||
|
@ -150,6 +150,7 @@ function Screen.new(width, height)
|
||||
msg_grid = nil,
|
||||
msg_grid_pos = nil,
|
||||
_session = nil,
|
||||
rpc_async = false,
|
||||
messages = {},
|
||||
msg_history = {},
|
||||
showmode = {},
|
||||
@ -173,9 +174,13 @@ function Screen.new(width, height)
|
||||
_busy = false,
|
||||
}, Screen)
|
||||
local function ui(method, ...)
|
||||
local status, rv = self._session:request('nvim_ui_'..method, ...)
|
||||
if not status then
|
||||
error(rv[2])
|
||||
if self.rpc_async then
|
||||
self._session:notify('nvim_ui_'..method, ...)
|
||||
else
|
||||
local status, rv = self._session:request('nvim_ui_'..method, ...)
|
||||
if not status then
|
||||
error(rv[2])
|
||||
end
|
||||
end
|
||||
end
|
||||
self.uimeths = create_callindex(ui)
|
||||
|
Loading…
Reference in New Issue
Block a user