diff --git a/internal/ui/benchmark.go b/internal/ui/benchmark.go index 3908b585..2c01b216 100644 --- a/internal/ui/benchmark.go +++ b/internal/ui/benchmark.go @@ -68,7 +68,7 @@ type benchmarkDetailTranscriptCache struct { const ( benchmarkDetailCopyLabel = "[ (C) COPY ]" benchmarkDetailCloseLabel = "[ (X) CLOSE ]" - benchmarkClearAllLabel = "[ CLEAR ALL ]" + benchmarkClearAllLabel = "[ (L) CLEAR ALL ]" benchmarkScopeCancelLabel = "[ (X) CANCEL ]" benchmarkScopeDoneLabel = "[ (D) DONE ]" ) diff --git a/internal/ui/benchmark_test.go b/internal/ui/benchmark_test.go index c55b9133..3c58f6a0 100644 --- a/internal/ui/benchmark_test.go +++ b/internal/ui/benchmark_test.go @@ -249,12 +249,25 @@ func TestBenchmarkClearAllControlClearsAccumulatedResultsOnlyWhileIdle(t *testin t.Fatalf("Clear All did not reset idle results: command=%v state=%d results=%#v", command != nil, model.benchmarkState, model.benchmarkResults) } + model.benchmarkState = benchmarkFinished + model.benchmarkResults = []codex.BenchmarkResult{result} + updated, command = model.Update(key('l')) + model = updated.(Model) + if command == nil || model.flashedButton != footerButtonBenchmarkClearAll || len(model.benchmarkResults) != 0 || model.benchmarkState != benchmarkIdle { + t.Fatalf("L did not clear idle results: command=%v button=%d state=%d results=%#v", command != nil, model.flashedButton, model.benchmarkState, model.benchmarkResults) + } + model.benchmarkState = benchmarkRunning model.benchmarkResults = []codex.BenchmarkResult{result} clearX, clearY = renderedTextStart(t, model, benchmarkClearAllLabel) if got := model.benchmarkButtonAt(clearX, clearY); got != footerButtonNone { t.Fatalf("running Clear All hit target = %d, want none", got) } + updated, command = model.Update(key('l')) + model = updated.(Model) + if command != nil || len(model.benchmarkResults) != 1 { + t.Fatalf("running benchmark accepted L: command=%v results=%#v", command != nil, model.benchmarkResults) + } } func TestBenchmarkRowClickOpensScrollableBenchmarkOnlyDetail(t *testing.T) { diff --git a/internal/ui/model.go b/internal/ui/model.go index 672025e0..26322e11 100644 --- a/internal/ui/model.go +++ b/internal/ui/model.go @@ -451,6 +451,10 @@ func (m Model) Update(message tea.Msg) (tea.Model, tea.Cmd) { if m.meterView == viewBenchmark && !m.benchmarkScopeOpen && (m.benchmarkDetail != nil || m.benchmarkResultsCopyAvailable()) { return m.pressFooterButton(footerButtonBenchmarkCopy) } + case "l": + if m.meterView == viewBenchmark && !m.benchmarkScopeOpen && m.benchmarkDetail == nil && !m.benchmarkRunActive() && len(m.benchmarkResults) > 0 { + return m.pressFooterButton(footerButtonBenchmarkClearAll) + } case "a": if m.meterView == viewBenchmark && !m.benchmarkScopeOpen && m.benchmarkDetail == nil { return m.pressFooterButton(footerButtonBenchmarkAll)