From f26ac4ce111a96ec03860059c20ba4298933f8b4 Mon Sep 17 00:00:00 2001 From: ushmz <44394399+ushmz@users.noreply.github.com> Date: Sun, 14 Dec 2025 00:23:34 +0900 Subject: [PATCH] feat: align note display with code indentation Note virtual lines now match the indentation of the line they're attached to, making them visually aligned with the code structure. Changes: - Extract leading whitespace from the target line - Apply the same indentation to all note virtual lines - Remove "Note: " prefix for cleaner display Before: Note: This is a note Second line function foo() After: This is a note Second line function foo() --- lua/tabi/ui/display.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/tabi/ui/display.lua b/lua/tabi/ui/display.lua index 12d4b29..d199c02 100644 --- a/lua/tabi/ui/display.lua +++ b/lua/tabi/ui/display.lua @@ -66,12 +66,15 @@ function M.display_note_as_virtual_line(bufnr, note) }) end + -- Get indent from the target line + local line_content = vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1] or "" + local indent = line_content:match("^%s*") or "" + -- Split note content into lines for virtual lines local virt_lines = {} local content_lines = vim.split(note.content, "\n", { plain = true }) - for i, content_line in ipairs(content_lines) do - local prefix = i == 1 and "Note: " or " " - table.insert(virt_lines, { { prefix .. content_line, "TabiNote" } }) + for _, content_line in ipairs(content_lines) do + table.insert(virt_lines, { { indent .. content_line, "TabiNote" } }) end -- Add virtual lines above the target line