Skip to content

Commit efce6f0

Browse files
--wip-- [skip ci]
1 parent ab4889c commit efce6f0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

lua/octo/ui/writers.lua

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function M.write_block(bufnr, lines, line, mark)
1717
mark = mark or false
1818

1919
if type(lines) == "string" then
20-
lines = vim.split(lines, "\n", true)
20+
lines = vim.split(lines, "\n")
2121
end
2222

2323
-- write content lines
@@ -46,7 +46,9 @@ function M.write_block(bufnr, lines, line, mark)
4646
end
4747

4848
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,
5052
end_col = 0,
5153
})
5254
end
@@ -595,9 +597,20 @@ function M.write_comment(bufnr, comment, kind, line)
595597
if vim.startswith(comment_body, constants.NO_BODY_MSG) or utils.is_blank(comment_body) then
596598
comment_body = " "
597599
end
598-
local content = vim.split(comment_body, "\n", true)
600+
local content = vim.split(comment_body, "\n")
599601
vim.list_extend(content, { "" })
602+
603+
-- Set extmark with virtual text at the beginning of the line
600604
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+
-- })
601614

602615
line = line + #content
603616

0 commit comments

Comments
 (0)