fix(tui): update CustomEditor ctor

This commit is contained in:
Peter Steinberger
2026-01-20 16:02:47 +00:00
parent 2394703593
commit 8c666666ef
2 changed files with 4 additions and 5 deletions

View File

@@ -13,10 +13,9 @@ export class CustomEditor extends Editor {
onAltEnter?: () => void; onAltEnter?: () => void;
constructor(tuiOrTheme: TUI | EditorTheme, themeMaybe?: EditorTheme) { constructor(tuiOrTheme: TUI | EditorTheme, themeMaybe?: EditorTheme) {
const useTui = typeof themeMaybe !== "undefined" && Editor.length >= 2; const useLegacyCtor = typeof themeMaybe !== "undefined" && Editor.length >= 2;
const args = (useTui ? [tuiOrTheme, themeMaybe] : [tuiOrTheme]) as ConstructorParameters< const args = (useLegacyCtor ? [tuiOrTheme, themeMaybe] : [themeMaybe ?? tuiOrTheme]) as
typeof Editor ConstructorParameters<typeof Editor>;
>;
super(...args); super(...args);
} }
handleInput(data: string): void { handleInput(data: string): void {

View File

@@ -193,7 +193,7 @@ export async function runTui(opts: TuiOptions) {
const statusContainer = new Container(); const statusContainer = new Container();
const footer = new Text("", 1, 0); const footer = new Text("", 1, 0);
const chatLog = new ChatLog(); const chatLog = new ChatLog();
const editor = new CustomEditor(tui, editorTheme); const editor = new CustomEditor(editorTheme);
const root = new Container(); const root = new Container();
root.addChild(header); root.addChild(header);
root.addChild(chatLog); root.addChild(chatLog);