From 7601e15f43ab3c3175c4b2da1bb535fff50ea455 Mon Sep 17 00:00:00 2001 From: Rens Tillmann Date: Fri, 13 Mar 2026 03:15:34 +0100 Subject: [PATCH] =?UTF-8?q?fix(settings):=20text=20input=20=E2=80=94=20cur?= =?UTF-8?q?sor=20at=20end,=20block=20tab=20navigation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Cursor: call handleInput(ctrl+e) after setValue to jump to end of pre-filled string instead of leaving it at position 0 - Tab/arrow guard: add #textInputActive flag; suppress tab-switch and left/right routing to tab bar while a TextInputSubmenu is open, so arrow keys reach the Input component's cursor movement handlers instead of switching settings tabs --- .../src/modes/components/settings-selector.ts | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/coding-agent/src/modes/components/settings-selector.ts b/packages/coding-agent/src/modes/components/settings-selector.ts index 14fb1e588..d41bae42b 100644 --- a/packages/coding-agent/src/modes/components/settings-selector.ts +++ b/packages/coding-agent/src/modes/components/settings-selector.ts @@ -57,6 +57,8 @@ class TextInputSubmenu extends Container { this.#input = new Input(); if (currentValue) { this.#input.setValue(currentValue); + // Move cursor to end of pre-filled value (ctrl+e = cursorLineEnd). + this.#input.handleInput("\x05"); } this.#input.onSubmit = value => { this.onSubmit(value); // empty string clears the setting @@ -450,6 +452,11 @@ export class SettingsSelectorComponent extends Container { currentValue: string, done: (value?: string) => void, ): Container { + this.#textInputActive = true; + const wrappedDone = (value?: string) => { + this.#textInputActive = false; + done(value); + }; return new TextInputSubmenu( def.label, def.description, @@ -459,9 +466,9 @@ export class SettingsSelectorComponent extends Container { // store "" which the browser.ts expandHome ignores (no-op fallback). this.#setSettingValue(def.path, value); this.callbacks.onChange(def.path, value); - done(value); + wrappedDone(value); }, - () => done(), + () => wrappedDone(), ); } @@ -586,12 +593,15 @@ export class SettingsSelectorComponent extends Container { } handleInput(data: string): void { - // Handle tab switching first (tab, shift+tab, or left/right arrows) + // Handle tab switching — but NOT when a text input is active, since + // arrow keys must reach the cursor and Tab must not switch tabs. if ( - matchesKey(data, "tab") || - matchesKey(data, "shift+tab") || - matchesKey(data, "left") || - matchesKey(data, "right") + !this.#textInputActive && ( + matchesKey(data, "tab") || + matchesKey(data, "shift+tab") || + matchesKey(data, "left") || + matchesKey(data, "right") + ) ) { this.#tabBar.handleInput(data); return;