aboutsummaryrefslogtreecommitdiff
path: root/src/background/usecases
diff options
context:
space:
mode:
authorchocolateboy <chocolate@cpan.org>2019-07-28 05:35:07 +0100
committerchocolateboy <chocolate@cpan.org>2019-07-28 20:34:53 +0100
commit6605d3ea99c364a8f5f9d98a33e3ac89afb035f7 (patch)
tree341b3d4f6a7916e62ce1d96bdd440c6295c45a8c /src/background/usecases
parent3db11041c5b75c30b584893937876b6471e67cf2 (diff)
Add an option to close the current tab and select the tab to the left
Add an option to tabs.close to close the current tab and select the tab to the left. Bound to `D` by default, which replaces the tabs.close.right command, which is rarely-used. [1] The old `D` behavior has been moved to `gd`. + update the README and fix some lint errors [1] https://tinyurl.com/y4mj7hjy
Diffstat (limited to 'src/background/usecases')
-rw-r--r--src/background/usecases/TabUseCase.ts6
1 files changed, 5 insertions, 1 deletions
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]);
}