diff options
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/controllers/OperationController.ts | 2 | ||||
-rw-r--r-- | src/background/usecases/TabUseCase.ts | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/background/controllers/OperationController.ts b/src/background/controllers/OperationController.ts index 51cff28..7a10ad6 100644 --- a/src/background/controllers/OperationController.ts +++ b/src/background/controllers/OperationController.ts @@ -32,7 +32,7 @@ export default class OperationController { doOperation(operation: operations.Operation): Promise<any> { switch (operation.type) { case operations.TAB_CLOSE: - return this.tabUseCase.close(false); + return this.tabUseCase.close(false, operation.select === 'left'); case operations.TAB_CLOSE_RIGHT: return this.tabUseCase.closeRight(); case operations.TAB_CLOSE_FORCE: diff --git a/src/background/usecases/TabUseCase.ts b/src/background/usecases/TabUseCase.ts index 31112a9..386307e 100644 --- a/src/background/usecases/TabUseCase.ts +++ b/src/background/usecases/TabUseCase.ts @@ -12,11 +12,15 @@ export default class TabUseCase { ) { } - async close(force: boolean): Promise<any> { + async close(force: boolean, selectLeft = false): Promise<any> { let tab = await this.tabPresenter.getCurrent(); if (!force && tab.pinned) { return Promise.resolve(); } + if (selectLeft && tab.index > 0) { + let tabs = await this.tabPresenter.getAll(); + await this.tabPresenter.select(tabs[tab.index - 1].id as number); + } return this.tabPresenter.remove([tab.id as number]); } |