mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
feat(options): per-buffer 'busy' status #34493
Problem: Plugins cannot mark a buffer as "busy". Solution: - Add a buffer-local 'busy' option. - Show a busy indicator in the default 'statusline'.
This commit is contained in:
@ -355,8 +355,7 @@ describe('au OptionSet', function()
|
||||
|
||||
it('with string global-local (to window) option', function()
|
||||
local oldval = eval('&statusline')
|
||||
local default_statusline =
|
||||
"%<%f %h%w%m%r %=%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}"
|
||||
local default_statusline = api.nvim_get_option_info2('statusline', {}).default
|
||||
|
||||
command('set statusline=foo')
|
||||
expected_combination({
|
||||
|
@ -785,8 +785,15 @@ describe('default statusline', function()
|
||||
exec_lua("vim.o.statusline = 'asdf'")
|
||||
eq('asdf', eval('&statusline'))
|
||||
|
||||
local default_statusline =
|
||||
"%<%f %h%w%m%r %=%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}"
|
||||
local default_statusline = table.concat({
|
||||
'%<',
|
||||
'%f %h%w%m%r ',
|
||||
'%=',
|
||||
"%{% &showcmdloc == 'statusline' ? '%-10.S ' : '' %}",
|
||||
"%{% exists('b:keymap_name') ? '<'..b:keymap_name..'> ' : '' %}",
|
||||
"%{% &busy > 0 ? '◐ ' : '' %}",
|
||||
"%{% &ruler ? ( &rulerformat == '' ? '%-14.(%l,%c%V%) %P' : &rulerformat ) : '' %}",
|
||||
})
|
||||
|
||||
exec_lua("vim.o.statusline = ''")
|
||||
|
||||
@ -799,4 +806,30 @@ describe('default statusline', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('shows busy status when buffer is set to be busy', function()
|
||||
exec_lua("vim.o.statusline = ''")
|
||||
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*13
|
||||
{3:[No Name] 0,0-1 All}|
|
||||
|
|
||||
]])
|
||||
exec_lua('vim.o.busy = 1')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*13
|
||||
{3:[No Name] ◐ 0,0-1 All}|
|
||||
|
|
||||
]])
|
||||
|
||||
exec_lua('vim.o.busy = 0')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*13
|
||||
{3:[No Name] 0,0-1 All}|
|
||||
|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user