MCPcopy
hub / github.com/wavetermdev/waveterm / keyDownHandler

Method keyDownHandler

frontend/app/view/term/term-model.ts:616–678  ·  view source on GitHub ↗
(waveEvent: WaveKeyboardEvent)

Source from the content-addressed store, hash-verified

614 }
615
616 keyDownHandler(waveEvent: WaveKeyboardEvent): boolean {
617 if (keyutil.checkKeyPressed(waveEvent, "Ctrl:r")) {
618 const shellIntegrationStatus = readAtom(this.termRef?.current?.shellIntegrationStatusAtom);
619 if (shellIntegrationStatus === "ready") {
620 recordTEvent("action:term", { "action:type": "term:ctrlr" });
621 }
622 // just for telemetry, we allow this keybinding through, back to the terminal
623 return false;
624 }
625 if (keyutil.checkKeyPressed(waveEvent, "Cmd:Escape")) {
626 const blockAtom = WOS.getWaveObjectAtom<Block>(`block:${this.blockId}`);
627 const blockData = globalStore.get(blockAtom);
628 const newTermMode = blockData?.meta?.["term:mode"] == "vdom" ? null : "vdom";
629 const vdomBlockId = globalStore.get(this.vdomBlockId);
630 if (newTermMode == "vdom" && !vdomBlockId) {
631 return;
632 }
633 this.setTermMode(newTermMode);
634 return true;
635 }
636 if (keyutil.checkKeyPressed(waveEvent, "Shift:End")) {
637 if (this.termRef?.current?.terminal) {
638 this.termRef.current.terminal.scrollToBottom();
639 }
640 return true;
641 }
642 if (keyutil.checkKeyPressed(waveEvent, "Shift:Home")) {
643 if (this.termRef?.current?.terminal) {
644 this.termRef.current.terminal.scrollToLine(0);
645 }
646 return true;
647 }
648 if (isMacOS() && keyutil.checkKeyPressed(waveEvent, "Cmd:End")) {
649 if (this.termRef?.current?.terminal) {
650 this.termRef.current.terminal.scrollToBottom();
651 }
652 return true;
653 }
654 if (isMacOS() && keyutil.checkKeyPressed(waveEvent, "Cmd:Home")) {
655 if (this.termRef?.current?.terminal) {
656 this.termRef.current.terminal.scrollToLine(0);
657 }
658 return true;
659 }
660 if (keyutil.checkKeyPressed(waveEvent, "Shift:PageDown")) {
661 if (this.termRef?.current?.terminal) {
662 this.termRef.current.terminal.scrollPages(1);
663 }
664 return true;
665 }
666 if (keyutil.checkKeyPressed(waveEvent, "Shift:PageUp")) {
667 if (this.termRef?.current?.terminal) {
668 this.termRef.current.terminal.scrollPages(-1);
669 }
670 return true;
671 }
672 const blockData = globalStore.get(this.blockAtom);
673 if (blockData.meta?.["term:mode"] == "vdom") {

Callers 1

handleTerminalKeydownMethod · 0.95

Calls 7

setTermModeMethod · 0.95
getVDomModelMethod · 0.95
readAtomFunction · 0.90
recordTEventFunction · 0.90
isMacOSFunction · 0.90
getMethod · 0.80
scrollToBottomMethod · 0.80

Tested by

no test coverage detected