Skip to content

Commit

Permalink
change: use starting column when using *_current_* apis (#136)
Browse files Browse the repository at this point in the history
When using an API function on a single line with embedded code, the commentstring detected using treesitter is not correct when using the cursor position. To fix this, use the starting column position when `vmode` is set to nil.
  • Loading branch information
declancm committed Apr 1, 2022
1 parent 03b2a8f commit 546c487
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/Comment/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ end
---@return CRange
function U.get_region(vmode)
if not vmode then
local row, col = unpack(A.nvim_win_get_cursor(0))
return { srow = row, scol = col, erow = row, ecol = col }
local row = unpack(A.nvim_win_get_cursor(0))
return { srow = row, scol = 0, erow = row, ecol = 0 }
end

local m = A.nvim_buf_get_mark
Expand Down

0 comments on commit 546c487

Please sign in to comment.