Changed Topic, See Update 2 Below
I am wondering if anyone can tell me if there is a way to configure the default position of the center splitter.
The default appears to be a 60/40 split and I would like to set this to a 72/28 split by default.
I can, of course, manually set the center splitter, but after a particular sequence of key presses the center splitter returns to the current default: 60/40.
Steps to Reproduce:
- With all panes visible, move center slider to some position other than the default.
Ctrl+Shift+1
Ctrl+Alt+Shift+F12
Ctrl+Shift+1
Ctrl+Shift+1
Ctrl+Alt+Shift+F12
R Studio version: 1.3.959
OS: Windows 10
Update 1
This seems to be related to the following behavior:
If the center slider is between 0% and 40% from the left with all panes visible,
Ctrl+Alt+Shift+0
(Show All Panes) will reset the center splitter to 40%
If the center slider is between 60% and 100% from the left with all panes visible,
Ctrl+Alt+Shift+0
(Show All Panes) will reset the center splitter to 60%
If the center slider is between 40% and 60% from the left with all panes visible,
Ctrl+Alt+Shift+0
(Show All Panes) has no effect.
So, a simpler reprex is to set the center slider at 72% then
Ctrl+Alt+Shift+F12
Ctrl+Alt+Shift+0
Update 2
It appears this divide is hard-coded in the PaneManager.java file.
Ctrl+Alt+Shift+0
triggers a call to the function: layoutEndZoom
which calls restoreLayout
:
private void restoreLayout()
{
// If we're currently zoomed, then use that to provide the previous
// 'non-zoom' state.
if (maximizedWindow_ != null)
restoreSavedLayout();
else
restoreFourPaneLayout();
}
So it seems that zooming a column does not cause maximizedWindow_
to have a non-null value, thus instead of restoring the saved layout, it calls restoreFourPaneLayout
, which then calls restoreTwoColumnLayout
.
private void restoreFourPaneLayout()
{
// Ensure that all windows are in the 'normal' state. This allows
// hidden windows to display themselves, and so on. This also forces
// widgets to size themselves vertically.
for (LogicalWindow window : panes_)
window.onWindowStateChange(new WindowStateChangeEvent(WindowState.NORMAL, true));
restoreTwoColumnLayout();
}
private void restoreTwoColumnLayout()
{
double rightWidth = panel_.getWidgetSize(right_);
double panelWidth = panel_.getOffsetWidth();
double minThreshold = (2.0 / 5.0) * panelWidth;
double maxThreshold = (3.0 / 5.0) * panelWidth;
if (rightWidth <= minThreshold)
resizeHorizontally(rightWidth, minThreshold);
else if (rightWidth >= maxThreshold)
resizeHorizontally(rightWidth, maxThreshold);
invalidateSavedLayoutState(true);
}
Which explains the behavior I saw above. Since these values are hard-coded, it's not going to be possible to change the default split.
Does this now become a bug report or a feature request for showing all panes from a zoomed left column to restore the saved layout?