vim-patch:9.1.1808: Option insecure flags not copied when splitting window

Problem:  Option insecure flags not copied when splitting window.
Solution: Move window-local insecure flags to winopt_T and copy them
          properly (zeertzjq).

closes: vim/vim#18434

b3740f4b00
(cherry picked from commit 42f1864b62)
This commit is contained in:
zeertzjq
2025-09-30 06:37:23 +08:00
committed by github-actions[bot]
parent 67688ab616
commit 6dda8e9572
5 changed files with 149 additions and 15 deletions

View File

@@ -382,19 +382,35 @@ func Test_modeline_nowrap_lcs_extends()
\ 'ccc evil',
\ 'ddd vim: nowrap',
\ ], 'Xmodeline_nowrap', 'D')
call NewWindow(10, 20)
set noequalalways
11new | 20vsplit
func Check_modeline_nowrap(expect_insecure, expect_secure, set_cmd)
edit Xmodeline_nowrap
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
5split
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
call assert_equal(a:expect_insecure, ScreenLines([7, 11], 20))
exe a:set_cmd 'nowrap'
call assert_equal(a:expect_secure, ScreenLines([1, 5], 20))
call assert_equal(a:expect_insecure, ScreenLines([7, 11], 20))
close
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
setglobal nowrap
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
setglobal wrap
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
exe a:set_cmd 'nowrap'
call assert_equal(a:expect_secure, ScreenLines([1, 5], 20))
exe 'sandbox' a:set_cmd 'nowrap'
call assert_equal(a:expect_insecure, ScreenLines([1, 5], 20))
exe a:set_cmd 'nowrap'
call assert_equal(a:expect_secure, ScreenLines([1, 5], 20))
endfunc
@@ -463,8 +479,28 @@ func Test_modeline_nowrap_lcs_extends()
call Check_modeline_nowrap(expect_insecure, expect_secure, 'setlocal')
call Check_modeline_nowrap(expect_insecure, expect_secure, 'set')
call CloseWindow()
sandbox setglobal nowrap
setglobal list listchars=eol:$
setlocal bufhidden=wipe
enew!
call setline(1, ['aaa bbb'])
call assert_equal(['aaa >'], ScreenLines(1, 20))
setglobal nowrap
call assert_equal(['aaa >'], ScreenLines(1, 20))
setlocal nowrap
call assert_equal(['aaa '], ScreenLines(1, 20))
normal! 20zl
call assert_equal([' bbb$ '], ScreenLines(1, 20))
setlocal bufhidden=wipe
enew!
call setline(1, ['ccc ddd'])
call assert_equal(['ccc '], ScreenLines(1, 20))
normal! 20zl
call assert_equal([' ddd$ '], ScreenLines(1, 20))
bwipe!
delfunc Check_modeline_nowrap
set equalalways&
endfunc
" vim: shiftwidth=2 sts=2 expandtab