New editor: when start is greater than end, delegate to upstream token maker, that will create an empty token. Fixes #3293

This commit is contained in:
Federico Fissore 2015-06-05 12:11:54 +02:00
parent cdae13c3cc
commit 0a6841d9b0
1 changed files with 5 additions and 2 deletions

View File

@ -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) {