Skip to content

Commit 546c487

Browse files
authored
change: use starting column when using *_current_* apis (#136)
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.
1 parent 03b2a8f commit 546c487

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/Comment/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ end
116116
---@return CRange
117117
function U.get_region(vmode)
118118
if not vmode then
119-
local row, col = unpack(A.nvim_win_get_cursor(0))
120-
return { srow = row, scol = col, erow = row, ecol = col }
119+
local row = unpack(A.nvim_win_get_cursor(0))
120+
return { srow = row, scol = 0, erow = row, ecol = 0 }
121121
end
122122

123123
local m = A.nvim_buf_get_mark

0 commit comments

Comments
 (0)