Reverse model switching and binding for dialog

This commit is contained in:
Armin Ronacher 2025-12-25 18:02:38 +01:00
parent 58c02ce02b
commit b576a527c7
5 changed files with 57 additions and 12 deletions

View file

@ -3,11 +3,13 @@ import {
isCtrlC,
isCtrlD,
isCtrlG,
isCtrlL,
isCtrlO,
isCtrlP,
isCtrlT,
isCtrlZ,
isEscape,
isShiftCtrlP,
isShiftTab,
} from "@mariozechner/pi-tui";
@ -20,6 +22,8 @@ export class CustomEditor extends Editor {
public onCtrlD?: () => void;
public onShiftTab?: () => void;
public onCtrlP?: () => void;
public onShiftCtrlP?: () => void;
public onCtrlL?: () => void;
public onCtrlO?: () => void;
public onCtrlT?: () => void;
public onCtrlG?: () => void;
@ -44,12 +48,24 @@ export class CustomEditor extends Editor {
return;
}
// Intercept Ctrl+L for model selector
if (isCtrlL(data) && this.onCtrlL) {
this.onCtrlL();
return;
}
// Intercept Ctrl+O for tool output expansion
if (isCtrlO(data) && this.onCtrlO) {
this.onCtrlO();
return;
}
// Intercept Shift+Ctrl+P for backward model cycling (check before Ctrl+P)
if (isShiftCtrlP(data) && this.onShiftCtrlP) {
this.onShiftCtrlP();
return;
}
// Intercept Ctrl+P for model cycling
if (isCtrlP(data) && this.onCtrlP) {
this.onCtrlP();