mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
vim-patch:9.1.1407: Can't use getpos('v') in OptionSet when using setbufvar() (#34177)
Problem: Can't use getpos('v') in OptionSet when using setbufvar(). Solution: Don't reset Visual selection when switching to the same buffer (zeertzjq). closes: vim/vim#173735717ee33db
(cherry picked from commitbd01bd6564
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
5e0ef6afc7
commit
d1ca551983
@@ -3458,6 +3458,28 @@ func Test_Visual_doautoall_redraw()
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_get_Visual_selection_in_curbuf_autocmd()
|
||||
throw 'Skipped: use test/functional/legacy/autocmd_spec.lua'
|
||||
call test_override('starting', 1)
|
||||
new
|
||||
autocmd OptionSet list let b:text = getregion(getpos('.'), getpos('v'))
|
||||
call setline(1, 'foo bar baz')
|
||||
|
||||
normal! gg0fbvtb
|
||||
setlocal list
|
||||
call assert_equal(['bar '], b:text)
|
||||
exe "normal! \<Esc>"
|
||||
|
||||
normal! v0
|
||||
call setbufvar('%', '&list', v:false)
|
||||
call assert_equal(['foo bar '], b:text)
|
||||
exe "normal! \<Esc>"
|
||||
|
||||
autocmd! OptionSet list
|
||||
bwipe!
|
||||
call test_override('starting', 0)
|
||||
endfunc
|
||||
|
||||
" This was using freed memory.
|
||||
func Test_BufNew_arglocal()
|
||||
arglocal
|
||||
|
Reference in New Issue
Block a user