diff --git a/web/src/client/components/session-view.ts b/web/src/client/components/session-view.ts index f676a5c9..409a39b0 100644 --- a/web/src/client/components/session-view.ts +++ b/web/src/client/components/session-view.ts @@ -729,6 +729,13 @@ export class SessionView extends LitElement { } } + private async handleTerminalInput(e: CustomEvent) { + const { text } = e.detail; + if (this.inputManager && text) { + await this.inputManager.sendInputText(text); + } + } + private updateTerminalTransform(): void { // Calculate height reduction for keyboard and quick keys let heightReduction = 0; @@ -895,6 +902,7 @@ export class SessionView extends LitElement { .hideScrollButton=${this.showQuickKeys} class="w-full h-full p-0 m-0" @click=${this.handleTerminalClick} + @terminal-input=${this.handleTerminalInput} > diff --git a/web/src/client/components/terminal.ts b/web/src/client/components/terminal.ts index 778fb463..042308f3 100644 --- a/web/src/client/components/terminal.ts +++ b/web/src/client/components/terminal.ts @@ -13,6 +13,7 @@ import { type IBufferCell, type IBufferLine, Terminal as XtermTerminal } from '@xterm/headless'; import { html, LitElement, type PropertyValues } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; +import { processKeyboardShortcuts } from '../utils/keyboard-shortcut-highlighter.js'; import { createLogger } from '../utils/logger.js'; import { UrlHighlighter } from '../utils/url-highlighter'; @@ -731,6 +732,9 @@ export class Terminal extends LitElement { // Process links after rendering UrlHighlighter.processLinks(this.container); + // Process keyboard shortcuts after rendering + processKeyboardShortcuts(this.container, this.handleShortcutClick); + // Track render performance in debug mode if (this.debugMode) { const endTime = performance.now(); @@ -1239,6 +1243,16 @@ export class Terminal extends LitElement { } }; + private handleShortcutClick = (keySequence: string) => { + // Dispatch a custom event with the keyboard shortcut + this.dispatchEvent( + new CustomEvent('terminal-input', { + detail: { text: keySequence }, + bubbles: true, + }) + ); + }; + render() { return html`