diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f694d0bd..ad4cff20a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. - AS1/2 script search does not show all results - #1633 AS3 decompilation - return in for..in clause - AS3 p-code/AS hilighting when outside trait +- AS3 p-code/AS hilighting after p-code save ### Removed - #1631 ActiveX Flash component download in windows installer diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java index 3f4f1a03f..d53cb9f0c 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ASMSourceEditorPane.java @@ -318,6 +318,7 @@ public class ASMSourceEditorPane extends DebuggableEditorPane implements CaretLi textWithHex = null; textNoHex = null; textHexOnly = null; + setHex(exportMode, true); } catch (IOException ex) { } catch (InterruptedException ex) { } catch (AVM2ParseException ex) { diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java index 36f04de35..4d00a0c9b 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DecompiledEditorPane.java @@ -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; diff --git a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java index e6a043e43..2efde2000 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/DetailPanel.java @@ -313,7 +313,11 @@ public class DetailPanel extends JPanel implements TagEditorPanel { @Override public void run() { decompiledTextArea.removeScriptListener(this); - decompiledTextArea.gotoTrait(lastTrait); + if (lastTrait == GraphTextWriter.TRAIT_UNKNOWN) { + decompiledTextArea.gotoLastMethod(); + } else { + decompiledTextArea.gotoTrait(lastTrait); + } setEditMode(false); View.showMessageDialog(null, AppStrings.translate("message.trait.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showTraitSavedMessage); }