mirror of
https://github.com/neovim/neovim.git
synced 2026-04-28 18:24:13 +00:00
UI/nvim_ui_attach(): add override option
Before now, Nvim always degrades UI capabilities to the lowest-common
denominator. For example, if any connected UI has `ext_messages=false`
then `ext_messages=true` requested by any other connected UI is ignored.
Now `nvim_ui_attach()` supports `override=true`, which flips the
behavior: if any UI requests an `ext_*` UI capability then the
capability is enabled (and the legacy behavior is disabled).
Legacy UIs will be broken while a `override=true` UI is connected, but
it's useful for debugging: you can type into the TUI and observe the UI
events from another connected (UI) client. And the legacy UI will
"recover" after the `override=true` UI disconnects.
Example using pynvim:
>>> n.ui_attach(2048, 2048, rgb=True, override=True, ext_multigrid=True, ext_messages=True, ext_popupmenu=True)
>>> while True: n.next_message();
This commit is contained in:
@@ -1284,7 +1284,7 @@ describe('API', function()
|
||||
end)
|
||||
it('returns attached UIs', function()
|
||||
local screen = Screen.new(20, 4)
|
||||
screen:attach()
|
||||
screen:attach({override=true})
|
||||
local expected = {
|
||||
{
|
||||
chan = 1,
|
||||
@@ -1299,6 +1299,7 @@ describe('API', function()
|
||||
ext_messages = false,
|
||||
height = 4,
|
||||
rgb = true,
|
||||
override = true,
|
||||
width = 20,
|
||||
}
|
||||
}
|
||||
@@ -1308,6 +1309,7 @@ describe('API', function()
|
||||
screen = Screen.new(44, 99)
|
||||
screen:attach({ rgb = false })
|
||||
expected[1].rgb = false
|
||||
expected[1].override = false
|
||||
expected[1].width = 44
|
||||
expected[1].height = 99
|
||||
eq(expected, nvim("list_uis"))
|
||||
|
||||
@@ -255,14 +255,14 @@ describe('TUI', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it('shows up in nvim_list_uis', function()
|
||||
it('is included in nvim_list_uis()', function()
|
||||
feed_data(':echo map(nvim_list_uis(), {k,v -> sort(items(filter(v, {k,v -> k[:3] !=# "ext_" })))})\013')
|
||||
screen:expect([=[
|
||||
|
|
||||
{4:~ }|
|
||||
{5: }|
|
||||
[[['height', 6], ['rgb', v:false], ['width', 50]]]|
|
||||
|
|
||||
[[['height', 6], ['override', v:false], ['rgb', v:|
|
||||
false], ['width', 50]]] |
|
||||
{10:Press ENTER or type command to continue}{1: } |
|
||||
{3:-- TERMINAL --} |
|
||||
]=])
|
||||
|
||||
Reference in New Issue
Block a user