Fixed bug introduced by GP-6178

This commit is contained in:
ghidragon
2026-03-23 16:37:25 -04:00
parent 9622e8096b
commit 38f797cbd0
5 changed files with 36 additions and 4 deletions
@@ -1924,7 +1924,7 @@ public class FieldPanel extends JPanel
// 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();
int width = layout.getWidth();
if (x > width) {
selectionEnd =
new FieldLocation(selectionEnd.getIndex().add(BigInteger.ONE));
@@ -185,6 +185,11 @@ public interface Layout {
int getEndRowFieldNum(int field2);
/**
* {@Returns the actual width of the layout}
*/
int getWidth();
/**
* Returns the smallest possible width of this layout that can display its full contents
* @return the smallest possible width of this layout that can display its full contents
@@ -70,6 +70,11 @@ public class AnchoredLayout implements Layout {
return layout.getHeight();
}
@Override
public int getWidth() {
return layout.getWidth();
}
@Override
public int getCompressableWidth() {
return layout.getCompressableWidth();
@@ -83,6 +83,15 @@ public class MultiRowLayout implements Layout {
return heightAbove + heightBelow;
}
@Override
public int getWidth() {
int max = 0;
for (Layout layout : layouts) {
max = Math.max(max, layout.getWidth());
}
return max;
}
@Override
public int getCompressableWidth() {
//
@@ -67,6 +67,19 @@ public class RowLayout implements Layout {
return heightAbove + heightBelow;
}
@Override
public int getWidth() {
int startX = fields[0].getStartX();
int rowWidth = startX;
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
int width = field.getWidth(); // layout manager width
rowWidth += width;
}
return rowWidth;
}
@Override
public int getCompressableWidth() {
//