Skip to content

Conversation

@girishji
Copy link
Contributor

@girishji girishji commented Mar 4, 2025

This update enables highlighting in the popup menu (wildmenu) even when the matched fragment or pattern appears within an item (string) rather than only at the beginning. This is especially useful for custom completion, where menu items may not always start with the typed pattern.

For specific use cases, refer to the two examples in #16759

A sliding window approach is used with direct string comparison. Performance is not a concern, as highlighting is applied only to displayed lines, even if the menu list is arbitrarily long.

This update enables highlighting in the popup menu even when the matched
fragment or pattern appears within an item (string) rather than only at the
beginning. This is especially useful for custom completion, where menu items
may not always start with the typed pattern.

For specific use cases, refer to the two examples in
vim#16759

A sliding window approach is used with direct string comparison. Performance
is not a concern, as highlighting is applied only to displayed lines, even if
the menu list is arbitrarily long.

M  src/popupmenu.c
A  src/testdir/dumps/Test_wildmenu_pum_hl_match_nonf.dump
M  src/testdir/test_cmdline.vim
@chrisbra
Copy link
Member

chrisbra commented Mar 4, 2025

ah looks nice, thanks

@chrisbra chrisbra closed this in 4ec46f3 Mar 4, 2025
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Mar 4, 2025
Problem:  wildmenu highlighting in popup can be improved
Solution: Check if the completion items contain submatches of the
          entered text (Girish Palya).

This update enables highlighting in the popup menu even when the matched
fragment or pattern appears within an item (string) rather than only at the
beginning. This is especially useful for custom completion, where menu items
may not always start with the typed pattern.

For specific use cases, refer to the two examples in
vim/vim#16759

A sliding window approach is used with direct string comparison. Performance
is not a concern, as highlighting is applied only to displayed lines, even if
the menu list is arbitrarily long.

closes: vim/vim#16785

vim/vim@4ec46f3

Co-authored-by: Girish Palya <girishji@gmail.com>
zeertzjq added a commit to neovim/neovim that referenced this pull request Mar 4, 2025
…32728)

Problem:  wildmenu highlighting in popup can be improved
Solution: Check if the completion items contain submatches of the
          entered text (Girish Palya).

This update enables highlighting in the popup menu even when the matched
fragment or pattern appears within an item (string) rather than only at the
beginning. This is especially useful for custom completion, where menu items
may not always start with the typed pattern.

For specific use cases, refer to the two examples in
vim/vim#16759

A sliding window approach is used with direct string comparison. Performance
is not a concern, as highlighting is applied only to displayed lines, even if
the menu list is arbitrarily long.

closes: vim/vim#16785

vim/vim@4ec46f3

Co-authored-by: Girish Palya <girishji@gmail.com>
@girishji girishji deleted the highlight branch April 16, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants