Skip to content

Commit 0a6841d

Browse files
author
Federico Fissore
committed
New editor: when start is greater than end, delegate to upstream token maker, that will create an empty token. Fixes #3293
1 parent cdae13c commit 0a6841d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/src/processing/app/syntax/SketchTokenMaker.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333
import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker;
3434

35-
import java.util.Arrays;
36-
3735
/**
3836
* Controls the syntax highlighting of {@link SketchTextArea} based on the {@link PdeKeywords}
3937
*
@@ -51,6 +49,11 @@ public SketchTokenMaker(PdeKeywords pdeKeywords) {
5149

5250
@Override
5351
public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
52+
if (start > end) {
53+
super.addToken(array, start, end, tokenType, startOffset, hyperlink);
54+
return;
55+
}
56+
5457
// This assumes all of your extra tokens would normally be scanned as IDENTIFIER.
5558
int newType = pdeKeywords.getTokenType(array, start, end);
5659
if (newType > -1) {

0 commit comments

Comments
 (0)