M3.6: integrated terminal with PTY sessions and xterm.js sub-tabs
- crates/terminal: portable-pty sessions (ConPTY on Windows) with reader, writer and waiter threads, UTF-8 chunking, a 1 MiB output buffer with backpressure, a non-blocking input queue, resize, kill and exit codes; default shell pwsh -> powershell -> cmd on Windows, $SHELL or /bin/sh. - Engine: terminal.create/input/resize/close, terminalOutput (capped per terminal and per pump, round-robin) and terminalExited through the pump; terminals close with the project and on app.quit. - UI: Terminal tab in the bottom panel (tabs next to Find), xterm.js with the fit addon, sub-tabs, copy/paste, a focus rule that leaves plain Ctrl keys to the shell, terminal.open (Mod+Shift+T), --lt-terminal-* ANSI tokens in both themes (text colours AA) and a 4.5:1 minimum contrast. - Tests: real-shell crate tests (UTF-8, backpressure), engine and TCP control tests, Vitest with a mocked xterm; live check on port 7936; docs and parity rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5fa7f0c8b3
commit
a8daf269fb
45 changed files with 3935 additions and 49 deletions
|
|
@ -8,7 +8,10 @@
|
|||
* {@link UI_COMMANDS} (also before the engine lists them).
|
||||
* - **Keymap:** one listener on the window in the capture phase, so
|
||||
* shortcuts also work while CodeMirror or an input has the focus. A
|
||||
* disabled command's shortcut is swallowed and does nothing.
|
||||
* disabled command's shortcut is swallowed and does nothing. While a
|
||||
* terminal has the focus, only shortcuts with Mod+Shift or Mod+Alt (any
|
||||
* Cmd shortcut on macOS) reach Lutra; the shell gets the others (M3.6,
|
||||
* `components/terminal/keys.ts`).
|
||||
* - **Handlers:** components supply the behaviour of UI commands and the
|
||||
* context of engine commands (the editor runs `file.save` with the active
|
||||
* buffer) with {@link useCommandsStore}'s `provide`. Other engine
|
||||
|
|
@ -24,6 +27,7 @@ import { hasMessage, t } from "../i18n";
|
|||
import { listCommands, onEngineEvent, run, type CommandInfo, type EngineEventPayload, type JsonValue } from "../ipc";
|
||||
import { useNotificationsStore } from "../stores/notifications";
|
||||
import { useModalsStore } from "./modals";
|
||||
import { shortcutReachesLutra } from "../components/terminal/keys";
|
||||
import { buildKeymap, commandFor, formatShortcut, isMac } from "./keymap";
|
||||
import { UI_COMMANDS } from "./uiCommands";
|
||||
|
||||
|
|
@ -291,7 +295,7 @@ export const useCommandsStore = defineStore("commands", () => {
|
|||
*/
|
||||
function onKeydown(event: KeyboardEvent): void {
|
||||
const id = commandFor(keymap.value, event);
|
||||
if (id === null) {
|
||||
if (id === null || !shortcutReachesLutra(event, isMac())) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue