source: abort guard compares to the originating screen, not 0

A script opened from the dashboard (screen_idx 4) aborted after its first
line: the guard treated any non-console screen as 'an interactive command
opened a screen'. Record the screen the source started from and abort only
when a sourced line navigates away from it (what a bare interactive command
does). Now 'o' from the dashboard runs the whole script in place — the
dashboard populates live behind the global Computing overlay — while a bare
connect/explore inside a script still aborts. Batch unaffected (BootDispatch
pins screen 0, so origin 0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 19:06:18 +02:00
parent 29cb353d75
commit 53eb79c760
2 changed files with 4 additions and 2 deletions

View File

@@ -296,6 +296,7 @@ void Tui::Source(const std::string &filename) {
loading_executed = 0;
loading_lineno = 0;
loading_prev_in_source = in_source;
source_origin_screen = screen_idx; // a sourced line that leaves this screen aborts
in_source = true;
loading = true;
@@ -346,10 +347,10 @@ void Tui::ProcessNextSourceLine() {
Submit();
++loading_executed;
if (screen_idx != 0) {
if (screen_idx != source_origin_screen) {
Print("source: line " + std::to_string(loading_lineno)
+ " is interactive (would open a screen) — aborting.");
screen_idx = 0;
screen_idx = source_origin_screen;
loading.store(false);
tick_in_flight.store(false);
in_source = loading_prev_in_source;