From b00263738cb1c6dede553a6cae24424a996b2336 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 4 Apr 2026 12:53:25 +0200 Subject: [PATCH] Revert "Playground: capture Ctrl+W as delete-previous-word" This reverts commit b82f7b65fbfa097ea185085176d1810be567de55. --- static/js/wasm-terminal.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/static/js/wasm-terminal.js b/static/js/wasm-terminal.js index 13dca687f..691e957b9 100644 --- a/static/js/wasm-terminal.js +++ b/static/js/wasm-terminal.js @@ -809,17 +809,6 @@ async function handleInput(data) { continue; } - if (code === 23) { // Ctrl+W — delete previous word - const before = inputBuffer.slice(0, cursorPos); - const after = inputBuffer.slice(cursorPos); - // Skip trailing spaces, then delete back to the previous space - const trimmed = before.replace(/\S+\s*$/, ""); - cursorPos = trimmed.length; - inputBuffer = trimmed + after; - redrawInput(); - continue; - } - if (code === 21) { // Ctrl+U inputBuffer = ""; cursorPos = 0; @@ -877,14 +866,6 @@ async function initPlayground(containerId) { terminal.open(container); fitAddon.fit(); - // Prevent browser from closing the tab on Ctrl+W when the terminal is focused; - // xterm.js will receive it as code 23 and we handle it as "delete previous word". - container.addEventListener("keydown", (ev) => { - if (ev.ctrlKey && ev.key === "w") { - ev.preventDefault(); - } - }, true); - window.addEventListener("resize", () => fitAddon.fit()); terminal.writeln("\x1b[1;38;5;166m _ _ _ _ _ _ _\x1b[0m");