From 68d939ad652c7fca7fe7de7b55e51e0f34374f19 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 02:47:32 +0000 Subject: feat(bundle): run and stop programs with F5 from the Run menu Co-Authored-By: Claude Opus 5.5 --- bundle/src/main.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'bundle/src') diff --git a/bundle/src/main.js b/bundle/src/main.js index 9a78ae7..e36b743 100644 --- a/bundle/src/main.js +++ b/bundle/src/main.js @@ -145,7 +145,8 @@ const commands = { open: () => action(openFile), save: () => action(saveFile), find: () => editorAction('actions.find'), - comment: () => editorAction('editor.action.commentLine') + comment: () => editorAction('editor.action.commentLine'), + run: () => running ? invoke('stop_run').catch(report) : action(runFile) }; // CtrlCmd is Cmd on macOS and Ctrl elsewhere, matching Monaco's own keybindings and the menu. const shortcuts = [ @@ -154,19 +155,14 @@ const shortcuts = [ [KeyMod.CtrlCmd | KeyCode.KeyO, 'open'], [KeyMod.CtrlCmd | KeyCode.KeyS, 'save'], [KeyMod.CtrlCmd | KeyCode.KeyF, 'find'], - [KeyMod.CtrlCmd | KeyCode.Slash, 'comment'] + [KeyMod.CtrlCmd | KeyCode.Slash, 'comment'], + [KeyCode.F5, 'run'] ]; try { editor = await createEditor(document.querySelector('#editor')); editor.onDidChangeModelContent(refreshTitle); - runButton.onclick = () => { - if (running) { - invoke('stop_run').catch(report); - } else { - action(runFile); - } - }; + runButton.onclick = commands.run; document.querySelector('#save').onclick = () => action(saveFile); document.querySelector('#new').onclick = () => action(newFile); document.querySelector('#open').onclick = () => action(openFile); -- cgit v1.3.1-4-g156e