mirror of
https://github.com/neovim/neovim.git
synced 2026-08-15 03:49:28 +00:00
fix(ctx): missing options copy when loading hidden buffer #41149
It's necessary to copy the global 'fileencoding' to the buffer-local value before entering the buffer, otherwise 'fileencoding' is changed when reading the file, which will mark the file as modified.
This commit is contained in:
@@ -324,3 +324,19 @@ describe('setbufvar() function', function()
|
||||
eq('Vim:E928: String required', pcall_err(fn.setbufvar, '', '&errorformat', true))
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('bufload() function', function()
|
||||
before_each(function()
|
||||
t.write_file(fname, 'foo\n')
|
||||
end)
|
||||
after_each(function()
|
||||
os.remove(fname)
|
||||
end)
|
||||
it('does not set hidden buffer as modified #41148', function()
|
||||
local buf = fn.bufadd(fname)
|
||||
fn.bufload(buf)
|
||||
api.nvim_command('edit ' .. fname)
|
||||
eq(true, api.nvim_buf_is_loaded(buf))
|
||||
eq(false, api.nvim_get_option_value('modified', { buf = buf }))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user