mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-19 22:01:38 +00:00
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:
parent
8b23c0a45e
commit
b4f833c259
7 changed files with 113 additions and 11 deletions
|
|
@ -2,6 +2,7 @@ import * as os from "node:os";
|
|||
import {
|
||||
type Component,
|
||||
Container,
|
||||
type Focusable,
|
||||
getEditorKeybindings,
|
||||
Input,
|
||||
matchesKey,
|
||||
|
|
@ -105,7 +106,7 @@ class SessionSelectorHeader implements Component {
|
|||
/**
|
||||
* Custom session list component with multi-line items and search
|
||||
*/
|
||||
class SessionList implements Component {
|
||||
class SessionList implements Component, Focusable {
|
||||
private allSessions: SessionInfo[] = [];
|
||||
private filteredSessions: SessionInfo[] = [];
|
||||
private selectedIndex: number = 0;
|
||||
|
|
@ -119,6 +120,16 @@ class SessionList implements Component {
|
|||
public onToggleSort?: () => void;
|
||||
private maxVisible: number = 5; // Max sessions visible (each session is 3 lines: msg + metadata + blank)
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
constructor(sessions: SessionInfo[], showCwd: boolean, sortMode: SortMode) {
|
||||
this.allSessions = sessions;
|
||||
this.filteredSessions = sessions;
|
||||
|
|
@ -290,7 +301,7 @@ type SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[
|
|||
/**
|
||||
* Component that renders a session selector
|
||||
*/
|
||||
export class SessionSelectorComponent extends Container {
|
||||
export class SessionSelectorComponent extends Container implements Focusable {
|
||||
private sessionList: SessionList;
|
||||
private header: SessionSelectorHeader;
|
||||
private scope: SessionScope = "current";
|
||||
|
|
@ -302,6 +313,16 @@ export class SessionSelectorComponent extends Container {
|
|||
private onCancel: () => void;
|
||||
private requestRender: () => void;
|
||||
|
||||
// Focusable implementation - propagate to sessionList for IME cursor positioning
|
||||
private _focused = false;
|
||||
get focused(): boolean {
|
||||
return this._focused;
|
||||
}
|
||||
set focused(value: boolean) {
|
||||
this._focused = value;
|
||||
this.sessionList.focused = value;
|
||||
}
|
||||
|
||||
constructor(
|
||||
currentSessionsLoader: SessionsLoader,
|
||||
allSessionsLoader: SessionsLoader,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue