From a29cd80acf5842917d005cc1f2c63262085c10bb Mon Sep 17 00:00:00 2001 From: Markus Ylisiurunen Date: Fri, 5 Dec 2025 09:48:35 +0200 Subject: [PATCH] add ctrl+t shortcut to toggle llm thinking block visibility --- packages/coding-agent/CHANGELOG.md | 4 +++ packages/coding-agent/README.md | 1 + .../coding-agent/src/tui/assistant-message.ts | 25 +++++++++++-------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index cbb917f7..5b2d25c5 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- **Thinking Block Toggle**: Added `Ctrl+T` shortcut to toggle visibility of LLM thinking blocks. When toggled off, shows a static "Thinking..." label instead of full content. Useful for reducing visual clutter during long conversations. ([#113](https://github.com/badlogic/pi-mono/pull/113)) + ## [0.12.10] - 2025-12-04 ### Added diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md index cd12e872..f686a322 100644 --- a/packages/coding-agent/README.md +++ b/packages/coding-agent/README.md @@ -684,6 +684,7 @@ Change queue mode with `/queue` command. Setting is saved in `~/.pi/agent/settin - **Shift+Tab**: Cycle thinking level (for reasoning-capable models) - **Ctrl+P**: Cycle models (use `--models` to scope) - **Ctrl+O**: Toggle tool output expansion (collapsed ↔ full output) +- **Ctrl+T**: Toggle thinking block visibility (shows full content ↔ static "Thinking..." label) ## Project Context Files diff --git a/packages/coding-agent/src/tui/assistant-message.ts b/packages/coding-agent/src/tui/assistant-message.ts index 611bbcc0..31e0f80e 100644 --- a/packages/coding-agent/src/tui/assistant-message.ts +++ b/packages/coding-agent/src/tui/assistant-message.ts @@ -46,16 +46,21 @@ export class AssistantMessageComponent extends Container { // Assistant text messages with no background - trim the text // Set paddingY=0 to avoid extra spacing before tool executions this.contentContainer.addChild(new Markdown(content.text.trim(), 1, 0, getMarkdownTheme())); - } else if (content.type === "thinking" && content.thinking.trim() && !this.hideThinkingBlock) { - // Thinking traces in muted color, italic - // Use Markdown component with default text style for consistent styling - this.contentContainer.addChild( - new Markdown(content.thinking.trim(), 1, 0, getMarkdownTheme(), { - color: (text: string) => theme.fg("muted", text), - italic: true, - }), - ); - this.contentContainer.addChild(new Spacer(1)); + } else if (content.type === "thinking" && content.thinking.trim()) { + if (this.hideThinkingBlock) { + // Show static "Thinking..." label when hidden + this.contentContainer.addChild(new Text(theme.fg("muted", "Thinking..."), 1, 0)); + } else { + // Thinking traces in muted color, italic + // Use Markdown component with default text style for consistent styling + this.contentContainer.addChild( + new Markdown(content.thinking.trim(), 1, 0, getMarkdownTheme(), { + color: (text: string) => theme.fg("muted", text), + italic: true, + }), + ); + this.contentContainer.addChild(new Spacer(1)); + } } }