patch 9.1.1374: completion: 'smartcase' not respected when filtering matches

Problem:  Currently, 'smartcase' is respected when completing keywords
          using <C-N>, <C-P>, <C-X><C-N>, and <C-X><C-P>. However, when
          a user continues typing and the completion menu is filtered
          using cached matches, 'smartcase' is not applied. This leads
          to poor-quality or irrelevant completion suggestions, as shown
          in the example below.
Solution: When filtering cached completion items after typing additional
          characters, apply case-sensitive comparison if 'smartcase' is
          enabled and the typed pattern includes uppercase characters.
          This ensures consistent and expected completion behavior.
          (Girish Palya)

closes: #17271

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Girish Palya
2025-05-08 23:28:52 +02:00
committed by Christian Brabandt
parent c3fbaa086e
commit dc314053e1
8 changed files with 109 additions and 9 deletions

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 9.1. Last change: 2025 Apr 14
*insert.txt* For Vim version 9.1. Last change: 2025 May 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1347,6 +1347,7 @@ use all space available.
The 'pumwidth' option can be used to set a minimum width. The default is 15
characters.
*compl-states*
There are three states:
1. A complete match has been inserted, e.g., after using CTRL-N or CTRL-P.
2. A cursor key has been used to select another match. The match was not

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 9.1. Last change: 2025 May 07
*options.txt* For Vim version 9.1. Last change: 2025 May 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -7742,9 +7742,11 @@ A jump table for the options with a short description can be found at |Q_op|.
Override the 'ignorecase' option if the search pattern contains upper
case characters. Only used when the search pattern is typed and
'ignorecase' option is on. Used for the commands "/", "?", "n", "N",
":g" and ":s". Not used for "*", "#", "gd", tag search, etc. After
"*" and "#" you can make 'smartcase' used by doing a "/" command,
recalling the search pattern from history and hitting <Enter>.
":g" and ":s" and when filtering matches for the completion menu
|compl-states|.
Not used for "*", "#", "gd", tag search, etc. After "*" and "#" you
can make 'smartcase' used by doing a "/" command, recalling the search
pattern from history and hitting <Enter>.
NOTE: This option is reset when 'compatible' is set.
*'smartindent'* *'si'* *'nosmartindent'* *'nosi'*

View File

@ -6645,6 +6645,7 @@ compl-keyword insert.txt /*compl-keyword*
compl-omni insert.txt /*compl-omni*
compl-omni-filetypes insert.txt /*compl-omni-filetypes*
compl-spelling insert.txt /*compl-spelling*
compl-states insert.txt /*compl-states*
compl-stop insert.txt /*compl-stop*
compl-tag insert.txt /*compl-tag*
compl-thesaurus insert.txt /*compl-thesaurus*

View File

@ -1,4 +1,4 @@
*version9.txt* For Vim version 9.1. Last change: 2025 May 07
*version9.txt* For Vim version 9.1. Last change: 2025 May 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -41626,6 +41626,7 @@ Completion: ~
"{flag}^<limit>" notation
- add ":filetype" command completion
- add "filetypecmd" completion type for |getcompletion()|
- 'smartcase' applies to completion filtering
Options: ~
- the default for 'commentstring' contains whitespace padding to have