From 37dd2f2ef3a623eef788cedb60d04ea789109f8f Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Tue, 24 Apr 2018 13:25:55 +0200 Subject: [PATCH] Make sure editor is updated after reloading changes Fixes #5466 Update was done by switching to the next tab and then back to the prev tab, however that is a no-op in a single tab sketch. Updated the code to reload the current code if it was modified. --- app/src/processing/app/Sketch.java | 4 ++-- app/src/processing/app/ui/ChangeDetector.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/Sketch.java b/app/src/processing/app/Sketch.java index 7de129474..40a3d7fb2 100644 --- a/app/src/processing/app/Sketch.java +++ b/app/src/processing/app/Sketch.java @@ -1404,8 +1404,8 @@ public class Sketch { // System.out.println(current.visited); // } // if current is null, then this is the first setCurrent(0) - if (((currentIndex == which) && (current != null)) - || which >= codeCount || which < 0) { + if (which < 0 || which >= codeCount || + ((currentIndex == which) && (current == code[currentIndex]))) { return; } diff --git a/app/src/processing/app/ui/ChangeDetector.java b/app/src/processing/app/ui/ChangeDetector.java index 2bad61f80..024c2aa58 100644 --- a/app/src/processing/app/ui/ChangeDetector.java +++ b/app/src/processing/app/ui/ChangeDetector.java @@ -215,8 +215,7 @@ public class ChangeDetector implements WindowFocusListener { ); } editor.rebuildHeader(); - sketch.handleNextCode(); - sketch.handlePrevCode(); + sketch.setCurrentCode(sketch.getCurrentCodeIndex()); editor.repaintHeader(); editor.sketchChanged();