aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-12-04 09:43:38 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-12-04 10:07:05 +0800
commit3f1ee12d311fffe30936217c74ef0352bb7d97d9 (patch)
treee66f23c4b43ef43396001541cbbf7f75bbf86b40 /src/nvim/testdir
parent46e4be0fd0002233bde613295607ce5eeb498567 (diff)
downloadrneovim-3f1ee12d311fffe30936217c74ef0352bb7d97d9.tar.gz
rneovim-3f1ee12d311fffe30936217c74ef0352bb7d97d9.tar.bz2
rneovim-3f1ee12d311fffe30936217c74ef0352bb7d97d9.zip
vim-patch:8.2.3265: smartcase does not work correctly in very magic pattern
Problem: Smartcase does not work correctly in very magic pattern. Solution: Take the magicness into account when skipping over regexp items. (Christian Brabandt, closes vim/vim#8682, closes vim/vim#7845) https://github.com/vim/vim/commit/78ba933d18439ff1a02f6be4c571e73ddceb3cd4 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_search.vim54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index 8bb7d8687f..51e7064c94 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -1998,6 +1998,60 @@ func Test_incsearch_substitute_dump2()
call delete('Xis_subst_script2')
endfunc
+func Test_pattern_is_uppercase_smartcase()
+ new
+ let input=['abc', 'ABC', 'Abc', 'abC']
+ call setline(1, input)
+ call cursor(1,1)
+ " default, matches firstline
+ %s/abc//g
+ call assert_equal(['', 'ABC', 'Abc', 'abC'],
+ \ getline(1, '$'))
+
+ set smartcase ignorecase
+ sil %d
+ call setline(1, input)
+ call cursor(1,1)
+ " with smartcase and incsearch set, matches everything
+ %s/abc//g
+ call assert_equal(['', '', '', ''], getline(1, '$'))
+
+ sil %d
+ call setline(1, input)
+ call cursor(1,1)
+ " with smartcase and incsearch set and found an uppercase letter,
+ " match only that.
+ %s/abC//g
+ call assert_equal(['abc', 'ABC', 'Abc', ''],
+ \ getline(1, '$'))
+
+ sil %d
+ call setline(1, input)
+ call cursor(1,1)
+ exe "norm! vG$\<esc>"
+ " \%V should not be detected as uppercase letter
+ %s/\%Vabc//g
+ call assert_equal(['', '', '', ''], getline(1, '$'))
+
+ call setline(1, input)
+ call cursor(1,1)
+ exe "norm! vG$\<esc>"
+ " \v%V should not be detected as uppercase letter
+ %s/\v%Vabc//g
+ call assert_equal(['', '', '', ''], getline(1, '$'))
+
+ call setline(1, input)
+ call cursor(1,1)
+ exe "norm! vG$\<esc>"
+ " \v%VabC should be detected as uppercase letter
+ %s/\v%VabC//g
+ call assert_equal(['abc', 'ABC', 'Abc', ''],
+ \ getline(1, '$'))
+
+ set smartcase& ignorecase&
+ bw!
+endfunc
+
func Test_no_last_search_pattern()
CheckOption incsearch