fix(api): do not switch win/buf if getting option in current win/buf (#19383)

This commit is contained in:
zeertzjq
2022-07-16 09:31:05 +08:00
committed by GitHub
parent 33da7d83e8
commit 73526abbbd
2 changed files with 31 additions and 11 deletions

View File

@@ -1469,6 +1469,17 @@ describe('API', function()
nvim('win_set_option', win, 'number', true)
eq(true, nvim('get_option_value', 'number', {win = win}))
end)
it('getting current buffer option does not adjust cursor #19381', function()
nvim('command', 'new')
local buf = nvim('get_current_buf').id
local win = nvim('get_current_win').id
insert('some text')
feed('0v$')
eq({1, 9}, nvim('win_get_cursor', win))
nvim('get_option_value', 'filetype', {buf = buf})
eq({1, 9}, nvim('win_get_cursor', win))
end)
end)
describe('nvim_{get,set}_current_buf, nvim_list_bufs', function()