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:
Shadman
2025-07-07 05:17:06 +06:00
committed by GitHub
parent 6fd2a3040f
commit 5973328eda
10 changed files with 77 additions and 6 deletions

View File

@ -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({

View File

@ -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)