Skip to content

Commit cb3f98d

Browse files
authored
fix(highlights): previewer show correct highlight group (#3305)
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.
1 parent 6b08cdc commit cb3f98d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/telescope/previewers/buffer_previewer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ previewers.highlights = defaulter(function(_)
11161116
vim.schedule(function()
11171117
vim.api.nvim_buf_call(self.state.bufnr, function()
11181118
vim.cmd "keepjumps norm! gg"
1119-
vim.fn.search(entry.value .. " ")
1119+
vim.fn.search("^" .. entry.value .. " ")
11201120
local lnum = vim.api.nvim_win_get_cursor(self.state.winid)[1]
11211121
-- That one is actually a match but its better to use it like that then matchadd
11221122
pcall(vim.api.nvim_buf_clear_namespace, self.state.bufnr, ns_previewer, 0, -1)

0 commit comments

Comments
 (0)