From 9f4f4ff120824d57fd160e362228f3fdbd383db4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:45:11 +0000 Subject: [PATCH 1/4] Initial plan From fbba43f2f8fe7063e4353ffb1a943d031f6a0a64 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:48:16 +0000 Subject: [PATCH 2/4] Fix status histogram: add abbreviation map and move counts to legend Co-authored-by: becheran <22472855+becheran@users.noreply.github.com> --- internal/ui/ui.go | 63 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index ca93f13..ce8a627 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -3,7 +3,6 @@ package ui import ( "fmt" "log" - "slices" "sort" "strings" @@ -18,6 +17,28 @@ const ( keepRoutineHist = 100 ) +// statusAbbreviations maps common goroutine status names to consistent abbreviations +var statusAbbreviations = map[string]string{ + "running": "run", + "runnable": "rbl", + "waiting": "wai", + "IO wait": "IO", + "chan receive": "cha", + "chan send": "ch1", + "select": "sel", + "sync.Mutex.Lock": "syn", + "sync.Cond.Wait": "syw", + "syscall": "sys", + "sleep": "slp", + "idle": "idl", + "dead": "ded", + "copystack": "cps", + "preempted": "pre", + "GC assist wait": "gca", + "GC sweep wait": "gcs", + "GC scavenge wait": "gcv", +} + // UI contains all user interface elements type UI struct { list *widgets.List @@ -90,7 +111,6 @@ func NewUI() *UI { barchart.BarWidth = 3 barchart.BarGap = 1 barchart.BarColors = []termui.Color{termui.ColorGreen} - barchart.NumStyles = []termui.Style{termui.NewStyle(termui.ColorBlack)} barchart.LabelStyles = []termui.Style{termui.NewStyle(termui.ColorWhite)} barchart.PaddingTop = padding barchart.PaddingRight = padding @@ -181,21 +201,42 @@ func (ui *UI) updateStatus() { sort.Strings(types) data := make([]float64, len(types)) labels := make([]string, len(types)) - label := "" - uniqueID := 1 + legend := "" + usedAbbrevs := make(map[string]bool) + for idx, t := range types { data[idx] = typeCount[t] - newLabel := t[:3] - if slices.Contains(labels, newLabel) { - newLabel = fmt.Sprintf("%s%d", t[:2], uniqueID) - uniqueID++ + + // Use predefined abbreviation or fallback to custom logic + abbrev, exists := statusAbbreviations[t] + if !exists { + // Fallback: use first 3 characters + abbrev = t[:min(3, len(t))] + } + + // Handle collisions by adding a number suffix + originalAbbrev := abbrev + counter := 2 + for usedAbbrevs[abbrev] { + abbrev = fmt.Sprintf("%s%d", originalAbbrev[:min(2, len(originalAbbrev))], counter) + counter++ } - labels[idx] = newLabel - label = fmt.Sprintf("%s%s: %s\n", label, newLabel, t) + usedAbbrevs[abbrev] = true + + labels[idx] = abbrev + // Add to legend with count + legend = fmt.Sprintf("%s%s: %s (%.0f)\n", legend, abbrev, t, typeCount[t]) } ui.barchart.Data = data ui.barchart.Labels = labels - ui.barchartLegend.Text = label + ui.barchartLegend.Text = legend +} + +func min(a, b int) int { + if a < b { + return a + } + return b } func (ui *UI) updateList() { From acaf85eb0248b8cebc6a00841c1285ef93c0e8eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:49:36 +0000 Subject: [PATCH 3/4] Address code review: remove unnecessary blank lines Co-authored-by: becheran <22472855+becheran@users.noreply.github.com> --- internal/ui/ui.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index ce8a627..1870728 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -203,10 +203,10 @@ func (ui *UI) updateStatus() { labels := make([]string, len(types)) legend := "" usedAbbrevs := make(map[string]bool) - + for idx, t := range types { data[idx] = typeCount[t] - + // Use predefined abbreviation or fallback to custom logic abbrev, exists := statusAbbreviations[t] if !exists { @@ -222,7 +222,7 @@ func (ui *UI) updateStatus() { counter++ } usedAbbrevs[abbrev] = true - + labels[idx] = abbrev // Add to legend with count legend = fmt.Sprintf("%s%s: %s (%.0f)\n", legend, abbrev, t, typeCount[t]) From 2b9f941b2581f7f2618ec27f8ca392fd56b3937b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 22 Feb 2026 21:29:07 +0000 Subject: [PATCH 4/4] Use full status names instead of abbreviations, move counts to legend Co-authored-by: becheran <22472855+becheran@users.noreply.github.com> --- internal/ui/ui.go | 55 +++-------------------------------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index 1870728..e2de0a4 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -17,28 +17,6 @@ const ( keepRoutineHist = 100 ) -// statusAbbreviations maps common goroutine status names to consistent abbreviations -var statusAbbreviations = map[string]string{ - "running": "run", - "runnable": "rbl", - "waiting": "wai", - "IO wait": "IO", - "chan receive": "cha", - "chan send": "ch1", - "select": "sel", - "sync.Mutex.Lock": "syn", - "sync.Cond.Wait": "syw", - "syscall": "sys", - "sleep": "slp", - "idle": "idl", - "dead": "ded", - "copystack": "cps", - "preempted": "pre", - "GC assist wait": "gca", - "GC sweep wait": "gcs", - "GC scavenge wait": "gcv", -} - // UI contains all user interface elements type UI struct { list *widgets.List @@ -108,7 +86,7 @@ func NewUI() *UI { barchart := widgets.NewBarChart() barchart.Title = "Status" - barchart.BarWidth = 3 + barchart.BarWidth = 5 barchart.BarGap = 1 barchart.BarColors = []termui.Color{termui.ColorGreen} barchart.LabelStyles = []termui.Style{termui.NewStyle(termui.ColorWhite)} @@ -202,43 +180,16 @@ func (ui *UI) updateStatus() { data := make([]float64, len(types)) labels := make([]string, len(types)) legend := "" - usedAbbrevs := make(map[string]bool) - for idx, t := range types { data[idx] = typeCount[t] - - // Use predefined abbreviation or fallback to custom logic - abbrev, exists := statusAbbreviations[t] - if !exists { - // Fallback: use first 3 characters - abbrev = t[:min(3, len(t))] - } - - // Handle collisions by adding a number suffix - originalAbbrev := abbrev - counter := 2 - for usedAbbrevs[abbrev] { - abbrev = fmt.Sprintf("%s%d", originalAbbrev[:min(2, len(originalAbbrev))], counter) - counter++ - } - usedAbbrevs[abbrev] = true - - labels[idx] = abbrev - // Add to legend with count - legend = fmt.Sprintf("%s%s: %s (%.0f)\n", legend, abbrev, t, typeCount[t]) + labels[idx] = t + legend = fmt.Sprintf("%s%s: %.0f\n", legend, t, typeCount[t]) } ui.barchart.Data = data ui.barchart.Labels = labels ui.barchartLegend.Text = legend } -func min(a, b int) int { - if a < b { - return a - } - return b -} - func (ui *UI) updateList() { if ui.filter.Text == "" || !ui.filtered { ui.filteredData = ui.origData