Skip to content

Commit 2588680

Browse files
committed
fix: add padding for linewise comments on empty lines (numToStr#494)
1 parent e30b7f2 commit 2588680

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/Comment/utils.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ function U.commenter(left, right, padding, scol, ecol, tabbed)
199199
local pad = U.get_pad(padding)
200200
local ll = U.is_empty(left) and left or (left .. pad)
201201
local rr = U.is_empty(right) and right or (pad .. right)
202-
local empty = string.rep(tabbed and '\t' or ' ', scol or 0) .. left .. right
202+
-- Only use ll (and not also rr) since we don't want to add padding twice
203+
local empty = string.rep(tabbed and '\t' or ' ', scol or 0) .. ll .. right
203204
local is_lw = scol and not ecol
204205

205206
return function(line)

0 commit comments

Comments
 (0)