Skip to content

Commit

Permalink
Safe call getregionpos
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jun 11, 2024
1 parent 2a1263a commit d78d6c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lua/fittencode/engines/actions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,13 @@ local function make_range(buffer)
in_v = true
if fn.has('nvim-0.10') == 1 then
region = fn.getregion(fn.getpos('.'), fn.getpos('v'), { type = fn.mode() })
end
if fn.has('nvim-0.11') == 1 then
-- [bufnum, lnum, col, off]
pos = fn.getregionpos(fn.getpos('.'), fn.getpos('v'))
local success, result = pcall(fn.getregionpos, fn.getpos('.'), fn.getpos('v'))
if success then
pos = result
end
end
end

Expand Down

0 comments on commit d78d6c6

Please sign in to comment.