Skip to content

Ghidra is a software reverse engineering (SRE) framework

BitFields - corrected autoscroll during drag

ghidra1f1ea4dea3110
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
index 54ad82e116..a2b82c3b56 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java
@@ -284,10 +284,21 @@ public class BitFieldEditorPanel extends JPanel {
if (!selectionActive) {
return;
}
- int bitOffset = placementComponent.getBitOffset(e.getPoint());
+
+ Point p = e.getPoint();
+ int bitOffset = placementComponent.getBitOffset(p);
if (bitOffset == lastBit) {
return;
}
+
+ // ensure that scroll region keeps mouse point visible
+ if (!placementComponent.getVisibleRect().contains(p)) {
+ BitAttributes bitAttributes = placementComponent.getBitAttributes(e.getPoint());
+ if (bitAttributes != null) {
+ placementComponent.scrollRectToVisible(bitAttributes.rectangle);
+ }
+ }
+
if (bitOffset >= 0) {
// NOTE: spinner models require use of long values
lastBit = bitOffset;