diff --git a/src/com/jpexs/decompiler/flash/gui/HexView.java b/src/com/jpexs/decompiler/flash/gui/HexView.java index b4ebe9a22..adc6ac243 100644 --- a/src/com/jpexs/decompiler/flash/gui/HexView.java +++ b/src/com/jpexs/decompiler/flash/gui/HexView.java @@ -169,24 +169,18 @@ public class HexView extends JTable { } public void scrollToByte(long byteNum) { - // HACK to scroll current selection to visible int row = (int) (byteNum / bytesInRow); - final int pageSize = (int) (getParent().getSize().getHeight() / getRowHeight()); - - int byteCount = data.length; - int rowCount = byteCount / bytesInRow; - if (byteCount % bytesInRow != 0) { - rowCount++; - } - - int row2 = Math.min(row + pageSize - 2, rowCount - 1); - getSelectionModel().setSelectionInterval(row2, row2); - scrollRectToVisible(new Rectangle(getCellRect(row2, 0, true))); - + //final int pageSize = (int) (getParent().getSize().getHeight() / getRowHeight()); getSelectionModel().setSelectionInterval(row, row); scrollRectToVisible(new Rectangle(getCellRect(row, 0, true))); - // END HACK } + public void scrollToByte(long[] byteNumStarts, long[] byteNumEnds) { + for (int i = 0; i < byteNumStarts.length; i++) { + scrollToByte(byteNumStarts[i]); + scrollToByte(byteNumEnds[i]); + scrollToByte(byteNumStarts[i]); + } + } } diff --git a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java index a9d0a96c9..2e68c2190 100644 --- a/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/dumpview/DumpViewPanel.java @@ -80,7 +80,7 @@ public class DumpViewPanel extends JPanel { int selectionStart = (int) dumpInfo.startByte; int selectionEnd = getEndIndex(dumpInfo); - dumpViewHexTable.scrollToByte(dumpInfo.startByte); + dumpViewHexTable.scrollToByte(highlightStarts, highlightEnds); setLabelText("startByte: " + dumpInfo.startByte + " startBit: " + dumpInfo.startBit