Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/ui/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]"
)
Expand Down
13 changes: 13 additions & 0 deletions internal/ui/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions internal/ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading