Skip to content

Commit eacd0b4

Browse files
committed
FindReplaceOverlay: avoid inconsistent borders #2194
When the replace toggle in the FindReplaceOverlay is not shown because the target file is read-only or because the editor is too small to show the toggle button, the right border of the overlay is larger than the others. The reason is an inconsistent layout, as the container always expects two columns of elements but when the replace toggle is hidden only one column is present. With this change, the number of columns of the container is adapted according to whether the replace toggle is present or not. Fixed #2194
1 parent 462666b commit eacd0b4

File tree

1 file changed

+5
-3
lines changed
  • bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay

1 file changed

+5
-3
lines changed

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.eclipse.swt.graphics.Point;
3434
import org.eclipse.swt.graphics.Rectangle;
3535
import org.eclipse.swt.layout.GridData;
36+
import org.eclipse.swt.layout.GridLayout;
3637
import org.eclipse.swt.widgets.Composite;
3738
import org.eclipse.swt.widgets.Control;
3839
import org.eclipse.swt.widgets.Display;
@@ -695,9 +696,10 @@ private void enableReplaceToggle(boolean enable) {
695696
if (!okayToUse(replaceToggle)) {
696697
return;
697698
}
698-
boolean visible = enable && findReplaceLogic.getTarget().isEditable();
699-
((GridData) replaceToggleTools.getLayoutData()).exclude = !visible;
700-
replaceToggleTools.setVisible(visible);
699+
boolean shouldBeVisible = enable && findReplaceLogic.getTarget().isEditable();
700+
((GridLayout) containerControl.getLayout()).numColumns = shouldBeVisible ? 2 : 1;
701+
((GridData) replaceToggleTools.getLayoutData()).exclude = !shouldBeVisible;
702+
replaceToggleTools.setVisible(shouldBeVisible);
701703
}
702704

703705
private void enableReplaceTools(boolean enable) {

0 commit comments

Comments
 (0)