fix(tui): compact empty tool call bodies
Tool calls with no result content now render just the header without a bottom rule, eliminating blank spacing for no-output or queued tool calls.
- commit
- e52a560c6a8b407a0990be800832fbdb25a14cc4
- author
- patriceckhart · · 2026-04-26 10:34 UTC
- parent
- 0194ca6
- signature
- unsigned
- refs
- tag: v0.1.20
1 file · +12 -7
M internal/tui/view.go +12 -7
| @@ -534,16 +534,21 @@ func (v *View) renderToolCall(tc ToolCallView, width int) []string { | |||
| 534 | 534 | // Finished tool call: frame the whole block with opening + | |
| 535 | 535 | // closing rules so it stands apart from surrounding assistant | |
| 536 | 536 | // prose. Matches the transcript-side framing in renderMessage. | |
| 537 | + | // When the result is empty, show just the header without rules | |
| 538 | + | // to avoid blank spacing for no-output tool calls. | |
| 539 | + | if tc.Result == "" { | |
| 540 | + | lines = append(lines, toolBlockRule(v.Theme, width)) | |
| 541 | + | lines = append(lines, head) | |
| 542 | + | return lines | |
| 543 | + | } | |
| 537 | 544 | lines = append(lines, toolBlockRule(v.Theme, width)) | |
| 538 | 545 | lines = append(lines, head) | |
| 539 | - | if tc.Result != "" { | |
| 540 | - | color := v.Theme.ToolOut | |
| 541 | - | if tc.Error { | |
| 542 | - | color = v.Theme.Error | |
| 543 | - | } | |
| 544 | - | body := toolResultBlock(v.Theme, tc.Result, width, color) | |
| 545 | - | lines = append(lines, v.collapseToolBody(body, false)...) | |
| 546 | + | color := v.Theme.ToolOut | |
| 547 | + | if tc.Error { | |
| 548 | + | color = v.Theme.Error | |
| 546 | 549 | } | |
| 550 | + | body := toolResultBlock(v.Theme, tc.Result, width, color) | |
| 551 | + | lines = append(lines, v.collapseToolBody(body, false)...) | |
| 547 | 552 | lines = append(lines, toolBlockRule(v.Theme, width)) | |
| 548 | 553 | return lines | |
| 549 | 554 | } | |
| @@ -534,16 +534,21 @@ func (v *View) renderToolCall(tc ToolCallView, width int) []string { | |||||
| 534 | // Finished tool call: frame the whole block with opening + | 534 | // Finished tool call: frame the whole block with opening + | ||
| 535 | // closing rules so it stands apart from surrounding assistant | 535 | // closing rules so it stands apart from surrounding assistant | ||
| 536 | // prose. Matches the transcript-side framing in renderMessage. | 536 | // prose. Matches the transcript-side framing in renderMessage. | ||
| 537 | + | // When the result is empty, show just the header without rules | |||
| 538 | + | // to avoid blank spacing for no-output tool calls. | |||
| 539 | + | if tc.Result == "" { | |||
| 540 | + | lines = append(lines, toolBlockRule(v.Theme, width)) | |||
| 541 | + | lines = append(lines, head) | |||
| 542 | + | return lines | |||
| 543 | + | } | |||
| 537 | lines = append(lines, toolBlockRule(v.Theme, width)) | 544 | lines = append(lines, toolBlockRule(v.Theme, width)) | ||
| 538 | lines = append(lines, head) | 545 | lines = append(lines, head) | ||
| 539 | - | if tc.Result != "" { | 546 | + | color := v.Theme.ToolOut |
| 540 | - | color := v.Theme.ToolOut | 547 | + | if tc.Error { |
| 541 | - | if tc.Error { | 548 | + | color = v.Theme.Error |
| 542 | - | color = v.Theme.Error | |||
| 543 | - | } | |||
| 544 | - | body := toolResultBlock(v.Theme, tc.Result, width, color) | |||
| 545 | - | lines = append(lines, v.collapseToolBody(body, false)...) | |||
| 546 | } | 549 | } | ||
| 550 | + | body := toolResultBlock(v.Theme, tc.Result, width, color) | |||
| 551 | + | lines = append(lines, v.collapseToolBody(body, false)...) | |||
| 547 | lines = append(lines, toolBlockRule(v.Theme, width)) | 552 | lines = append(lines, toolBlockRule(v.Theme, width)) | ||
| 548 | return lines | 553 | return lines | ||
| 549 | } | 554 | } | ||