From 0a6841d9b0a9513f48ce106a4bfebe46873a458f Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Fri, 5 Jun 2015 12:11:54 +0200 Subject: [PATCH] New editor: when start is greater than end, delegate to upstream token maker, that will create an empty token. Fixes #3293 --- app/src/processing/app/syntax/SketchTokenMaker.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/processing/app/syntax/SketchTokenMaker.java b/app/src/processing/app/syntax/SketchTokenMaker.java index 92f105bc5..14a1d936f 100644 --- a/app/src/processing/app/syntax/SketchTokenMaker.java +++ b/app/src/processing/app/syntax/SketchTokenMaker.java @@ -32,8 +32,6 @@ package processing.app.syntax; import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker; -import java.util.Arrays; - /** * Controls the syntax highlighting of {@link SketchTextArea} based on the {@link PdeKeywords} * @@ -51,6 +49,11 @@ public class SketchTokenMaker extends CPlusPlusTokenMaker { @Override public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) { + if (start > end) { + super.addToken(array, start, end, tokenType, startOffset, hyperlink); + return; + } + // This assumes all of your extra tokens would normally be scanned as IDENTIFIER. int newType = pdeKeywords.getTokenType(array, start, end); if (newType > -1) {