From 1e5e1eaafd0456daedfe06e77564615a1e037177 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 28 Jun 2018 07:27:58 +0200 Subject: [PATCH] fix #53179 --- src/vs/workbench/electron-browser/actions.ts | 30 +++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 00e815d1b81..4a2da932930 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -26,7 +26,7 @@ import * as browser from 'vs/base/browser/browser'; import { IIntegrityService } from 'vs/platform/integrity/common/integrity'; import { IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen'; import { ITimerService, IStartupMetrics } from 'vs/workbench/services/timer/common/timerService'; -import { IEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/editorGroupsService'; +import { IEditorGroupsService, GroupDirection, GroupLocation, IFindGroupScope } from 'vs/workbench/services/group/common/editorGroupsService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IPartService, Parts, Position as PartPosition } from 'vs/workbench/services/part/common/partService'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; @@ -1197,21 +1197,23 @@ export abstract class BaseNavigationAction extends Action { } protected navigateAcrossEditorGroup(direction: GroupDirection): TPromise { - const nextGroup = this.editorGroupService.findGroup({ direction }, this.editorGroupService.activeGroup); - if (nextGroup) { - nextGroup.focus(); + return this.doNavigateToEditorGroup({ direction }); + } + + protected navigateToEditorGroup(location: GroupLocation): TPromise { + return this.doNavigateToEditorGroup({ location }); + } + + private doNavigateToEditorGroup(scope: IFindGroupScope): TPromise { + const targetGroup = this.editorGroupService.findGroup(scope, this.editorGroupService.activeGroup); + if (targetGroup) { + targetGroup.focus(); return TPromise.as(true); } return TPromise.as(false); } - - protected navigateToActiveEditorGroup(): TPromise { - this.editorGroupService.activeGroup.focus(); - - return TPromise.as(true); - } } export class NavigateLeftAction extends BaseNavigationAction { @@ -1251,7 +1253,7 @@ export class NavigateLeftAction extends BaseNavigationAction { } if (!isPanelPositionDown) { - return this.navigateToActiveEditorGroup(); + return this.navigateToEditorGroup(GroupLocation.LAST); } return TPromise.as(false); @@ -1259,7 +1261,7 @@ export class NavigateLeftAction extends BaseNavigationAction { protected navigateOnSidebarFocus(isSidebarPositionLeft: boolean, isPanelPositionDown: boolean): TPromise { if (!isSidebarPositionLeft) { - return this.navigateToActiveEditorGroup(); + return this.navigateToEditorGroup(GroupLocation.LAST); } return TPromise.as(false); @@ -1311,7 +1313,7 @@ export class NavigateRightAction extends BaseNavigationAction { protected navigateOnSidebarFocus(isSidebarPositionLeft: boolean, isPanelPositionDown: boolean): TPromise { if (isSidebarPositionLeft) { - return this.navigateToActiveEditorGroup(); + return this.navigateToEditorGroup(GroupLocation.FIRST); } return TPromise.as(false); @@ -1340,7 +1342,7 @@ export class NavigateUpAction extends BaseNavigationAction { protected navigateOnPanelFocus(isSidebarPositionLeft: boolean, isPanelPositionDown: boolean): TPromise { if (isPanelPositionDown) { - return this.navigateToActiveEditorGroup(); + return this.navigateToEditorGroup(GroupLocation.LAST); } return TPromise.as(false); -- GitLab