From 7cb1d43181da7078d8f939c0a1154356d4d52266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 8 Jun 2025 17:51:28 +0200 Subject: [PATCH] Fixed: AS3 highlighter - links to other scripts with short names --- .../jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java | 3 ++- src/com/jpexs/decompiler/flash/gui/editor/VariableMarker.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 143c65ad9..45b44ae13 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -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); diff --git a/src/com/jpexs/decompiler/flash/gui/editor/VariableMarker.java b/src/com/jpexs/decompiler/flash/gui/editor/VariableMarker.java index 835ca7dc6..7ca659659 100644 --- a/src/com/jpexs/decompiler/flash/gui/editor/VariableMarker.java +++ b/src/com/jpexs/decompiler/flash/gui/editor/VariableMarker.java @@ -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) {