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,12 +185,17 @@ 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
*/
int getCompressableWidth();
/**
* Returns the index of the field at the given coordinates (relative to the layout)
* @param x the x coordinate
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -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() {
//