Skip to content

fix(highlights): preview may (rarely) show wrong highlight #3305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

cameronr
Copy link
Contributor

@cameronr cameronr commented Sep 25, 2024

Description

Fixes a bug in the builtin highlights picker where the selected highlight won't be displayed in the previewer if the selected highlight is a suffix of another highlight and that other highlight occurs first in the list of highlights. For example, having Comment selected in the picker shows SpecialComment in the previewer. Another example is 'Cursor'/'TermCursor'

The fix is trivial, just match at the start of the line (in addition to requiring a space after)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list relevant details about your configuration

  • run :Telescope highlights and search for Comment. Expected: Comment is shown in the preview. Actual: SpecialComment is shown

Configuration:

  • Neovim version (nvim --version):
    NVIM v0.10.1
    Build type: Release
    LuaJIT 2.1.1720049189

  • Operating system and version:
    Darwin astrotop.local 23.6.0 Darwin Kernel Version 23.6.0: Fri Jul 5 17:54:20 PDT 2024; root:xnu-10063.141.1~2/RELEASE_X86_64 x86_64

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

Fixes a minor bug in the builtin highlights picker where having
`Comment` selected in the picker shows `SpecialComment` in the
previewer. Only happens when the selected highlight is a suffix of
another highlight and the other highlight occurs first.
@jamestrew jamestrew merged commit cb3f98d into nvim-telescope:master Sep 26, 2024
12 checks passed
@jamestrew jamestrew added the backport-0.1.x PR to be backported to 0.1.x (Neovim 0.7 compat) label Sep 26, 2024
@jamestrew
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-0.1.x PR to be backported to 0.1.x (Neovim 0.7 compat)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants