diff --git a/src/vs/base/browser/ui/grid/gridview.ts b/src/vs/base/browser/ui/grid/gridview.ts index 6f40d22b0a0..12619fee81c 100644 --- a/src/vs/base/browser/ui/grid/gridview.ts +++ b/src/vs/base/browser/ui/grid/gridview.ts @@ -27,14 +27,6 @@ export interface IView { layout(width: number, height: number): void; } -/* -TODO: - - NEW: add a color to show a border where the sash is, similar to how other - widgets have a color (e.g. Button, with applyStyles). Challenge is that this - color has to be applied via JS and not CSS to not apply it to all views - NOT CSS -*/ - export function orthogonal(orientation: Orientation): Orientation { return orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL; } diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 28d47fa6e15..7ecdc0e61c0 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -35,7 +35,7 @@ import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTa import { localize } from 'vs/nls'; import { Color } from 'vs/base/common/color'; import { CenteredViewLayout } from 'vs/base/browser/ui/centered/centeredViewLayout'; -import { IView } from 'vs/base/browser/ui/grid/gridview'; +import { IView, orthogonal } from 'vs/base/browser/ui/grid/gridview'; interface IEditorPartUIState { serializedGrid: ISerializedGrid; @@ -414,7 +414,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor const gridDescriptor = createSerializedGrid({ orientation: this.toGridViewOrientation( layout.orientation, - (this.gridWidget.orientation === Orientation.VERTICAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL // fix https://github.com/Microsoft/vscode/issues/52975 + this.isTwoDimensionalGrid() ? + this.gridWidget.orientation : // preserve original orientation for 2-dimensional grids + orthogonal(this.gridWidget.orientation) // otherwise flip (fix https://github.com/Microsoft/vscode/issues/52975) ), groups: layout.groups }); @@ -444,6 +446,17 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor } } + private isTwoDimensionalGrid(): boolean { + const views = this.gridWidget.getViews(); + if (isGridBranchNode(views)) { + // the grid is 2-dimensional if any children + // of the grid is a branch node + return views.children.some(child => isGridBranchNode(child)); + } + + return false; + } + addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView { const locationView = this.assertGroupView(location);