goto last method after saving p-code when outside trait method

Fixed: AS3 p-code/AS hilighting after p-code save
This commit is contained in:
Jindra Petřík
2021-03-05 21:22:55 +01:00
parent a4b2d2e31b
commit 509b08ac86
4 changed files with 23 additions and 2 deletions
@@ -77,7 +77,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
private ScriptPack script;
public int lastTraitIndex = 0;
public int lastTraitIndex = GraphTextWriter.TRAIT_UNKNOWN;
public boolean ignoreCarret = false;
@@ -526,6 +526,7 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
getCaret().setVisible(true);
int pos = getCaretPosition();
abcPanel.detailPanel.methodTraitPanel.methodCodePanel.setIgnoreCarret(true);
lastTraitIndex = GraphTextWriter.TRAIT_UNKNOWN;
try {
classIndex = -1;
Highlighting cm = Highlighting.searchPos(highlightedText.getClassHighlights(), pos);
@@ -609,6 +610,20 @@ public class DecompiledEditorPane extends DebuggableEditorPane implements CaretL
gotoTrait(lastTraitIndex);
}
public void gotoLastMethod() {
if (currentMethodHighlight != null) {
final int fpos = currentMethodHighlight.startPos;
new Timer().schedule(new TimerTask() {
@Override
public void run() {
if (fpos <= getDocument().getLength()) {
setCaretPosition(fpos);
}
}
}, 100);
}
}
public void gotoTrait(int traitId) {
boolean isScriptInit = traitId == GraphTextWriter.TRAIT_SCRIPT_INITIALIZER;