Skip to content

Commit 634fe10

Browse files
committed
Mitigate stdout roaming through editor consoles
Still not a perfect solution; two compilation outputs will mix up anyway. A major refactor should be needed to avoid using System.out anywhere and inverse multiplexing the streams so they can be muted or replicated on any Console.
1 parent 506a4c8 commit 634fe10

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

app/src/processing/app/Base.java

-3
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,6 @@ protected void handleActivated(Editor whichEditor) {
629629
System.err.println(e);
630630
}
631631
}
632-
633-
// set the current window to be the console that's getting output
634-
EditorConsole.setCurrentEditorConsole(activeEditor.console);
635632
}
636633

637634
protected int[] defaultEditorLocation() {

app/src/processing/app/Editor.java

+4
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ public void windowDeactivated(WindowEvent e) {
343343
// Open the document that was passed in
344344
boolean loaded = handleOpenInternal(file);
345345
if (!loaded) sketchController = null;
346+
347+
// default the console output to the last opened editor
348+
EditorConsole.setCurrentEditorConsole(console);
346349
}
347350

348351

@@ -2536,6 +2539,7 @@ public void handlePlotter() {
25362539

25372540
private void handleBurnBootloader() {
25382541
console.clear();
2542+
EditorConsole.setCurrentEditorConsole(this.console);
25392543
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
25402544
new Thread(() -> {
25412545
try {

app/src/processing/app/SketchController.java

+4
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,8 @@ public String build(boolean verbose, boolean save) throws RunnerException, Prefe
631631
progressListener.progress(20);
632632
}
633633

634+
EditorConsole.setCurrentEditorConsole(editor.console);
635+
634636
ensureExistence();
635637

636638

@@ -693,6 +695,8 @@ private boolean upload(String suggestedClassName, boolean usingProgrammer) throw
693695
UploaderUtils uploaderInstance = new UploaderUtils();
694696
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
695697

698+
EditorConsole.setCurrentEditorConsole(editor.console);
699+
696700
boolean success = false;
697701
do {
698702
if (uploader.requiresAuthorization() && !PreferencesData.has(uploader.getAuthorizationKey())) {

0 commit comments

Comments
 (0)