Skip to content

Commit

Permalink
Merge pull request #39734 from ironyman/resize-open
Browse files Browse the repository at this point in the history
Allow resizing of open editors pane
  • Loading branch information
isidorn committed Dec 12, 2017
2 parents d86d4ab + 076b3aa commit 441ad1e
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -318,7 +318,8 @@ export class OpenEditorsView extends ViewsViewletPanel {

private updateSize(): void {
// Adjust expanded body size
this.minimumBodySize = this.maximumBodySize = this.getExpandedBodySize(this.model);
this.minimumBodySize = this.getMinExpandedBodySize();
this.maximumBodySize = this.getMaxExpandedBodySize();
}

private updateDirtyIndicator(): void {
Expand All @@ -332,7 +333,14 @@ export class OpenEditorsView extends ViewsViewletPanel {
}
}

private getExpandedBodySize(model: IEditorStacksModel): number {
private getMaxExpandedBodySize(): number {
const elementCount = this.model.groups.map(g => g.count)
.reduce((first, second) => first + second, this.model.groups.length > 1
? this.model.groups.length : 0);
return elementCount * OpenEditorsDelegate.ITEM_HEIGHT;
}

private getMinExpandedBodySize(): number {
let visibleOpenEditors = this.configurationService.getValue<number>('explorer.openEditors.visible');
if (typeof visibleOpenEditors !== 'number') {
visibleOpenEditors = OpenEditorsView.DEFAULT_VISIBLE_OPEN_EDITORS;
Expand All @@ -343,10 +351,10 @@ export class OpenEditorsView extends ViewsViewletPanel {
dynamicHeight = OpenEditorsView.DEFAULT_DYNAMIC_HEIGHT;
}

return this.computeExpandedBodySize(visibleOpenEditors, dynamicHeight);
return this.computeMinExpandedBodySize(visibleOpenEditors, dynamicHeight);
}

private computeExpandedBodySize(visibleOpenEditors = OpenEditorsView.DEFAULT_VISIBLE_OPEN_EDITORS, dynamicHeight = OpenEditorsView.DEFAULT_DYNAMIC_HEIGHT): number {
private computeMinExpandedBodySize(visibleOpenEditors = OpenEditorsView.DEFAULT_VISIBLE_OPEN_EDITORS, dynamicHeight = OpenEditorsView.DEFAULT_DYNAMIC_HEIGHT): number {
let itemsToShow: number;
if (dynamicHeight) {
const elementCount = this.model.groups.map(g => g.count)
Expand Down

0 comments on commit 441ad1e

Please sign in to comment.