mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
api/ext_tabline: List of Dicts.
This commit is contained in:
parent
c8e1af93de
commit
6944abad2f
@ -440,9 +440,10 @@ states might be represented as separate modes.
|
|||||||
|
|
||||||
*ui-ext-tabline*
|
*ui-ext-tabline*
|
||||||
["tabline_update", curtab, tabs]
|
["tabline_update", curtab, tabs]
|
||||||
Nvim will send this event when drawing tabline. curtab is the tab id
|
Tabline was updated. UIs should present this data in a custom tabline
|
||||||
of the current tab. tabs is an array of the form:
|
widget.
|
||||||
[tabid, { "name": name }]
|
curtab: Current Tabpage
|
||||||
|
tabs: List of Dicts [{ "tab": Tabpage, "name": String }, ...]
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||||
|
@ -7038,15 +7038,14 @@ void ui_ext_tabline_update(void)
|
|||||||
ADD(args, INTEGER_OBJ(curtab->handle));
|
ADD(args, INTEGER_OBJ(curtab->handle));
|
||||||
Array tabs = ARRAY_DICT_INIT;
|
Array tabs = ARRAY_DICT_INIT;
|
||||||
FOR_ALL_TABS(tp) {
|
FOR_ALL_TABS(tp) {
|
||||||
|
Dictionary tab_info = ARRAY_DICT_INIT;
|
||||||
|
PUT(tab_info, "tab", TABPAGE_OBJ(tp->handle));
|
||||||
|
|
||||||
win_T *cwp = (tp == curtab) ? curwin : tp->tp_curwin;
|
win_T *cwp = (tp == curtab) ? curwin : tp->tp_curwin;
|
||||||
get_trans_bufname(cwp->w_buffer);
|
get_trans_bufname(cwp->w_buffer);
|
||||||
Array tab = ARRAY_DICT_INIT;
|
|
||||||
ADD(tab, INTEGER_OBJ(tp->handle));
|
|
||||||
|
|
||||||
Dictionary tab_info = ARRAY_DICT_INIT;
|
|
||||||
PUT(tab_info, "name", STRING_OBJ(cstr_to_string((char *)NameBuff)));
|
PUT(tab_info, "name", STRING_OBJ(cstr_to_string((char *)NameBuff)));
|
||||||
ADD(tab, DICTIONARY_OBJ(tab_info));
|
|
||||||
ADD(tabs, ARRAY_OBJ(tab));
|
ADD(tabs, DICTIONARY_OBJ(tab_info));
|
||||||
}
|
}
|
||||||
ADD(args, ARRAY_OBJ(tabs));
|
ADD(args, ARRAY_OBJ(tabs));
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
local helpers = require('test.functional.helpers')(after_each)
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear, feed, eq = helpers.clear, helpers.feed, helpers.eq
|
local clear, command, eq = helpers.clear, helpers.command, helpers.eq
|
||||||
|
|
||||||
describe('ui/tabline', function()
|
describe('ui/tabline', function()
|
||||||
local screen
|
local screen
|
||||||
local tabs, curtab
|
local event_tabs, event_curtab
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
@ -12,7 +12,7 @@ describe('ui/tabline', function()
|
|||||||
screen:attach({rgb=true, ext_tabline=true})
|
screen:attach({rgb=true, ext_tabline=true})
|
||||||
screen:set_on_event_handler(function(name, data)
|
screen:set_on_event_handler(function(name, data)
|
||||||
if name == "tabline_update" then
|
if name == "tabline_update" then
|
||||||
curtab, tabs = unpack(data)
|
event_curtab, event_tabs = unpack(data)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
@ -23,11 +23,12 @@ describe('ui/tabline', function()
|
|||||||
|
|
||||||
describe('externalized', function()
|
describe('externalized', function()
|
||||||
it('publishes UI events', function()
|
it('publishes UI events', function()
|
||||||
local expected = {
|
command("tabedit another-tab")
|
||||||
{1, {['name'] = '[No Name]'}},
|
|
||||||
{2, {['name'] = '[No Name]'}},
|
local expected_tabs = {
|
||||||
|
{tab = { id = 1 }, name = '[No Name]'},
|
||||||
|
{tab = { id = 2 }, name = 'another-tab'},
|
||||||
}
|
}
|
||||||
feed(":tabnew<CR>")
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
@ -35,11 +36,11 @@ describe('ui/tabline', function()
|
|||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], nil, nil, function()
|
||||||
eq(2, curtab)
|
eq(2, event_curtab)
|
||||||
eq(expected, tabs)
|
eq(expected_tabs, event_tabs)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
feed(":tabNext<CR>")
|
command("tabNext")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
^ |
|
^ |
|
||||||
~ |
|
~ |
|
||||||
@ -47,8 +48,8 @@ describe('ui/tabline', function()
|
|||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]], nil, nil, function()
|
]], nil, nil, function()
|
||||||
eq(1, curtab)
|
eq(1, event_curtab)
|
||||||
eq(expected, tabs)
|
eq(expected_tabs, event_tabs)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
2
third-party/cmake/BuildLuarocks.cmake
vendored
2
third-party/cmake/BuildLuarocks.cmake
vendored
@ -167,7 +167,7 @@ if(USE_BUNDLED_BUSTED)
|
|||||||
|
|
||||||
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client
|
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client
|
||||||
COMMAND ${LUAROCKS_BINARY}
|
COMMAND ${LUAROCKS_BINARY}
|
||||||
ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-25/nvim-client-0.0.1-25.rockspec ${LUAROCKS_BUILDARGS}
|
ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-26/nvim-client-0.0.1-26.rockspec ${LUAROCKS_BUILDARGS}
|
||||||
DEPENDS luv)
|
DEPENDS luv)
|
||||||
add_custom_target(nvim-client
|
add_custom_target(nvim-client
|
||||||
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client)
|
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client)
|
||||||
|
Loading…
Reference in New Issue
Block a user