Mercurial > vim
comparison src/testdir/test_search.vim @ 25457:b95f9cc3d1b9 v8.2.3265
patch 8.2.3265: smartcase does not work correctly in very magic pattern
Commit: https://github.com/vim/vim/commit/78ba933d18439ff1a02f6be4c571e73ddceb3cd4
Author: Christian Brabandt <cb@256bit.org>
Date: Sun Aug 1 12:44:37 2021 +0200
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 #8682, closes #7845)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Aug 2021 12:45:03 +0200 |
parents | eafc0e07b188 |
children | a6eea433586b |
comparison
equal
deleted
inserted
replaced
25456:b6b6400dee89 | 25457:b95f9cc3d1b9 |
---|---|
1910 | 1910 |
1911 call StopVimInTerminal(buf) | 1911 call StopVimInTerminal(buf) |
1912 call delete('Xis_subst_script2') | 1912 call delete('Xis_subst_script2') |
1913 endfunc | 1913 endfunc |
1914 | 1914 |
1915 func Test_pattern_is_uppercase_smartcase() | |
1916 new | |
1917 let input=['abc', 'ABC', 'Abc', 'abC'] | |
1918 call setline(1, input) | |
1919 call cursor(1,1) | |
1920 " default, matches firstline | |
1921 %s/abc//g | |
1922 call assert_equal(['', 'ABC', 'Abc', 'abC'], | |
1923 \ getline(1, '$')) | |
1924 | |
1925 set smartcase ignorecase | |
1926 sil %d | |
1927 call setline(1, input) | |
1928 call cursor(1,1) | |
1929 " with smartcase and incsearch set, matches everything | |
1930 %s/abc//g | |
1931 call assert_equal(['', '', '', ''], getline(1, '$')) | |
1932 | |
1933 sil %d | |
1934 call setline(1, input) | |
1935 call cursor(1,1) | |
1936 " with smartcase and incsearch set and found an uppercase letter, | |
1937 " match only that. | |
1938 %s/abC//g | |
1939 call assert_equal(['abc', 'ABC', 'Abc', ''], | |
1940 \ getline(1, '$')) | |
1941 | |
1942 sil %d | |
1943 call setline(1, input) | |
1944 call cursor(1,1) | |
1945 exe "norm! vG$\<esc>" | |
1946 " \%V should not be detected as uppercase letter | |
1947 %s/\%Vabc//g | |
1948 call assert_equal(['', '', '', ''], getline(1, '$')) | |
1949 | |
1950 call setline(1, input) | |
1951 call cursor(1,1) | |
1952 exe "norm! vG$\<esc>" | |
1953 " \v%V should not be detected as uppercase letter | |
1954 %s/\v%Vabc//g | |
1955 call assert_equal(['', '', '', ''], getline(1, '$')) | |
1956 | |
1957 call setline(1, input) | |
1958 call cursor(1,1) | |
1959 exe "norm! vG$\<esc>" | |
1960 " \v%VabC should be detected as uppercase letter | |
1961 %s/\v%VabC//g | |
1962 call assert_equal(['abc', 'ABC', 'Abc', ''], | |
1963 \ getline(1, '$')) | |
1964 | |
1965 set smartcase& ignorecase& | |
1966 bw! | |
1967 endfunc | |
1968 | |
1915 " vim: shiftwidth=2 sts=2 expandtab | 1969 " vim: shiftwidth=2 sts=2 expandtab |