Skip to content

Commit 2793266

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 207970d commit 2793266

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

app/src/processing/app/Base.java

Lines changed: 0 additions & 3 deletions
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ public void windowDeactivated(WindowEvent e) {
354354
// Open the document that was passed in
355355
boolean loaded = handleOpenInternal(file);
356356
if (!loaded) sketchController = null;
357+
358+
// default the console output to the last opened editor
359+
EditorConsole.setCurrentEditorConsole(console);
357360
}
358361

359362
@Override
@@ -2588,6 +2591,7 @@ public void handlePlotter() {
25882591

25892592
private void handleBurnBootloader() {
25902593
console.clear();
2594+
EditorConsole.setCurrentEditorConsole(this.console);
25912595
statusNotice(tr("Burning bootloader to I/O Board (this may take a minute)..."));
25922596
new Thread(() -> {
25932597
try {

app/src/processing/app/SketchController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,8 @@ public String build(boolean verbose, boolean save) throws RunnerException, Prefe
640640
progressListener.progress(20);
641641
}
642642

643+
EditorConsole.setCurrentEditorConsole(editor.console);
644+
643645
ensureExistence();
644646

645647

@@ -683,6 +685,8 @@ public String codeComplete(SketchFile file, int line, int col) throws RunnerExce
683685
progressListener.progress(20);
684686
}
685687

688+
EditorConsole.setCurrentEditorConsole(editor.console);
689+
686690
ensureExistence();
687691

688692
boolean deleteTemp = false;
@@ -737,6 +741,8 @@ private boolean upload(String suggestedClassName, boolean usingProgrammer) throw
737741
UploaderUtils uploaderInstance = new UploaderUtils();
738742
Uploader uploader = uploaderInstance.getUploaderByPreferences(false);
739743

744+
EditorConsole.setCurrentEditorConsole(editor.console);
745+
740746
boolean success = false;
741747
do {
742748
if (uploader.requiresAuthorization() && !PreferencesData.has(uploader.getAuthorizationKey())) {

0 commit comments

Comments
 (0)