aboutsummaryrefslogtreecommitdiff
path: root/bundle/src
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 02:47:32 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 02:47:32 +0000
commit68d939ad652c7fca7fe7de7b55e51e0f34374f19 (patch)
tree6d50a6a5f1dfe45df2e9cedd21b7bd5e35eab243 /bundle/src
parent77098c720639a421f81ee14e47250d167d7af7bd (diff)
feat(bundle): run and stop programs with F5 from the Run menu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bundle/src')
-rw-r--r--bundle/src/main.js14
1 files changed, 5 insertions, 9 deletions
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);