Skip to content

Terminal: system copy/paste shortcuts; Escape or a Stop button interrupts a command (#721) - #727

Merged
ambroise-leclerc merged 3 commits into
developfrom
721-raccourcis-terminal
Nov 28, 2026
Merged

ambroise-leclerc merged 3 commits into
developfrom
721-raccourcis-terminal

Conversation

@ambroise-leclerc

Copy link
Copy Markdown
Collaborator

Closes #721.

Why

In the developer environment's terminal, xterm.js turned Ctrl+C into \x03, which the line editor used to clear the line or interrupt the running command, and Ctrl+V into \x16: the system's copy and paste, which the engine's context menu advertises, did nothing from the keyboard. Ctrl+C was also not a reliable stop gesture in the embedded windows.

What changes

  • System shortcuts (terminal.mjs, attachShortcuts, wired in runtime.mjs): Ctrl+C/⌘C copies the selection, Ctrl+V/⌘V pastes, Ctrl+A/⌘A selects the whole terminal, Ctrl+X/⌘X copies (nothing of the terminal can be cut). The custom key handler leaves them to the engine; xterm.js fills the clipboard on copy and gives the paste to onData, so a multi-line paste still runs line by line. The selection is also staged in xterm.js's textarea and beforecopy/beforecut are cancelled while a selection exists, so engines whose Copy depends on a page selection (a native Edit menu, as WKWebView's) enable it. Shift is allowed (Ctrl+Shift+C), Alt is not (AltGr); the letter comes from the layout, or from code for non-Latin layouts.
  • Interruption gesture (decision of the issue): Escape, when no text is selected (with a selection, Escape clears it), or a Stop button shown while a command runs: in the bar of the floating terminal window, before its close button, or over the terminal's top right corner when it fills the window. It is disabled once the command is interrupted and keeps the focus in the terminal. \x03 no longer clears the line nor interrupts. The mechanics are unchanged: context.signal aborted, exit code 130, webfront.commands.cancel for C++ commands, the scripts' grace period, status interrupted. Messages say Tests interrupted / Script x interrupted instead of stopped by Ctrl+C; the editor prints Interrupted instead of ^C.
  • Every mention of Ctrl+C as the stop gesture is replaced: wf dev's message, wf help and the terminal's help, Commands.hpp comments, README*.md, docs/DEVELOPER_ENVIRONMENT.md (new System shortcuts and Interruption items; Home is no longer Ctrl+A), docs/DEVELOPING_WITH_AGENTS.md, docs/TEST_TIERS.md, the changelog. The @webfront/pty adapter is out of scope and unchanged.
  • Published environment: the sources are already ahead of the pin (distribution.json 1.2.2, header pinned on 1.2.1 since Advance developer environment sources to 1.2.2 #719), so the pin is unchanged. packages.bundle.mjs (which bundles scripts.mjs) and bundles.json are refreshed with wf run build build-distribution --refresh-bootstrap, keeping the pinned header and its checksum.

Tests

  • test/developer/specs/terminal-specs.mjs (new, real xterm.js): Ctrl+C/⌘C on a selection sends no \x03, leaves the event to the engine and the copy fills the clipboard; Ctrl+X copies; Ctrl+A selects the terminal and not the page; Ctrl+V pastes multi-line text as before; Escape clears a selection, otherwise reaches the editor; without a selection Ctrl+C leaves the line; \x03 neither clears the line nor interrupts; Escape and interrupt() (the button) stop a command with 130 and drop the keys typed ahead, also when typed during a pending completion. A control spec shows the same synthetic key sends \x03 without the handler.
  • DeveloperBrowserIntegration: the interruptions of wf dev, wf run, wf check, wf test and the C++ commands go through the line editor's Escape; the terminal part presses Escape through xterm.js on a C++ command, uses the Stop button (over the corner) on wf run coop, and, on CEF, presses real keys (DevTools Input.dispatchKeyEvent from the test program): copy a line with Ctrl+C, clear with Escape, paste it with Ctrl+V, select all with Ctrl+A, interrupt a command with Escape. The workspace part stops a command with the Stop button of the floating window's bar.
  • Local: CEF-off build and CTest (766/766), wf test of the environment (442 specs), ctest -L web-integration on the CEF build (all pass; WebFrontBrowserIntegration, CEFLifecycle-navigation-allow-list and DeveloperBrowserIntegration-workspace failed once under a load average of 22 and passed when rerun).

…rupts (#721)

Ctrl+C/Cmd+C copies the terminal's selection, Ctrl+V pastes (multi-line paste
unchanged), Ctrl+A selects the terminal and Ctrl+X copies: attachShortcuts
leaves them to the engine instead of xterm.js's control characters. \x03 no
longer clears the line nor interrupts a command. A command is interrupted by
Escape (with no selection; Escape clears a selection) or by the Stop button,
in the floating window's bar or over the terminal's corner. The interruption
itself is unchanged (signal aborted, 130, webfront.commands.cancel, grace
period, status interrupted); its messages say "interrupted".

Specs of the keys and of the editor (terminal-specs.mjs); the integration
specs interrupt through the editor's Escape and the Stop button, and press
real keys in CEF (DevTools Input.dispatchKeyEvent) for copy, paste, select all
and Escape. Docs, help texts, Commands.hpp comments and the changelog follow;
packages.bundle.mjs and bundles.json are refreshed, the pin is unchanged.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 59f0c09b-2189-41ad-87bf-1cb89ec2db64
Commits

Reviewing files that changed from the base of the PR and between ca70935 and d3966b0.

Files selected for processing: 26

  • README.fr.md
  • README.md
  • README.zh-CN.md
  • docs/CHANGELOG.md
  • docs/DEVELOPER_ENVIRONMENT.md
  • docs/DEVELOPING_WITH_AGENTS.md
  • docs/TEST_TIERS.md
  • include/webfront/Commands.hpp
  • js/developer/environment/bundles.json
  • js/developer/environment/commands.mjs
  • js/developer/environment/development.mjs
  • js/developer/environment/packages.bundle.mjs
  • js/developer/environment/runtime.mjs
  • js/developer/environment/scripts.mjs
  • js/developer/environment/terminal.mjs
  • js/developer/environment/testing.mjs
  • js/developer/environment/typecheck-worker.mjs
  • js/developer/environment/workspace.mjs
  • js/developer/webfront.project.json
  • test/developer/specs/development-specs.mjs
  • test/developer/specs/scripts-specs.mjs
  • test/developer/specs/terminal-specs.mjs
  • test/developer/specs/testing-specs.mjs
  • test/unit/CommandsTests.cpp
  • test/web/DeveloperTest.cpp
  • test/web/developer-specs.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…minal

# Conflicts:
#	docs/CHANGELOG.md
#	js/developer/environment/bundles.json
@ambroise-leclerc
ambroise-leclerc merged commit e8ef5e5 into develop Nov 28, 2026
27 checks passed
@ambroise-leclerc
ambroise-leclerc deleted the 721-raccourcis-terminal branch November 28, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal : les raccourcis du système (Ctrl+C / ⌘C) copient, et Ctrl+C n'arrête plus les commandes

2 participants