Skip to content

Commit c27c398

Browse files
committed
fix(previewer): rg errmsg is mistakenly taken as ctags pattern
Problem: When rg cmd fail with errmsg e.g. `rg: PCRE2: error` This will be parsed and treated as an entry(with lnum=0) `matchadd` will remain even buf changed in window, so we have to clear the matches on each preview. To reproduce: `FzfLua live_grep search=\] no_esc=true` then type `<bs>`, `]`, `<bs>`, `]`... (with rg --pcre2) Maybe this can also happened in `FzfLua global`.
1 parent 8342463 commit c27c398

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lua/fzf-lua/previewer/builtin.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ function Previewer.buffer_or_file:set_cursor_hl(entry)
12651265
if type(cached_pos) ~= "table" then cached_pos = nil end
12661266
local lnum, col = entry.line, math.max(1, entry.col or 1)
12671267

1268-
if (not lnum or lnum == 0) and regex then
1268+
if (not lnum or lnum == 0) and entry.ctag and regex then
12691269
-- pcall(fn.clearmatches, self.win.preview_winid)
12701270
pcall(api.nvim_win_call, win, function()
12711271
-- start searching at line 1 in case we

0 commit comments

Comments
 (0)