Skip to content

Show console in runner for non-graphical code#90

Open
nimec01 wants to merge 1 commit into
fmidue:fmiduefrom
nimec01:console-runner
Open

Show console in runner for non-graphical code#90
nimec01 wants to merge 1 commit into
fmidue:fmiduefrom
nimec01:console-runner

Conversation

@nimec01
Copy link
Copy Markdown
Collaborator

@nimec01 nimec01 commented Jun 5, 2026

Closes #89

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the standalone runner (web/run.html + web/js/run.js) so that programs that do not produce graphics (no #screen canvas) can still display their runtime output on the runner page, addressing the request in #89.

Changes:

  • Adds a #message output container to run.html and styles it for runner use.
  • Prints runtime stdout/stderr messages into the runner page via printMessage.
  • Adjusts the “show graphics” detection to hide the console once a #screen canvas is created.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
web/run.html Adds a console output <pre id="message"> and includes runner.css so the runner can show non-graphical output.
web/js/run.js Routes runtime output through printMessage and hides the console when a graphics canvas is detected.
web/css/runner.css Adds runner-specific styling for the message area.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web/js/run.js
Comment on lines +231 to +237
const canvasAdded = mutations.some(mutation =>
[...mutation.addedNodes].some(
node => node.nodeName === 'CANVAS' && node.id === 'screen'
)
);

if (!canvasAdded) return;
Comment thread web/js/run.js
Comment on lines 108 to 114
function addMessage(type, str) {
const recentStart = Date.now() - window.programStartTime < 1000;
const printDeferred = window.hasObservableOutput || !recentStart;

printMessage(type,str);

window.hasObservableOutput = true;
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.

Run mode also for non-graphical tasks?

2 participants