Skip to content

Commit 674be75

Browse files
authored
fix: use TableBorderSet.ColumnSep instead of hardcoded pipe (#33)
Add ColumnSep field to TableBorderSet for the inner column separator. Falls back to "│" if empty for backwards compatibility with custom border sets that omit the field.
1 parent 01bb8e4 commit 674be75

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

theme.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type TableBorderSet struct {
129129
FooterLeft string // footer-row left junction
130130
FooterRight string // footer-row right junction
131131
FooterCross string // footer-row interior junction
132+
ColumnSep string // vertical separator between columns (defaults to "│")
132133
}
133134

134135
// BoxBorderSet returns a TableBorderSet using full Unicode box-drawing characters.
@@ -155,6 +156,7 @@ func BoxBorderSet() TableBorderSet {
155156
FooterLeft: "├",
156157
FooterRight: "┤",
157158
FooterCross: "┼",
159+
ColumnSep: "│",
158160
}
159161
}
160162

@@ -173,6 +175,7 @@ func MinimalBorderSet() TableBorderSet {
173175
FooterRight: "",
174176
FooterCross: "┼",
175177
Cross: "┼",
178+
ColumnSep: "│",
176179
}
177180
}
178181

theme_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func TestBoxBorderSet(t *testing.T) {
9191
{"FooterLeft", bs.FooterLeft, "├"},
9292
{"FooterRight", bs.FooterRight, "┤"},
9393
{"FooterCross", bs.FooterCross, "┼"},
94+
{"ColumnSep", bs.ColumnSep, "│"},
9495
}
9596

9697
for _, f := range fields {

typography.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,11 @@ func (t *Typography) tableRow(row []string, style lipgloss.Style, colWidths []in
637637
sep = t.theme.TableBorder.Render(bs.Left)
638638
end = t.theme.TableBorder.Render(bs.Right)
639639
}
640-
inner := t.theme.TableBorder.Render("│")
640+
colSep := bs.ColumnSep
641+
if colSep == "" {
642+
colSep = "│"
643+
}
644+
inner := t.theme.TableBorder.Render(colSep)
641645
return sep + strings.Join(cells, inner) + end
642646
}
643647

0 commit comments

Comments
 (0)