Skip to content

Commit 8c20f0a

Browse files
committed
Fix line number order
1 parent c68d487 commit 8c20f0a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/gitlinker/buffer.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ function M.get_range(mode, add_current_line_on_normal_mode)
1515
local lstart
1616
local lend
1717
if mode == "v" then
18-
lstart = vim.fn.getpos("v")[2]
19-
lend = vim.fn.getcurpos()[2]
18+
local pos1 = vim.fn.getpos("v")[2]
19+
local pos2 = vim.fn.getcurpos()[2]
20+
lstart = math.min(pos1, pos2)
21+
lend = math.max(pos1, pos2)
2022
elseif add_current_line_on_normal_mode == true then
2123
lstart = M.get_curr_line()
2224
end

0 commit comments

Comments
 (0)