diff --git a/frontend/app/app.tsx b/frontend/app/app.tsx index c1b070ba..234d4326 100644 --- a/frontend/app/app.tsx +++ b/frontend/app/app.tsx @@ -405,19 +405,19 @@ const AppKeyHandlers = () => { return true; } } - if (keyutil.checkKeyPressed(waveEvent, "Cmd:ArrowUp")) { + if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowUp")) { switchBlock(tabId, 0, -1); return true; } - if (keyutil.checkKeyPressed(waveEvent, "Cmd:ArrowDown")) { + if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowDown")) { switchBlock(tabId, 0, 1); return true; } - if (keyutil.checkKeyPressed(waveEvent, "Cmd:ArrowLeft")) { + if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowLeft")) { switchBlock(tabId, -1, 0); return true; } - if (keyutil.checkKeyPressed(waveEvent, "Cmd:ArrowRight")) { + if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowRight")) { switchBlock(tabId, 1, 0); return true; } diff --git a/frontend/app/store/wos.ts b/frontend/app/store/wos.ts index 87826400..d97edb4a 100644 --- a/frontend/app/store/wos.ts +++ b/frontend/app/store/wos.ts @@ -100,7 +100,14 @@ function callBackendService(service: string, method: string, args: any[], noUICo if (respData.error != null) { throw new Error(`call ${methodName} error: ${respData.error}`); } - console.log("Call", methodName, Date.now() - startTs + "ms"); + const durationStr = Date.now() - startTs + "ms"; + if (methodName == "object.UpdateObject") { + console.log("Call UpdateObject", args[0].otype, args[0].oid, durationStr, args[0]); + } else if (methodName == "object.GetObject") { + console.log("Call GetObject", args[0], durationStr); + } else { + console.log("Call", methodName, durationStr); + } return respData.data; }); return prtn; diff --git a/frontend/app/view/term/term.tsx b/frontend/app/view/term/term.tsx index 1842dd27..0b145acb 100644 --- a/frontend/app/view/term/term.tsx +++ b/frontend/app/view/term/term.tsx @@ -217,7 +217,7 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => { const isFocused = jotai.useAtomValue(isFocusedAtom); React.useEffect(() => { - function handleTerminalKeydown(event: KeyboardEvent) { + function handleTerminalKeydown(event: KeyboardEvent): boolean { const waveEvent = keyutil.adaptFromReactOrNativeKeyEvent(event); if (keyutil.checkKeyPressed(waveEvent, "Cmd:Escape")) { event.preventDefault(); @@ -225,11 +225,28 @@ const TerminalView = ({ blockId, model }: TerminalViewProps) => { WshServer.SetMetaCommand({ oref: WOS.makeORef("block", blockId), meta: { "term:mode": null } }); return false; } + if ( + keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowLeft") || + keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowRight") || + keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowUp") || + keyutil.checkKeyPressed(waveEvent, "Ctrl:Shift:ArrowDown") + ) { + return false; + } + for (let i = 1; i <= 9; i++) { + if ( + keyutil.checkKeyPressed(waveEvent, `Ctrl:Shift:Digit${i}`) || + keyutil.checkKeyPressed(waveEvent, `Ctrl:Shift:c{Numpad${i}}`) + ) { + return false; + } + } if (shellProcStatusRef.current != "running" && keyutil.checkKeyPressed(waveEvent, "Enter")) { // restart WshServer.ControllerRestartCommand({ blockid: blockId }); return false; } + return true; } const settings = globalStore.get(atoms.settingsConfigAtom); const termTheme = computeTheme(settings, blockData?.meta?.["term:theme"]); diff --git a/frontend/app/view/term/termwrap.ts b/frontend/app/view/term/termwrap.ts index b0755cab..f5f4c7fb 100644 --- a/frontend/app/view/term/termwrap.ts +++ b/frontend/app/view/term/termwrap.ts @@ -32,7 +32,7 @@ const WebGLSupported = detectWebGLSupport(); let loggedWebGL = false; type TermWrapOptions = { - keydownHandler?: (e: KeyboardEvent) => void; + keydownHandler?: (e: KeyboardEvent) => boolean; useWebGl?: boolean; }; @@ -49,7 +49,6 @@ export class TermWrap { heldData: Uint8Array[]; handleResize_debounced: () => void; isRunning: boolean; - keydownHandler: (e: KeyboardEvent) => void; constructor( blockId: string, @@ -116,6 +115,7 @@ export class TermWrap { }, 0); return true; }); + this.terminal.attachCustomKeyEventHandler(waveOptions.keydownHandler); this.connectElem = connectElem; this.mainFileSubject = null; this.heldData = []; @@ -123,11 +123,9 @@ export class TermWrap { this.terminal.open(this.connectElem); this.handleResize(); this.isRunning = true; - this.keydownHandler = waveOptions.keydownHandler; } async initTerminal() { - this.connectElem.addEventListener("keydown", this.keydownHandler, true); this.terminal.onData(this.handleTermData.bind(this)); this.mainFileSubject = getFileSubject(this.blockId, TermFileName); this.mainFileSubject.subscribe(this.handleNewFileSubjectData.bind(this));