mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 02:32:19 +08:00
Merge remote-tracking branch 'origin/GP-6178_ghidragon_byteviewer_cant_select_last_byte_in_program--SQUASHED'
This commit is contained in:
+1
-1
@@ -762,7 +762,7 @@ public class ByteViewerComponent extends FieldPanel
|
|||||||
// if the selection ends on a separator line, go back to the end of the previous line
|
// if the selection ends on a separator line, go back to the end of the previous line
|
||||||
if (indexMap.isBlockSeparatorIndex(lineIndex)) {
|
if (indexMap.isBlockSeparatorIndex(lineIndex)) {
|
||||||
lineIndex = lineIndex.subtract(BigInteger.ONE);
|
lineIndex = lineIndex.subtract(BigInteger.ONE);
|
||||||
fieldNum = fieldFactories.length - 1; // set to end of line factory
|
fieldNum = fieldFactories.length; // set to end of line factory
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the selection is before the characters in this field, the selection doesn't include
|
// if the selection is before the characters in this field, the selection doesn't include
|
||||||
|
|||||||
@@ -1836,7 +1836,6 @@ public class FieldPanel extends JPanel
|
|||||||
private int mouseDownY;
|
private int mouseDownY;
|
||||||
private boolean didDrag;
|
private boolean didDrag;
|
||||||
private int timerScrollAmount;
|
private int timerScrollAmount;
|
||||||
private FieldLocation timerPoint;
|
|
||||||
|
|
||||||
MouseHandler() {
|
MouseHandler() {
|
||||||
scrollTimer = new Timer(100, this);
|
scrollTimer = new Timer(100, this);
|
||||||
@@ -1850,13 +1849,15 @@ public class FieldPanel extends JPanel
|
|||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
try {
|
try {
|
||||||
scrollView(timerScrollAmount);
|
scrollView(timerScrollAmount);
|
||||||
if (timerScrollAmount > 0) {
|
FieldLocation selectToLocation = new FieldLocation();
|
||||||
timerPoint.setIndex(layouts.get(layouts.size() - 1).getIndex());
|
if (timerScrollAmount >= 0) {
|
||||||
|
BigInteger lastIndex = layouts.get(layouts.size() - 1).getIndex();
|
||||||
|
selectToLocation.setIndex(lastIndex.add(BigInteger.ONE));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timerPoint.setIndex(layouts.get(0).getIndex());
|
selectToLocation.setIndex(layouts.get(0).getIndex());
|
||||||
}
|
}
|
||||||
selectionHandler.updateSelectionSequence(timerPoint);
|
selectionHandler.updateSelectionSequence(selectToLocation);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
// don't care
|
// don't care
|
||||||
@@ -1912,15 +1913,23 @@ public class FieldPanel extends JPanel
|
|||||||
if (((Math.abs(x - mouseDownX) > 3) || (Math.abs(y - mouseDownY) > 3))) {
|
if (((Math.abs(x - mouseDownX) > 3) || (Math.abs(y - mouseDownY) > 3))) {
|
||||||
didDrag = true;
|
didDrag = true;
|
||||||
if (selectionHandler.isInProgress()) {
|
if (selectionHandler.isInProgress()) {
|
||||||
if (y < 0 || y > getHeight()) {
|
if (y < 0 || y >= getHeight()) {
|
||||||
timerScrollAmount = y < 0 ? y : y - getHeight();
|
timerScrollAmount = y < 0 ? y : y - getHeight();
|
||||||
timerPoint = new FieldLocation(cursorPosition);
|
|
||||||
scrollTimer.start();
|
scrollTimer.start();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
scrollTimer.stop();
|
scrollTimer.stop();
|
||||||
cursorHandler.setCursorPos(x, y, null); // null means don't notify listeners
|
cursorHandler.setCursorPos(x, y, null); // null means don't notify listeners
|
||||||
selectionHandler.updateSelectionSequence(cursorPosition);
|
FieldLocation selectionEnd = cursorPosition;
|
||||||
|
// if the mouse is to the right of the last field, make the selection
|
||||||
|
// include the last field
|
||||||
|
Layout layout = getLayoutModel().getLayout(selectionEnd.getIndex());
|
||||||
|
int width = layout.getCompressableWidth();
|
||||||
|
if (x > width) {
|
||||||
|
selectionEnd =
|
||||||
|
new FieldLocation(selectionEnd.getIndex().add(BigInteger.ONE));
|
||||||
|
}
|
||||||
|
selectionHandler.updateSelectionSequence(selectionEnd);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2199,11 +2208,7 @@ public class FieldPanel extends JPanel
|
|||||||
currentField = null;
|
currentField = null;
|
||||||
// delegate to the appropriate layout to do the work
|
// delegate to the appropriate layout to do the work
|
||||||
Layout layout = findLayoutAt(y);
|
Layout layout = findLayoutAt(y);
|
||||||
if (layout == null) {
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
layout = findLayoutAt(y);
|
|
||||||
}
|
|
||||||
if (layout != null) {
|
if (layout != null) {
|
||||||
FieldLocation newCursorPosition = new FieldLocation();
|
FieldLocation newCursorPosition = new FieldLocation();
|
||||||
lastX = layout.setCursor(newCursorPosition, x, y);
|
lastX = layout.setCursor(newCursorPosition, x, y);
|
||||||
|
|||||||
Reference in New Issue
Block a user