From 421508268c8c2a401cf0821eb924842258698cda Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Mon, 26 Oct 2015 19:41:09 +0100 Subject: [PATCH 1/9] Removing highlight when autoformatting. Fixes #3988. Current highlighting logic is a bit buggy: see https://github.com/bobbylight/RSyntaxTextArea/issues/150. --- .../cc/arduino/packages/formatter/AStyle.java | 5 +++-- app/src/processing/app/Editor.java | 20 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/src/cc/arduino/packages/formatter/AStyle.java b/app/src/cc/arduino/packages/formatter/AStyle.java index 702f34ec8..7f7c244d6 100644 --- a/app/src/cc/arduino/packages/formatter/AStyle.java +++ b/app/src/cc/arduino/packages/formatter/AStyle.java @@ -91,10 +91,11 @@ public class AStyle implements Tool { int line = getLineOfOffset(textArea); int lineOffset = getLineOffset(textArea, line); - editor.getTextArea().getUndoManager().beginInternalAtomicEdit(); + textArea.getUndoManager().beginInternalAtomicEdit(); + editor.removeAllLineHighlights(); editor.setText(formattedText); editor.getSketch().setModified(true); - editor.getTextArea().getUndoManager().endInternalAtomicEdit(); + textArea.getUndoManager().endInternalAtomicEdit(); if (line != -1 && lineOffset != -1) { try { diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index f1491f153..a8855d835 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -41,8 +41,8 @@ import processing.app.forms.PasswordAuthorizationDialog; import processing.app.helpers.OSUtils; import processing.app.helpers.PreferencesMapException; import processing.app.legacy.PApplet; -import processing.app.syntax.PdeKeywords; import processing.app.syntax.ArduinoTokenMakerFactory; +import processing.app.syntax.PdeKeywords; import processing.app.syntax.SketchTextArea; import processing.app.tools.DiscourseFormat; import processing.app.tools.MenuScroller; @@ -2006,7 +2006,7 @@ public class Editor extends JFrame implements RunnerListener { @Override public void run() { try { - textarea.removeAllLineHighlights(); + removeAllLineHighlights(); sketch.prepare(); sketch.build(verbose, saveHex); statusNotice(tr("Done compiling.")); @@ -2024,6 +2024,15 @@ public class Editor extends JFrame implements RunnerListener { } } + public void removeAllLineHighlights() { + textarea.removeAllLineHighlights(); + } + + public void addLineHighlight(int line) throws BadLocationException { + textarea.addLineHighlight(line, new Color(1, 0, 0, 0.2f)); + textarea.setCaretPosition(textarea.getLineStartOffset(line)); + } + private class DefaultStopHandler implements Runnable { public void run() { // TODO @@ -2276,7 +2285,7 @@ public class Editor extends JFrame implements RunnerListener { public boolean handleSave(boolean immediately) { //stopRunner(); handleStop(); // 0136 - textarea.removeAllLineHighlights(); + removeAllLineHighlights(); if (untitled) { return handleSaveAs(); @@ -2430,7 +2439,7 @@ public class Editor extends JFrame implements RunnerListener { public void run() { try { - textarea.removeAllLineHighlights(); + removeAllLineHighlights(); if (serialMonitor != null) { serialMonitor.suspend(); } @@ -2876,8 +2885,7 @@ public class Editor extends JFrame implements RunnerListener { System.err.println(I18n.format(tr("Bad error line: {0}"), line)); } else { try { - textarea.addLineHighlight(line, new Color(1, 0, 0, 0.2f)); - textarea.setCaretPosition(textarea.getLineStartOffset(line)); + addLineHighlight(line); } catch (BadLocationException e1) { e1.printStackTrace(); } From 577a1cea6ddfe8537f7cb0fbc845402a297192b4 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 27 Oct 2015 09:45:22 +0100 Subject: [PATCH 2/9] Added NULL as keyword. Fixes #4033 --- build/shared/lib/keywords.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/shared/lib/keywords.txt b/build/shared/lib/keywords.txt index cc700403f..e75c087e1 100644 --- a/build/shared/lib/keywords.txt +++ b/build/shared/lib/keywords.txt @@ -59,6 +59,7 @@ false LITERAL2 Constants LITERAL_BOOLEAN float LITERAL2 Float RESERVED_WORD_2 double LITERAL2 RESERVED_WORD_2 null LITERAL2 RESERVED_WORD_2 +NULL LITERAL2 RESERVED_WORD_2 int LITERAL2 Int RESERVED_WORD_2 long LITERAL2 Long RESERVED_WORD_2 new LITERAL2 RESERVED_WORD_2 From 8c57dd8adb403a01cf5cbbe25b5199f50289b9aa Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 27 Oct 2015 10:35:07 +0100 Subject: [PATCH 3/9] MacOSX: setting java.ext.dirs to both jre and jdk paths --- build/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.xml b/build/build.xml index 565c1618f..f916196a8 100644 --- a/build/build.xml +++ b/build/build.xml @@ -329,7 +329,7 @@