Make Terminal a native feature
- Move the Terminal plugin into src/lib/features/terminal/ on the host Svelte runtime, with xterm 6.0.0 and addon-fit 0.11.0. - Buttons, shortcuts, Help rows, and the close guard follow the Terminal switch. The first use loads the module. - Add Settings → Terminal and the terminal settings section. The first start copies the old runestone.terminal key. - The 16 ANSI colors come from the --rs-ansi-* tokens. - Off asks first when a shell runs in any window (pty_running). - Rust: no pty-data or pty-exit events, an owner check for write, resize, and close, output joined up to 64 KiB or 8 ms, and the sessions of a reloaded page close. - Remove api.pty, the terminal contribution, TerminalSlot, and the plugin loader of the smoke harness. - Check only the tested switches in the Background smoke test. - Update the tests, the menu inventory, the docs, and UI-058.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
// Custom window controls: maximize, restore, minimize, the terminal close guard, the keyboard tooltip, and the header at 1400 and 880 px.
|
||||
// @requires plugin:terminal
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { mockTauri, outputDir, repoRoot, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs";
|
||||
|
||||
await runSmoke("layout/windowControls", async ({ page }) => {
|
||||
const output = await outputDir("layout/windowControls");
|
||||
@@ -20,8 +18,7 @@ await runSmoke("layout/windowControls", async ({ page }) => {
|
||||
"plugin:dialog|message": () => test.state.confirm,
|
||||
}),
|
||||
});
|
||||
// The Terminal button belongs to the terminal plug-in (src/lib/layout/Workbench.svelte:1305).
|
||||
await mockFeaturePlugins(page);
|
||||
// The Terminal button belongs to the Terminal feature, which is on by default (src/lib/features/catalog.ts).
|
||||
const called = command => page.evaluate(command => window.__TEST__.calls.some(call => call.command === command), command);
|
||||
|
||||
const config = JSON.parse(await readFile(path.join(repoRoot, "src-tauri/tauri.conf.json"), "utf8"));
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
// Core workbench: source edits and history, agent refresh and conflicts, persistent terminals, Reading and Mermaid previews, the live Writer, tables and their menus, and narrow layouts.
|
||||
// @requires plugin:terminal
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { chooseView, mockTauri, outputDir, repoRoot, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs";
|
||||
|
||||
await runSmoke("layout/workbench", async ({ page }) => {
|
||||
const output = await outputDir("layout/workbench");
|
||||
@@ -21,33 +19,18 @@ await runSmoke("layout/workbench", async ({ page }) => {
|
||||
},
|
||||
});
|
||||
Object.assign(test, { files: workspace.files, root: workspace.root });
|
||||
// The terminal plug-in opens shells through these commands.
|
||||
const pty = {};
|
||||
for (const command of ["pty_write", "pty_resize", "pty_close"]) pty[command] = () => {};
|
||||
// The Terminal feature opens its shells through the default `pty_*` handlers of the harness.
|
||||
return {
|
||||
...workspace,
|
||||
...pty,
|
||||
workspace_write: args => {
|
||||
if (args.expected !== undefined && workspace.files.get(args.rel) !== args.expected) throw new Error("Save blocked: file changed on disk");
|
||||
return workspace.workspace_write(args);
|
||||
},
|
||||
workspace_search: () => [],
|
||||
pty_profiles: () => [{ id: "powershell", title: "PowerShell", kind: "powershell" }],
|
||||
pty_open: async args => {
|
||||
const data = new TextEncoder().encode("READY 🪨\r\n\x1b[6n");
|
||||
// A Terminal plugin that uses api.pty passes a channel and gets raw bytes. Released versions listen for events.
|
||||
if (args.channel) setTimeout(() => { args.channel.onmessage(data.slice(0, 8).buffer); args.channel.onmessage(data.slice(8).buffer); }, 0);
|
||||
else {
|
||||
test.emit("pty-data", { id: args.id, data: [...data.slice(0, 8)] });
|
||||
test.emit("pty-data", { id: args.id, data: [...data.slice(8)] });
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, 50));
|
||||
},
|
||||
"plugin:dialog|message": () => "Cancel",
|
||||
};
|
||||
},
|
||||
});
|
||||
await mockFeaturePlugins(page);
|
||||
|
||||
async function quickOpen(name) {
|
||||
await page.keyboard.press("Control+p");
|
||||
|
||||
Reference in New Issue
Block a user