From 5336843de878c6e34df92982608f82930588d581 Mon Sep 17 00:00:00 2001 From: Tino Ehrich Date: Wed, 19 Nov 2025 10:41:58 +0100 Subject: [PATCH] fix: change thinking level cycling from Tab to Ctrl+T Tab key was preventing file path autocomplete from working. Changed to Ctrl+T to avoid conflict with Tab completion. - Tab now works normally for file/path autocomplete - Ctrl+T cycles through thinking levels - Shows message if model doesn't support thinking --- packages/coding-agent/src/tui/custom-editor.ts | 12 +++++------- packages/coding-agent/src/tui/tui-renderer.ts | 15 ++++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/coding-agent/src/tui/custom-editor.ts b/packages/coding-agent/src/tui/custom-editor.ts index 57930fab..b89a64d5 100644 --- a/packages/coding-agent/src/tui/custom-editor.ts +++ b/packages/coding-agent/src/tui/custom-editor.ts @@ -6,15 +6,13 @@ import { Editor } from "@mariozechner/pi-tui"; export class CustomEditor extends Editor { public onEscape?: () => void; public onCtrlC?: () => void; - public onTab?: () => boolean; + public onCtrlT?: () => void; handleInput(data: string): void { - // Intercept Tab key when autocomplete is not showing - if (data === "\t" && !this.isShowingAutocomplete() && this.onTab) { - const handled = this.onTab(); - if (handled) { - return; - } + // Intercept Ctrl+T for thinking level cycling + if (data === "\x14" && this.onCtrlT) { + this.onCtrlT(); + return; } // Intercept Escape key - but only if autocomplete is NOT active diff --git a/packages/coding-agent/src/tui/tui-renderer.ts b/packages/coding-agent/src/tui/tui-renderer.ts index 8dbdbfb1..01713d24 100644 --- a/packages/coding-agent/src/tui/tui-renderer.ts +++ b/packages/coding-agent/src/tui/tui-renderer.ts @@ -169,7 +169,7 @@ export class TuiRenderer { chalk.dim("ctrl+k") + chalk.gray(" to delete line") + "\n" + - chalk.dim("tab") + + chalk.dim("ctrl+t") + chalk.gray(" to cycle thinking") + "\n" + chalk.dim("/") + @@ -213,8 +213,8 @@ export class TuiRenderer { this.handleCtrlC(); }; - this.editor.onTab = () => { - return this.cycleThinkingLevel(); + this.editor.onCtrlT = () => { + this.cycleThinkingLevel(); }; // Handle editor submission @@ -607,10 +607,13 @@ export class TuiRenderer { this.ui.requestRender(); } - private cycleThinkingLevel(): boolean { + private cycleThinkingLevel(): void { // Only cycle if model supports thinking if (!this.agent.state.model?.reasoning) { - return false; // Not handled, let default Tab behavior continue + this.chatContainer.addChild(new Spacer(1)); + this.chatContainer.addChild(new Text(chalk.dim("Current model does not support thinking"), 1, 0)); + this.ui.requestRender(); + return; } const levels: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high"]; @@ -632,8 +635,6 @@ export class TuiRenderer { this.chatContainer.addChild(new Spacer(1)); this.chatContainer.addChild(new Text(chalk.dim(`Thinking level: ${nextLevel}`), 1, 0)); this.ui.requestRender(); - - return true; // Handled } clearEditor(): void {