Skip to content
Open
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
10 changes: 7 additions & 3 deletions lua/Comment/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,14 @@ function U.get_region(opmode)
return { srow = row, scol = 0, erow = row, ecol = 0 }
end

local marks = string.match(opmode, '[vV]') and { '<', '>' } or { '[', ']' }
local sln, eln = A.nvim_buf_get_mark(0, marks[1]), A.nvim_buf_get_mark(0, marks[2])
local marks =
string.match(vim.fn.mode(), '[vV]') and { 'v', '.' }
or (string.match(opmode, '[vV]') and { "'<", "'>" }
or { "'[", "']" })

return { srow = sln[1], scol = sln[2], erow = eln[1], ecol = eln[2] }
local sln, eln = vim.fn.getpos(marks[1]), vim.fn.getpos(marks[2])

return { srow = sln[2], scol = sln[3] - 1, erow = eln[2], ecol = eln[3] - 1 }
end

---Get lines from the current position to the given count
Expand Down