mirror of
https://github.com/neovim/neovim.git
synced 2026-08-01 05:09:08 +00:00
fix(health): always set 'modifiable' #40584
Problem:
When buffers are by default `nomodifiable`, such as when Nvim starts with
`-M`, the health buffer cannot be updated.
Solution:
Always set `modifiable` before modifying the buffer.
(cherry picked from commit 0f86ea5ed8)
This commit is contained in:
committed by
github-actions[bot]
parent
7fd0f541e7
commit
a4cfded55e
@@ -414,7 +414,6 @@ function M._check(mods, plugin_names)
|
||||
close_events = {},
|
||||
})
|
||||
vim.api.nvim_set_current_win(float_winid)
|
||||
vim.bo[bufnr].modifiable = true
|
||||
vim.wo[float_winid].list = false
|
||||
else
|
||||
bufnr = vim.api.nvim_create_buf(true, true)
|
||||
@@ -424,6 +423,7 @@ function M._check(mods, plugin_names)
|
||||
local buf_cmd = #mods > 0 and (mods .. ' sbuffer') or emptybuf and 'buffer' or 'tab sbuffer'
|
||||
vim.cmd(buf_cmd .. ' ' .. bufnr)
|
||||
end
|
||||
vim.bo[bufnr].modifiable = true
|
||||
|
||||
if vim.fn.bufexists('health://') == 1 then
|
||||
vim.cmd.bwipe('health://')
|
||||
|
||||
@@ -140,6 +140,12 @@ describe(':checkhealth', function()
|
||||
eq(true, report:find('- custom_ft:', 1, true) ~= nil)
|
||||
eq(true, report:find('- bad_ft:', 1, true) ~= nil)
|
||||
end)
|
||||
|
||||
it('renders report when Nvim starts with -M', function()
|
||||
clear { args = { '-M' } }
|
||||
command('checkhealth lsp')
|
||||
eq(true, curbuf_contents() ~= '')
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('vim.health', function()
|
||||
|
||||
Reference in New Issue
Block a user