Skip to content

Commit cc2a164

Browse files
bpaseroBenjamin Pasero
authored andcommitted
1 parent fd4bf73 commit cc2a164

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/vs/base/browser/ui/grid/gridview.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ export interface IView {
2727
layout(width: number, height: number): void;
2828
}
2929

30-
/*
31-
TODO:
32-
- NEW: add a color to show a border where the sash is, similar to how other
33-
widgets have a color (e.g. Button, with applyStyles). Challenge is that this
34-
color has to be applied via JS and not CSS to not apply it to all views
35-
NOT CSS
36-
*/
37-
3830
export function orthogonal(orientation: Orientation): Orientation {
3931
return orientation === Orientation.VERTICAL ? Orientation.HORIZONTAL : Orientation.VERTICAL;
4032
}

src/vs/workbench/browser/parts/editor/editorPart.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { EditorDropTarget } from 'vs/workbench/browser/parts/editor/editorDropTa
3535
import { localize } from 'vs/nls';
3636
import { Color } from 'vs/base/common/color';
3737
import { CenteredViewLayout } from 'vs/base/browser/ui/centered/centeredViewLayout';
38-
import { IView } from 'vs/base/browser/ui/grid/gridview';
38+
import { IView, orthogonal } from 'vs/base/browser/ui/grid/gridview';
3939

4040
interface IEditorPartUIState {
4141
serializedGrid: ISerializedGrid;
@@ -414,7 +414,9 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
414414
const gridDescriptor = createSerializedGrid({
415415
orientation: this.toGridViewOrientation(
416416
layout.orientation,
417-
(this.gridWidget.orientation === Orientation.VERTICAL) ? Orientation.HORIZONTAL : Orientation.VERTICAL // fix https://github.com/Microsoft/vscode/issues/52975
417+
this.isTwoDimensionalGrid() ?
418+
this.gridWidget.orientation : // preserve original orientation for 2-dimensional grids
419+
orthogonal(this.gridWidget.orientation) // otherwise flip (fix https://github.com/Microsoft/vscode/issues/52975)
418420
),
419421
groups: layout.groups
420422
});
@@ -444,6 +446,17 @@ export class EditorPart extends Part implements EditorGroupsServiceImpl, IEditor
444446
}
445447
}
446448

449+
private isTwoDimensionalGrid(): boolean {
450+
const views = this.gridWidget.getViews();
451+
if (isGridBranchNode(views)) {
452+
// the grid is 2-dimensional if any children
453+
// of the grid is a branch node
454+
return views.children.some(child => isGridBranchNode(child));
455+
}
456+
457+
return false;
458+
}
459+
447460
addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView {
448461
const locationView = this.assertGroupView(location);
449462

0 commit comments

Comments
 (0)