Skip to content

Commit fbc84eb

Browse files
fix(ui): move cell boundary markers from EOL to sign column
Boundaries now render as ╭/│/╰ bracket in the sign column instead of floating at random positions at end of line. Single-line cells show ◆. Normal mode has zero EOL virtual text — clean and predictable. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8014981 commit fbc84eb

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

lua/sagefs/cell_highlight.lua

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,30 @@ end
7373

7474
M.clear = clear
7575

76+
--- Resolve sign_text character based on style and position in cell
77+
local function sign_char(style, i, start_line, end_line)
78+
if style ~= "normal" and style ~= "full" then return "" end
79+
local is_single = (start_line == end_line)
80+
if is_single then return "" end
81+
if i == start_line then return "" end
82+
if i == end_line then return "" end
83+
return ""
84+
end
85+
7686
--- Build virt_text for a line based on style and position
7787
local function build_virt_text(style, i, start_line, end_line, cell_lines)
7888
if style == "minimal" then return nil end
7989

80-
local is_single = (start_line == end_line)
8190
local is_top = (i == start_line)
8291
local is_bottom = (i == end_line)
8392

84-
if style == "normal" then
85-
if is_single then
86-
return { { "" .. cell_lines, "SageFsCellBound" } }
87-
elseif is_top then
88-
return { { "", "SageFsCellBound" } }
89-
elseif is_bottom then
90-
return { { "" .. cell_lines, "SageFsCellBound" } }
91-
end
92-
elseif style == "full" then
93+
-- Full mode: show line count at top, "cell end" at bottom
94+
if style == "full" then
9395
local line_word = cell_lines == 1 and "line" or "lines"
9496
if is_top then
95-
return { { " " .. cell_lines .. " " .. line_word, "SageFsCellBound" } }
97+
return { { " " .. cell_lines .. " " .. line_word, "SageFsCellBound" } }
9698
elseif is_bottom then
97-
return { { " cell end", "SageFsCellBound" } }
99+
return { { " cell end", "SageFsCellBound" } }
98100
end
99101
end
100102
return nil
@@ -141,7 +143,7 @@ local function render(buf, start_line, end_line)
141143

142144
for i = start_line, math.min(end_line, line_count) do
143145
local opts = {
144-
sign_text = "",
146+
sign_text = sign_char(style, i, start_line, end_line),
145147
sign_hl_group = hl.bar,
146148
number_hl_group = "SageFsCellNumber",
147149
priority = 5,

0 commit comments

Comments
 (0)