mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 05:04:44 +00:00
fix(coding-agent): truncate bash hint line to terminal width
Fixes TUI crash on narrow terminals (< 40 chars) when displaying collapsed bash output with 'earlier lines' hint. fixes #941
This commit is contained in:
parent
b0c050582a
commit
0faba293e6
2 changed files with 2 additions and 2 deletions
|
|
@ -49,7 +49,6 @@ When closing issues via commit:
|
||||||
## Tools
|
## Tools
|
||||||
- GitHub CLI for issues/PRs
|
- GitHub CLI for issues/PRs
|
||||||
- Add package labels to issues/PRs: pkg:agent, pkg:ai, pkg:coding-agent, pkg:mom, pkg:pods, pkg:tui, pkg:web-ui
|
- Add package labels to issues/PRs: pkg:agent, pkg:ai, pkg:coding-agent, pkg:mom, pkg:pods, pkg:tui, pkg:web-ui
|
||||||
- See pi-tmux-test skill if you need to test pi interactive mode
|
|
||||||
|
|
||||||
## Style
|
## Style
|
||||||
- Keep answers short and concise
|
- Keep answers short and concise
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import {
|
||||||
Spacer,
|
Spacer,
|
||||||
Text,
|
Text,
|
||||||
type TUI,
|
type TUI,
|
||||||
|
truncateToWidth,
|
||||||
} from "@mariozechner/pi-tui";
|
} from "@mariozechner/pi-tui";
|
||||||
import stripAnsi from "strip-ansi";
|
import stripAnsi from "strip-ansi";
|
||||||
import type { ToolDefinition } from "../../../core/extensions/types.js";
|
import type { ToolDefinition } from "../../../core/extensions/types.js";
|
||||||
|
|
@ -384,7 +385,7 @@ export class ToolExecutionComponent extends Container {
|
||||||
const hint =
|
const hint =
|
||||||
theme.fg("muted", `... (${cachedSkipped} earlier lines,`) +
|
theme.fg("muted", `... (${cachedSkipped} earlier lines,`) +
|
||||||
` ${keyHint("expandTools", "to expand")})`;
|
` ${keyHint("expandTools", "to expand")})`;
|
||||||
return ["", hint, ...cachedLines];
|
return ["", truncateToWidth(hint, width, "..."), ...cachedLines];
|
||||||
}
|
}
|
||||||
// Add blank line for spacing (matches expanded case)
|
// Add blank line for spacing (matches expanded case)
|
||||||
return ["", ...cachedLines];
|
return ["", ...cachedLines];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue