Skip to content

Commit b193d8f

Browse files
authored
Merge pull request #632 from phantom5099/main
pref(tui):补充状态栏动态效果
2 parents 882fad7 + 29f7079 commit b193d8f

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

internal/tui/core/app/update.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,7 @@ func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
114114
}
115115
a.syncFooterErrorToast()
116116
a.spinner, spinCmd = a.spinner.Update(msg)
117-
if a.isBusy() {
118-
cmds = append(cmds, spinCmd)
119-
}
117+
cmds = append(cmds, spinCmd)
120118
if a.deferredLogPersistCmd != nil {
121119
cmds = append(cmds, a.deferredLogPersistCmd)
122120
a.deferredLogPersistCmd = nil

internal/tui/core/app/view.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ func (a App) renderHeader(width int) string {
100100
status := compactStatusText(a.state.StatusText, max(18, width/3))
101101
if a.state.IsAgentRunning {
102102
if a.runProgressKnown {
103-
progressLabel := tuiutils.Fallback(strings.TrimSpace(a.runProgressLabel), tuiutils.Fallback(status, statusRunning))
104-
percent := int(a.runProgressValue*100 + 0.5)
105-
status = fmt.Sprintf("%d%% %s", percent, progressLabel)
103+
phaseLabel := tuiutils.Fallback(strings.TrimSpace(a.runProgressLabel), tuiutils.Fallback(status, statusRunning))
104+
status = a.spinner.View() + " " + phaseLabel
106105
} else if status != statusThinking {
107106
status = tuiutils.Fallback(status, statusRunning)
108107
}

internal/tui/core/app/view_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,8 @@ func TestViewNormalIncludesHeaderAndBody(t *testing.T) {
720720
if !strings.Contains(view, "NeoCode") {
721721
t.Fatalf("expected header text, got %q", view)
722722
}
723-
if !strings.Contains(view, "42% loading") {
724-
t.Fatalf("expected progress header, got %q", view)
723+
if !strings.Contains(view, "loading") {
724+
t.Fatalf("expected progress label in header, got %q", view)
725725
}
726726
if !strings.Contains(view, "cwd: /tmp/workdir") {
727727
t.Fatalf("expected current workdir in header, got %q", view)

0 commit comments

Comments
 (0)