Skip to content

Commit 6b5850e

Browse files
authored
Merge pull request microsoft#37348 from cleidigh/inc-dec-view-single-editor/bug
Fix logic for 1 editor Inc/Dec View command Fixes: microsoft#37347
2 parents 0e240e4 + 00f7474 commit 6b5850e

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

src/vs/workbench/browser/layout.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
710710

711711
// change part size along the main axis
712712
public resizePart(part: Parts, sizeChange: number): void {
713-
const visibleEditors = this.editorService.getVisibleEditors().length;
713+
const visibleEditorCount = this.editorService.getVisibleEditors().length;
714+
const panelPosition = this.partService.getPanelPosition();
714715
const sizeChangePxWidth = this.workbenchSize.width * (sizeChange / 100);
715716
const sizeChangePxHeight = this.workbenchSize.height * (sizeChange / 100);
716717

@@ -720,24 +721,37 @@ export class WorkbenchLayout implements IVerticalSashLayoutProvider, IHorizontal
720721
case Parts.SIDEBAR_PART:
721722
this.sidebarWidth = this.sidebarWidth + sizeChangePxWidth; // Sidebar can not become smaller than MIN_PART_WIDTH
722723

723-
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditors * MIN_EDITOR_PART_WIDTH)) {
724-
this.sidebarWidth = (this.workbenchSize.width - visibleEditors * MIN_EDITOR_PART_WIDTH);
724+
if (this.layoutEditorGroupsVertically && (this.workbenchSize.width - this.sidebarWidth < visibleEditorCount * MIN_EDITOR_PART_WIDTH)) {
725+
this.sidebarWidth = (this.workbenchSize.width - visibleEditorCount * MIN_EDITOR_PART_WIDTH);
725726
}
726727

727728
doLayout = true;
728729
break;
729730
case Parts.PANEL_PART:
730-
this.panelHeight = this.panelHeight + sizeChangePxHeight;
731-
this.panelWidth = this.panelWidth + sizeChangePxWidth;
731+
if (panelPosition === Position.BOTTOM) {
732+
this.panelHeight = this.panelHeight + sizeChangePxHeight;
733+
} else if (panelPosition === Position.RIGHT) {
734+
this.panelWidth = this.panelWidth + sizeChangePxWidth;
735+
}
736+
732737
doLayout = true;
733738
break;
734739
case Parts.EDITOR_PART:
735740
// If we have one editor we can cheat and resize sidebar with the negative delta
736-
const visibleEditorCount = this.editorService.getVisibleEditors().length;
737-
741+
// If the sidebar is not visible and panel is, resize panel main axis with negative Delta
738742
if (visibleEditorCount === 1) {
739-
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
740-
doLayout = true;
743+
if (this.partService.isVisible(Parts.SIDEBAR_PART)) {
744+
this.sidebarWidth = this.sidebarWidth - sizeChangePxWidth;
745+
doLayout = true;
746+
} else if (this.partService.isVisible(Parts.PANEL_PART)) {
747+
if (panelPosition === Position.BOTTOM) {
748+
this.panelHeight = this.panelHeight - sizeChangePxHeight;
749+
} else if (panelPosition === Position.RIGHT) {
750+
this.panelWidth = this.panelWidth - sizeChangePxWidth;
751+
}
752+
doLayout = true;
753+
}
754+
741755
} else {
742756
const stacks = this.editorGroupService.getStacksModel();
743757
const activeGroup = stacks.positionOfGroup(stacks.activeGroup);

0 commit comments

Comments
 (0)