mirror of
https://github.com/neovim/neovim.git
synced 2026-02-21 18:01:17 +10:00
vim-patch:9.1.1520: completion: search completion doesn't handle 'smartcase' well (#34840)
Problem: When using `/` or `?` in command-line mode with 'ignorecase' and
'smartcase' enabled, the completion menu could show items that
don't actually match any text in the buffer due to case mismatches
Solution: Instead of validating menu items only against the user-typed
pattern, the new logic also checks whether the completed item
matches actual buffer content. If needed, it retries the match
using a lowercased version of the candidate, respecting
smartcase semantics.
closes: vim/vim#17665
af22007784
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
@@ -4505,6 +4505,8 @@ func Test_search_complete()
|
||||
call assert_equal(['Foobar', 'FooBARR'], g:compl_info.matches)
|
||||
call feedkeys("gg/FO\<tab>\<f9>", 'tx')
|
||||
call assert_equal({}, g:compl_info)
|
||||
call feedkeys("gg/\\cFo\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['\cFoobar', '\cFooBAr', '\cFooBARR'], g:compl_info.matches)
|
||||
set ignorecase
|
||||
call feedkeys("gg/f\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['foobar', 'fooBAr', 'fooBARR'], g:compl_info.matches)
|
||||
@@ -4512,13 +4514,19 @@ func Test_search_complete()
|
||||
call assert_equal(['Foobar', 'FooBAr', 'FooBARR'], g:compl_info.matches)
|
||||
call feedkeys("gg/FO\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['FOobar', 'FOoBAr', 'FOoBARR'], g:compl_info.matches)
|
||||
call feedkeys("gg/\\Cfo\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['\CfooBAr', '\Cfoobar'], g:compl_info.matches)
|
||||
set smartcase
|
||||
call feedkeys("gg/f\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['foobar', 'fooBAr', 'fooBARR'], g:compl_info.matches)
|
||||
call assert_equal(['foobar', 'fooBAr', 'foobarr'], g:compl_info.matches)
|
||||
call feedkeys("gg/Fo\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['Foobar', 'FooBARR'], g:compl_info.matches)
|
||||
call feedkeys("gg/FO\<tab>\<f9>", 'tx')
|
||||
call assert_equal({}, g:compl_info)
|
||||
call feedkeys("gg/\\Cfo\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['\CfooBAr', '\Cfoobar'], g:compl_info.matches)
|
||||
call feedkeys("gg/\\cFo\<tab>\<f9>", 'tx')
|
||||
call assert_equal(['\cFoobar', '\cFooBAr', '\cFooBARR'], g:compl_info.matches)
|
||||
|
||||
bw!
|
||||
call Ntest_override("char_avail", 0)
|
||||
|
||||
Reference in New Issue
Block a user