Fixed: AS3 highlighter - links to other scripts with short names

This commit is contained in:
Jindra Petřík
2025-06-08 17:51:28 +02:00
parent eaf0ca0a9a
commit 7cb1d43181
2 changed files with 4 additions and 3 deletions
@@ -39,6 +39,7 @@ import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.editor.DebuggableEditorPane;
import com.jpexs.decompiler.flash.gui.editor.LinkType;
import com.jpexs.decompiler.flash.gui.editor.VariableMarker;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HighlightedText;
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
@@ -359,7 +360,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
return false;
}*/
SyntaxDocument sd = (SyntaxDocument) getDocument();
Token t = sd.getTokenAt(pos + 1);
Token t = VariableMarker.getIdentifierTokenAt(sd, pos); //sd.getTokenAt(pos + 1);
Token lastToken = t;
Token prev;
String propName = t.getString(sd);
@@ -182,7 +182,7 @@ public class VariableMarker implements SyntaxComponent, CaretListener, PropertyC
Markers.removeMarkers(pane, errorMarker);
}
private Token getIdentifierTokenAt(SyntaxDocument sDoc, int pos) {
public static Token getIdentifierTokenAt(SyntaxDocument sDoc, int pos) {
Token thisToken = sDoc.getTokenAt(pos);
if (thisToken != null && (thisToken.type == TokenType.IDENTIFIER || thisToken.type == TokenType.REGEX || thisToken.type == TokenType.KEYWORD)) {
return thisToken;
@@ -204,7 +204,7 @@ public class VariableMarker implements SyntaxComponent, CaretListener, PropertyC
return getNearestTokenAt(sDoc, pos);
}
private Token getNearestTokenAt(SyntaxDocument sDoc, int pos) {
private static Token getNearestTokenAt(SyntaxDocument sDoc, int pos) {
Token thisToken = sDoc.getTokenAt(pos);
if (thisToken != null) {