summaryrefslogtreecommitdiffhomepage
path: root/internal/tui
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-02 13:14:41 -0500
committerAdam <[email protected]>2025-05-02 15:24:47 -0500
commitb2f24e38eda018b464def477880e9db5bb51b515 (patch)
treed02a6e74fe6024feb078e201aa2113a8001a69d8 /internal/tui
parent49037e7b28b9f76e32cef99e81ba33e2832290a5 (diff)
downloadopencode-b2f24e38eda018b464def477880e9db5bb51b515.tar.gz
opencode-b2f24e38eda018b464def477880e9db5bb51b515.zip
feat: better diagnostic visuals in status bar
Diffstat (limited to 'internal/tui')
-rw-r--r--internal/tui/components/core/status.go14
-rw-r--r--internal/tui/styles/icons.go13
2 files changed, 22 insertions, 5 deletions
diff --git a/internal/tui/components/core/status.go b/internal/tui/components/core/status.go
index 28120a430..54b8d4872 100644
--- a/internal/tui/components/core/status.go
+++ b/internal/tui/components/core/status.go
@@ -216,32 +216,36 @@ func (m *statusCmp) projectDiagnostics() string {
diagnostics := []string{}
+ errIcon := styles.CircledDigit(len(errorDiagnostics))
errStr := lipgloss.NewStyle().
Background(t.BackgroundDarker()).
Foreground(t.Error()).
- Render(fmt.Sprintf("%s %d", styles.ErrorIcon, len(errorDiagnostics)))
+ Render(errIcon)
diagnostics = append(diagnostics, errStr)
+ warnIcon := styles.CircledDigit(len(warnDiagnostics))
warnStr := lipgloss.NewStyle().
Background(t.BackgroundDarker()).
Foreground(t.Warning()).
- Render(fmt.Sprintf("%s %d", styles.WarningIcon, len(warnDiagnostics)))
+ Render(warnIcon)
diagnostics = append(diagnostics, warnStr)
+ infoIcon := styles.CircledDigit(len(infoDiagnostics))
infoStr := lipgloss.NewStyle().
Background(t.BackgroundDarker()).
Foreground(t.Info()).
- Render(fmt.Sprintf("%s %d", styles.InfoIcon, len(infoDiagnostics)))
+ Render(infoIcon)
diagnostics = append(diagnostics, infoStr)
+ hintIcon := styles.CircledDigit(len(hintDiagnostics))
hintStr := lipgloss.NewStyle().
Background(t.BackgroundDarker()).
Foreground(t.Text()).
- Render(fmt.Sprintf("%s %d", styles.HintIcon, len(hintDiagnostics)))
+ Render(hintIcon)
diagnostics = append(diagnostics, hintStr)
return styles.ForceReplaceBackgroundWithLipgloss(
- strings.Join(diagnostics, " "),
+ styles.Padded().Render(strings.Join(diagnostics, " ")),
t.BackgroundDarker(),
)
}
diff --git a/internal/tui/styles/icons.go b/internal/tui/styles/icons.go
index a79ef8bb4..8a49fce80 100644
--- a/internal/tui/styles/icons.go
+++ b/internal/tui/styles/icons.go
@@ -9,3 +9,16 @@ const (
HintIcon string = "ⓗ"
SpinnerIcon string = "⟳"
)
+
+// CircledDigit returns the Unicode circled digit/number for 0‑20.
+// out‑of‑range → "".
+func CircledDigit(n int) string {
+ switch {
+ case n == 0:
+ return "\u24EA" // ⓪
+ case 1 <= n && n <= 20:
+ return string(rune(0x2460 + n - 1)) // ①–⑳
+ default:
+ return ""
+ }
+}