Skip to content

Commit

Permalink
fix(highlights): previewer show correct highlight group (#3305)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cameronr authored Sep 26, 2024
1 parent 6b08cdc commit cb3f98d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/telescope/previewers/buffer_previewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ previewers.highlights = defaulter(function(_)
vim.schedule(function()
vim.api.nvim_buf_call(self.state.bufnr, function()
vim.cmd "keepjumps norm! gg"
vim.fn.search(entry.value .. " ")
vim.fn.search("^" .. entry.value .. " ")
local lnum = vim.api.nvim_win_get_cursor(self.state.winid)[1]
-- That one is actually a match but its better to use it like that then matchadd
pcall(vim.api.nvim_buf_clear_namespace, self.state.bufnr, ns_previewer, 0, -1)
Expand Down

0 comments on commit cb3f98d

Please sign in to comment.