comparison src/testdir/test_search.vim @ 31233:d80066065462 v9.0.0950

patch 9.0.0950: the pattern "_szs" matches at EOL Commit: https://github.com/vim/vim/commit/c96311b5be307f5a1d1b20a0ec930d63964e7335 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 25 21:13:47 2022 +0000 patch 9.0.0950: the pattern "\_s\zs" matches at EOL Problem: The pattern "\_s\zs" matches at EOL. Solution: Make the pattern "\_s\zs" match at the start of the next line. (closes #11617)
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Nov 2022 22:15:03 +0100
parents ae10b91ac6b3
children c51111774ea8
comparison
equal deleted inserted replaced
31232:c4a37ba73128 31233:d80066065462
1882 1s/cafÉ/x/g 1882 1s/cafÉ/x/g
1883 call assert_equal('Café x', getline(1)) 1883 call assert_equal('Café x', getline(1))
1884 1884
1885 set ignorecase& smartcase& 1885 set ignorecase& smartcase&
1886 let &encoding = save_enc 1886 let &encoding = save_enc
1887 close! 1887 bwipe!
1888 endfunc 1888 endfunc
1889 1889
1890 " Test searching past the end of a file 1890 " Test searching past the end of a file
1891 func Test_search_past_eof() 1891 func Test_search_past_eof()
1892 new 1892 new
1893 call setline(1, ['Line']) 1893 call setline(1, ['Line'])
1894 exe "normal /\\n\\zs\<CR>" 1894 exe "normal /\\n\\zs\<CR>"
1895 call assert_equal([1, 4], [line('.'), col('.')]) 1895 call assert_equal([1, 4], [line('.'), col('.')])
1896 close! 1896 bwipe!
1897 endfunc
1898
1899 " Test setting the start of the match and still finding a next match in the
1900 " same line.
1901 func Test_search_set_start_same_line()
1902 new
1903 set cpo-=c
1904
1905 call setline(1, ['1', '2', '3 .', '4', '5'])
1906 exe "normal /\\_s\\zs\\S\<CR>"
1907 call assert_equal([2, 1], [line('.'), col('.')])
1908 exe 'normal n'
1909 call assert_equal([3, 1], [line('.'), col('.')])
1910 exe 'normal n'
1911 call assert_equal([3, 3], [line('.'), col('.')])
1912 exe 'normal n'
1913 call assert_equal([4, 1], [line('.'), col('.')])
1914 exe 'normal n'
1915 call assert_equal([5, 1], [line('.'), col('.')])
1916
1917 set cpo+=c
1918 bwipe!
1897 endfunc 1919 endfunc
1898 1920
1899 " Test for various search offsets 1921 " Test for various search offsets
1900 func Test_search_offset() 1922 func Test_search_offset()
1901 " With /e, for a match in the first column of a line, the cursor should be 1923 " With /e, for a match in the first column of a line, the cursor should be