fix(coding-agent): fix IME candidate window positioning in menu selectors

Components with search inputs now implement Focusable interface and
propagate focus state to their child Input components. This allows
the hardware cursor to be positioned correctly for IME candidate
window placement.

Affected components:
- ModelSelectorComponent
- ScopedModelsSelectorComponent
- SessionSelectorComponent (and SessionList)
- ExtensionInputComponent
- LoginDialogComponent
- TreeSelectorComponent (and LabelInput)

fixes #827
This commit is contained in:
Mario Zechner
2026-01-18 17:22:40 +01:00
parent 8b23c0a45e
commit b4f833c259
7 changed files with 113 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
import { getOAuthProviders } from "@mariozechner/pi-ai";
import { Container, getEditorKeybindings, Input, Spacer, Text, type TUI } from "@mariozechner/pi-tui";
import { Container, type Focusable, getEditorKeybindings, Input, Spacer, Text, type TUI } from "@mariozechner/pi-tui";
import { exec } from "child_process";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@@ -8,7 +8,7 @@ import { keyHint } from "./keybinding-hints.js";
/**
* Login dialog component - replaces editor during OAuth login flow
*/
export class LoginDialogComponent extends Container {
export class LoginDialogComponent extends Container implements Focusable {
private contentContainer: Container;
private input: Input;
private tui: TUI;
@@ -16,6 +16,16 @@ export class LoginDialogComponent extends Container {
private inputResolver?: (value: string) => void;
private inputRejecter?: (error: Error) => void;
// Focusable implementation - propagate to input for IME cursor positioning
private _focused = false;
get focused(): boolean {
return this._focused;
}
set focused(value: boolean) {
this._focused = value;
this.input.focused = value;
}
constructor(
tui: TUI,
providerId: string,