@@ -17,7 +17,7 @@ function M.write_block(bufnr, lines, line, mark)
17
17
mark = mark or false
18
18
19
19
if type (lines ) == " string" then
20
- lines = vim .split (lines , " \n " , true )
20
+ lines = vim .split (lines , " \n " )
21
21
end
22
22
23
23
-- write content lines
@@ -46,7 +46,9 @@ function M.write_block(bufnr, lines, line, mark)
46
46
end
47
47
48
48
return vim .api .nvim_buf_set_extmark (bufnr , constants .OCTO_COMMENT_NS , math.max (0 , start_line - 1 - 1 ), 0 , {
49
- end_line = math.min (end_line + 2 - 1 , vim .api .nvim_buf_line_count (bufnr )),
49
+ virt_text = { { " foo " , " Normal" } },
50
+ virt_text_pos = " inline" ,
51
+ end_line = end_line ,
50
52
end_col = 0 ,
51
53
})
52
54
end
@@ -595,9 +597,20 @@ function M.write_comment(bufnr, comment, kind, line)
595
597
if vim .startswith (comment_body , constants .NO_BODY_MSG ) or utils .is_blank (comment_body ) then
596
598
comment_body = " "
597
599
end
598
- local content = vim .split (comment_body , " \n " , true )
600
+ local content = vim .split (comment_body , " \n " )
599
601
vim .list_extend (content , { " " })
602
+
603
+ -- Set extmark with virtual text at the beginning of the line
600
604
local comment_mark = M .write_block (bufnr , content , line , true )
605
+ --
606
+ -- -- Define the number of spaces for indentation (e.g., 4 spaces per indent level)
607
+ -- local indent_text = string.rep(" ", 2 * 4) -- Adjust 4 based on your desired indent width
608
+ -- vim.api.nvim_buf_set_extmark(bufnr, comment_vt_ns, line - 1, 0, {
609
+ -- virt_lines = { { { "foo" .. indent_text, "Normal" } }, { { "bar" .. indent_text, "Normal" } } },
610
+ -- virt_lines_leftcol = true,
611
+ -- end_row = line + 1,
612
+ -- virt_text_pos = "inline",
613
+ -- })
601
614
602
615
line = line + # content
603
616
0 commit comments