Reviewed closed GitHub IME positioning bug.
UnderstandIdentified fix and examined code changes.
UnderstandAdded documentation on focus propagation pattern.
EditCommitted and pushed documentation updates.
VerifyAnalyze GitHub issue(s): https://github.com/badlogic/pi-mono/issues/827
For each issue:
Read the issue in full, including all comments and linked issues/PRs.
For bugs:
For feature requests:
Do NOT implement unless explicitly asked. Analyze and propose only.
The issue is already CLOSED, but let me analyze it anyway to understand what was involved.
Issue #827: IME candidate window appears in wrong position when filtering menu options
Problem: When using Chinese IME to filter menu options (via / command or /model selector), the IME candidate window appears in the wrong position on screen.
Let me check how this was resolved and understand the relevant code:
Found the fix. Let me examine what was changed:
Issue #827: IME candidate window appears in wrong position when filtering menus
Status: Already CLOSED and fixed in commit b4f833c2
The Focusable interface in pi-tui controls hardware cursor positioning for IME support. Components with embedded Input children (search fields) weren't propagating the focused state to their child inputs. Without this propagation, the hardware cursor remained at the wrong position, causing IME candidate windows to appear misplaced.
Each affected component now:
Focusable interface from @mariozechner/pi-tui_focused field with getter/setterfocused state to child Input componentsAffected components:
ModelSelectorComponent - model pickerScopedModelsSelectorComponent - Ctrl+P model cycling selectorSessionSelectorComponent (and internal SessionList) - session pickerExtensionInputComponent - extension text inputsLoginDialogComponent - OAuth login flowTreeSelectorComponent (and internal LabelInput) - session tree navigationPattern used (example from ModelSelectorComponent):
export class ModelSelectorComponent extends Container implements Focusable { private searchInput: Input; // Focusable implementation - propagate to searchInput for IME cursor positioning private _focused = false; get focused(): boolean { return this._focused; } set focused(value: boolean) { this._focused = value; this.searchInput.focused = value; } // ...}This issue is resolved. No further action needed.
ok, we should likely also update @packages/coding-agent/docs/tui.md and @packages/tui/README.md to describe this pattern
I'll add documentation about the focus propagation pattern to both files.
Done. Added documentation about the focus propagation pattern to both files:
packages/coding-agent/docs/tui.md - Added a new subsection "Container Components with Embedded Inputs" under the existing "Focusable Interface (IME Support)" section, with a code example showing how to implement the pattern.
packages/tui/README.md - Added a new "Focusable Interface (IME Support)" section after the Component Interface section, explaining both the basic interface and the container propagation pattern.
Both include:
focused statecommit and push
Pushed ad337e30 - documentation for the Focusable interface propagation pattern added to both packages/coding-agent/docs/tui.md and packages/tui/README.md.
export class ModelSelectorComponent extends Container implements Focusable { private searchInput: Input; // Focusable implementation - propagate to searchInput for IME cursor positioning private _focused = false; get focused(): boolean { return this._focused; } set focused(value: boolean) { this._focused = value; this.searchInput.focused = value; } // ...}