Skip to content

Commit

Permalink
fix(jump): temporarily set selection=inclusive. Closes #81
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 29, 2023
1 parent 8f168de commit 5c9505a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lua/flash/jump.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ function M.jump(match, state)
M._jump(match, state, { op = is_op })
end

function M.fix_selection()
local selection = vim.go.selection
vim.go.selection = "inclusive"
vim.schedule(function()
vim.go.selection = selection
end)
end

-- Remote operator pending mode.Cancel the operator and
-- re-trigger the operator in the remote window.
---@param match Flash.Match
Expand Down Expand Up @@ -156,6 +164,7 @@ end
---@return Flash.Match?
function M._jump(match, state, opts)
opts = opts or {}
M.fix_selection()
-- select range
if state.opts.jump.pos == "range" then
if vim.fn.mode() == "v" then
Expand Down

0 comments on commit 5c9505a

Please sign in to comment.