Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions lua/bqf/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ function M.initialize()
)
end
end
api.nvim_buf_set_keymap(
0,
'n',
'<2-LeftMouse>',
'<CR>',
{desc = utils.has08() and 'Open the item under the cursor' or nil, nowait = true, noremap = false}
)
end

---
Expand Down
16 changes: 13 additions & 3 deletions lua/bqf/preview/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,12 @@ end

function M.mouseClick(mode)
local clickedWinid = checkClicked()
local clickedBufnr = api.nvim_win_get_buf(clickedWinid)
local qfBufClicked = api.nvim_get_option_value('bt', {buf = clickedBufnr}) == 'quickfix'
if not clicked then
api.nvim_set_current_win(clickedWinid)
if not qfBufClicked then
api.nvim_set_current_win(clickedWinid)
end
cmd(('norm! %dgg%d|'):format(vim.v.mouse_lnum, vim.v.mouse_col))
else
if mode == 't' then
Expand All @@ -437,9 +441,15 @@ end

function M.mouseDoubleClick(mode)
local clickedWinid = checkClicked()
local clickedBufnr = api.nvim_win_get_buf(clickedWinid)
local qfBufClicked = api.nvim_get_option_value('bt', {buf = clickedBufnr}) == 'quickfix'
if api.nvim_get_current_win() == clickedWinid then
-- ^M = 0x0d
cmd(('norm! %c'):format(0x0d))
if qfBufClicked then
-- ^M = 0x0d
cmd(('norm %c'):format(0x0d))
else
cmd(('norm! %c'):format(0x0d))
end
elseif clicked then
if mode == 't' then
cmd('startinsert')
Expand Down