Skip to content

Commit bc691c2

Browse files
committed
fix(previewer): make "smartcase" work again
No flags for case sensitive, and flags like "\C" may break previous smartcase hack
1 parent 7b3a739 commit bc691c2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lua/fzf-lua/previewer/builtin.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ function Previewer.buffer_or_file:set_cursor_hl(entry)
12521252
end)()
12531253
end
12541254

1255+
local case_sensitive = regex and regex:lower() ~= regex
12551256
-- If called from tags previewer, can happen when using ctags cmd
12561257
-- "ctags -R --c++-kinds=+p --fields=+iaS --extras=+q --excmd=combine"
12571258
-- vim.regex is always magic, see `:help vim.regex`
@@ -1307,7 +1308,7 @@ function Previewer.buffer_or_file:set_cursor_hl(entry)
13071308
---@diagnostic disable-next-line: param-type-mismatch
13081309
local reg = utils.vim_regex(regex, { silent = true })
13091310
if reg then
1310-
if regex ~= regex:lower() then
1311+
if case_sensitive then
13111312
regex_start, regex_end = reg:match_line(buf, lnum - 1, col - 1)
13121313
else
13131314
local line = api.nvim_buf_get_lines(buf, lnum - 1, lnum, false)[1] or ""

0 commit comments

Comments
 (0)