Allow styled extension panel lines
- commit
- e0c933ad7e10eb280e399564610678567f808da0
- author
- patriceckhart · · 2026-05-19 15:47 UTC
- parent
- 25e7da2
- signature
- unsigned
- refs
- tag: v0.1.83
1 file · +5 -2
M internal/agent/modes/ext_panel_dialog.go +5 -2
| @@ -64,7 +64,7 @@ func (d *extPanelDialog) Render(th tui.Theme, width int) []string { | |||
| 64 | 64 | plain := stripANSIBytes(l) | |
| 65 | 65 | trimmed := strings.TrimLeft(plain, " ") | |
| 66 | 66 | selected := strings.HasPrefix(trimmed, "▸ ") || strings.HasPrefix(trimmed, "● ") | |
| 67 | - | out = append(out, styleExtPanelLine(th, plain, width, selected)) | |
| 67 | + | out = append(out, styleExtPanelLine(th, l, plain, width, selected)) | |
| 68 | 68 | } | |
| 69 | 69 | if strings.TrimSpace(d.footer) != "" { | |
| 70 | 70 | out = append(out, "") | |
| @@ -74,7 +74,7 @@ func (d *extPanelDialog) Render(th tui.Theme, width int) []string { | |||
| 74 | 74 | return out | |
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | - | func styleExtPanelLine(th tui.Theme, plain string, width int, selected bool) string { | |
| 77 | + | func styleExtPanelLine(th tui.Theme, raw string, plain string, width int, selected bool) string { | |
| 78 | 78 | if selected { | |
| 79 | 79 | if visible := runewidth.StringWidth(plain); visible < width { | |
| 80 | 80 | plain += strings.Repeat(" ", width-visible) | |
| @@ -83,6 +83,9 @@ func styleExtPanelLine(th tui.Theme, plain string, width int, selected bool) str | |||
| 83 | 83 | green := fmt.Sprintf("\x1b[38;5;%dm\x1b[48;5;%dm", th.Tool, th.SelectionBG) | |
| 84 | 84 | return base + strings.ReplaceAll(plain, "✓", green+"✓"+base) + "\x1b[0m" | |
| 85 | 85 | } | |
| 86 | + | if raw != plain { | |
| 87 | + | return raw + "\x1b[0m" | |
| 88 | + | } | |
| 86 | 89 | styled := th.FG256(th.Muted, plain) | |
| 87 | 90 | styled = strings.ReplaceAll(styled, "✓", th.FG256(th.Tool, "✓")) | |
| 88 | 91 | return styled | |
| @@ -64,7 +64,7 @@ func (d *extPanelDialog) Render(th tui.Theme, width int) []string { | |||||
| 64 | plain := stripANSIBytes(l) | 64 | plain := stripANSIBytes(l) | ||
| 65 | trimmed := strings.TrimLeft(plain, " ") | 65 | trimmed := strings.TrimLeft(plain, " ") | ||
| 66 | selected := strings.HasPrefix(trimmed, "▸ ") || strings.HasPrefix(trimmed, "● ") | 66 | selected := strings.HasPrefix(trimmed, "▸ ") || strings.HasPrefix(trimmed, "● ") | ||
| 67 | - | out = append(out, styleExtPanelLine(th, plain, width, selected)) | 67 | + | out = append(out, styleExtPanelLine(th, l, plain, width, selected)) |
| 68 | } | 68 | } | ||
| 69 | if strings.TrimSpace(d.footer) != "" { | 69 | if strings.TrimSpace(d.footer) != "" { | ||
| 70 | out = append(out, "") | 70 | out = append(out, "") | ||
| @@ -74,7 +74,7 @@ func (d *extPanelDialog) Render(th tui.Theme, width int) []string { | |||||
| 74 | return out | 74 | return out | ||
| 75 | } | 75 | } | ||
| 76 | 76 | ||||
| 77 | - | func styleExtPanelLine(th tui.Theme, plain string, width int, selected bool) string { | 77 | + | func styleExtPanelLine(th tui.Theme, raw string, plain string, width int, selected bool) string { |
| 78 | if selected { | 78 | if selected { | ||
| 79 | if visible := runewidth.StringWidth(plain); visible < width { | 79 | if visible := runewidth.StringWidth(plain); visible < width { | ||
| 80 | plain += strings.Repeat(" ", width-visible) | 80 | plain += strings.Repeat(" ", width-visible) | ||
| @@ -83,6 +83,9 @@ func styleExtPanelLine(th tui.Theme, plain string, width int, selected bool) str | |||||
| 83 | green := fmt.Sprintf("\x1b[38;5;%dm\x1b[48;5;%dm", th.Tool, th.SelectionBG) | 83 | green := fmt.Sprintf("\x1b[38;5;%dm\x1b[48;5;%dm", th.Tool, th.SelectionBG) | ||
| 84 | return base + strings.ReplaceAll(plain, "✓", green+"✓"+base) + "\x1b[0m" | 84 | return base + strings.ReplaceAll(plain, "✓", green+"✓"+base) + "\x1b[0m" | ||
| 85 | } | 85 | } | ||
| 86 | + | if raw != plain { | |||
| 87 | + | return raw + "\x1b[0m" | |||
| 88 | + | } | |||
| 86 | styled := th.FG256(th.Muted, plain) | 89 | styled := th.FG256(th.Muted, plain) | ||
| 87 | styled = strings.ReplaceAll(styled, "✓", th.FG256(th.Tool, "✓")) | 90 | styled = strings.ReplaceAll(styled, "✓", th.FG256(th.Tool, "✓")) | ||
| 88 | return styled | 91 | return styled | ||