aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-23 17:59:54 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-23 18:24:14 +0800
commit3f32cb88c2cf2bcc1ca95fe24a800abd9d731827 (patch)
tree458e1570cd195faae26ecd7fdafd2e2e1879d3c7 /test
parent0ba27bb51d3297aec43e78050cc3adcf6879db22 (diff)
downloadrneovim-3f32cb88c2cf2bcc1ca95fe24a800abd9d731827.tar.gz
rneovim-3f32cb88c2cf2bcc1ca95fe24a800abd9d731827.tar.bz2
rneovim-3f32cb88c2cf2bcc1ca95fe24a800abd9d731827.zip
vim-patch:9.0.1781: Problems when setting bin/paste option
Problem: Problems when setting bin/paste option Solution: When setting binary/paste, remember that this also affects depending options, so that :verbose set returns the right location. Mention if depending options for 'binary' or 'paste' have been reset indirectly. Add a test to verify it works. Also noticed as small bug, that the global option value for expandtab was not reset when paste option is set, so fix that while at it. closes: vim/vim#12837 closes: vim/vim#12879 https://github.com/vim/vim/commit/757593c07a4f4ac43eb6c6e52fc299abc9bc08bc Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_options.vim81
1 files changed, 81 insertions, 0 deletions
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim
index 12a262f2ad..563709b9a3 100644
--- a/test/old/testdir/test_options.vim
+++ b/test/old/testdir/test_options.vim
@@ -1768,4 +1768,85 @@ func Test_set_option_window_global_local_all()
bw!
endfunc
+func Test_paste_depending_options()
+ " setting the paste option, resets all dependent options
+ " and will be reported correctly using :verbose set <option>?
+ let lines =<< trim [CODE]
+ " set paste test
+ set autoindent
+ set expandtab
+ " disabled, because depends on compiled feature set
+ " set hkmap
+ " set revins
+ " set varsofttabstop=8,32,8
+ set ruler
+ set showmatch
+ set smarttab
+ set softtabstop=4
+ set textwidth=80
+ set wrapmargin=10
+
+ source Xvimrc_paste2
+
+ redir > Xoutput_paste
+ verbose set expandtab?
+ verbose setg expandtab?
+ verbose setl expandtab?
+ redir END
+
+ qall!
+ [CODE]
+
+ call writefile(lines, 'Xvimrc_paste', 'D')
+ call writefile(['set paste'], 'Xvimrc_paste2', 'D')
+ if !RunVim([], lines, '--clean')
+ return
+ endif
+
+ let result = readfile('Xoutput_paste')->filter('!empty(v:val)')
+ call assert_equal('noexpandtab', result[0])
+ call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[1])
+ call assert_equal('noexpandtab', result[2])
+ call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[3])
+ call assert_equal('noexpandtab', result[4])
+ call assert_match("^\tLast set from .*Xvimrc_paste2 line 1$", result[5])
+
+ call delete('Xoutput_paste')
+endfunc
+
+func Test_binary_depending_options()
+ " setting the paste option, resets all dependent options
+ " and will be reported correctly using :verbose set <option>?
+ let lines =<< trim [CODE]
+ " set binary test
+ set expandtab
+
+ source Xvimrc_bin2
+
+ redir > Xoutput_bin
+ verbose set expandtab?
+ verbose setg expandtab?
+ verbose setl expandtab?
+ redir END
+
+ qall!
+ [CODE]
+
+ call writefile(lines, 'Xvimrc_bin', 'D')
+ call writefile(['set binary'], 'Xvimrc_bin2', 'D')
+ if !RunVim([], lines, '--clean')
+ return
+ endif
+
+ let result = readfile('Xoutput_bin')->filter('!empty(v:val)')
+ call assert_equal('noexpandtab', result[0])
+ call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[1])
+ call assert_equal('noexpandtab', result[2])
+ call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[3])
+ call assert_equal('noexpandtab', result[4])
+ call assert_match("^\tLast set from .*Xvimrc_bin2 line 1$", result[5])
+
+ call delete('Xoutput_bin')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab