diff --git a/lua/octo/ui/writers.lua b/lua/octo/ui/writers.lua index 7c91f2b0f..12c2df87d 100644 --- a/lua/octo/ui/writers.lua +++ b/lua/octo/ui/writers.lua @@ -17,7 +17,7 @@ function M.write_block(bufnr, lines, line, mark) mark = mark or false if type(lines) == "string" then - lines = vim.split(lines, "\n", true) + lines = vim.split(lines, "\n") end -- write content lines @@ -46,7 +46,9 @@ function M.write_block(bufnr, lines, line, mark) end return vim.api.nvim_buf_set_extmark(bufnr, constants.OCTO_COMMENT_NS, math.max(0, start_line - 1 - 1), 0, { - end_line = math.min(end_line + 2 - 1, vim.api.nvim_buf_line_count(bufnr)), + virt_text = { { "foo ", "Normal" } }, + virt_text_pos = "inline", + end_line = end_line, end_col = 0, }) end @@ -595,9 +597,20 @@ function M.write_comment(bufnr, comment, kind, line) if vim.startswith(comment_body, constants.NO_BODY_MSG) or utils.is_blank(comment_body) then comment_body = " " end - local content = vim.split(comment_body, "\n", true) + local content = vim.split(comment_body, "\n") vim.list_extend(content, { "" }) + + -- Set extmark with virtual text at the beginning of the line local comment_mark = M.write_block(bufnr, content, line, true) + -- + -- -- Define the number of spaces for indentation (e.g., 4 spaces per indent level) + -- local indent_text = string.rep(" ", 2 * 4) -- Adjust 4 based on your desired indent width + -- vim.api.nvim_buf_set_extmark(bufnr, comment_vt_ns, line - 1, 0, { + -- virt_lines = { { { "foo" .. indent_text, "Normal" } }, { { "bar" .. indent_text, "Normal" } } }, + -- virt_lines_leftcol = true, + -- end_row = line + 1, + -- virt_text_pos = "inline", + -- }) line = line + #content