Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des...' (#82) from agent/read---spec-code-core-go-cli-rfc-md-full into dev
All checks were successful
Security Scan / security (push) Successful in 35s
All checks were successful
Security Scan / security (push) Successful in 35s
This commit is contained in:
commit
5761524570
2 changed files with 19 additions and 6 deletions
|
|
@ -291,14 +291,14 @@ func (t *Table) columnWidths() []int {
|
|||
widths := make([]int, cols)
|
||||
|
||||
for i, h := range t.Headers {
|
||||
if w := displayWidth(h); w > widths[i] {
|
||||
if w := displayWidth(compileGlyphs(h)); w > widths[i] {
|
||||
widths[i] = w
|
||||
}
|
||||
}
|
||||
for _, row := range t.Rows {
|
||||
for i, cell := range row {
|
||||
if i < cols {
|
||||
if w := displayWidth(cell); w > widths[i] {
|
||||
if w := displayWidth(compileGlyphs(cell)); w > widths[i] {
|
||||
widths[i] = w
|
||||
}
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ func (t *Table) renderPlain() string {
|
|||
if i > 0 {
|
||||
sb.WriteString(sep)
|
||||
}
|
||||
cell := Pad(Truncate(h, widths[i]), widths[i])
|
||||
cell := Pad(Truncate(compileGlyphs(h), widths[i]), widths[i])
|
||||
if t.Style.HeaderStyle != nil {
|
||||
cell = t.Style.HeaderStyle.Render(cell)
|
||||
}
|
||||
|
|
@ -385,7 +385,7 @@ func (t *Table) renderPlain() string {
|
|||
if i < len(row) {
|
||||
val = row[i]
|
||||
}
|
||||
cell := Pad(Truncate(val, widths[i]), widths[i])
|
||||
cell := Pad(Truncate(compileGlyphs(val), widths[i]), widths[i])
|
||||
if style := t.resolveStyle(i, val); style != nil {
|
||||
cell = style.Render(cell)
|
||||
}
|
||||
|
|
@ -423,7 +423,7 @@ func (t *Table) renderBordered() string {
|
|||
if i < len(t.Headers) {
|
||||
h = t.Headers[i]
|
||||
}
|
||||
cell := Pad(Truncate(h, widths[i]), widths[i])
|
||||
cell := Pad(Truncate(compileGlyphs(h), widths[i]), widths[i])
|
||||
if t.Style.HeaderStyle != nil {
|
||||
cell = t.Style.HeaderStyle.Render(cell)
|
||||
}
|
||||
|
|
@ -454,7 +454,7 @@ func (t *Table) renderBordered() string {
|
|||
if i < len(row) {
|
||||
val = row[i]
|
||||
}
|
||||
cell := Pad(Truncate(val, widths[i]), widths[i])
|
||||
cell := Pad(Truncate(compileGlyphs(val), widths[i]), widths[i])
|
||||
if style := t.resolveStyle(i, val); style != nil {
|
||||
cell = style.Render(cell)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,19 @@ func TestTable_Good(t *testing.T) {
|
|||
assert.Contains(t, out, "ok")
|
||||
})
|
||||
|
||||
t.Run("glyph shortcodes render in headers and cells", func(t *testing.T) {
|
||||
restoreThemeAndColors(t)
|
||||
UseASCII()
|
||||
|
||||
tbl := NewTable(":check: NAME", "STATUS").
|
||||
WithBorders(BorderRounded)
|
||||
tbl.AddRow("core", ":warn:")
|
||||
|
||||
out := tbl.String()
|
||||
assert.Contains(t, out, "[OK] NAME")
|
||||
assert.Contains(t, out, "[WARN]")
|
||||
})
|
||||
|
||||
t.Run("max width truncates", func(t *testing.T) {
|
||||
SetColorEnabled(false)
|
||||
defer SetColorEnabled(true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue