diff options
Diffstat (limited to 'src/background/operators')
3 files changed, 7 insertions, 13 deletions
diff --git a/src/background/operators/impls/SelectTabNextOperator.ts b/src/background/operators/impls/SelectTabNextOperator.ts index 37482fe..34d37ff 100644 --- a/src/background/operators/impls/SelectTabNextOperator.ts +++ b/src/background/operators/impls/SelectTabNextOperator.ts @@ -2,10 +2,7 @@ import Operator from "../Operator"; import TabPresenter from "../../presenters/TabPresenter"; export default class SelectTabNextOperator implements Operator { - constructor( - private readonly tabPresenter: TabPresenter, - private readonly count: number - ) {} + constructor(private readonly tabPresenter: TabPresenter) {} async run(): Promise<void> { const tabs = await this.tabPresenter.getAll(); @@ -16,7 +13,7 @@ export default class SelectTabNextOperator implements Operator { if (!tab) { return; } - const select = (tab.index + this.count) % tabs.length; + const select = (tab.index + 1) % tabs.length; return this.tabPresenter.select(tabs[select].id as number); } } diff --git a/src/background/operators/impls/SelectTabPrevOperator.ts b/src/background/operators/impls/SelectTabPrevOperator.ts index 93a0d6d..3776c1a 100644 --- a/src/background/operators/impls/SelectTabPrevOperator.ts +++ b/src/background/operators/impls/SelectTabPrevOperator.ts @@ -2,10 +2,7 @@ import Operator from "../Operator"; import TabPresenter from "../../presenters/TabPresenter"; export default class SelectTabPrevOperator implements Operator { - constructor( - private readonly tabPresenter: TabPresenter, - private readonly count: number - ) {} + constructor(private readonly tabPresenter: TabPresenter) {} async run(): Promise<void> { const tabs = await this.tabPresenter.getAll(); @@ -16,7 +13,7 @@ export default class SelectTabPrevOperator implements Operator { if (!tab) { return; } - const select = (tab.index - this.count + tabs.length) % tabs.length; + const select = (tab.index - 1 + tabs.length) % tabs.length; return this.tabPresenter.select(tabs[select].id as number); } } diff --git a/src/background/operators/impls/TabOperatorFactoryChain.ts b/src/background/operators/impls/TabOperatorFactoryChain.ts index b4cb401..edd3eaf 100644 --- a/src/background/operators/impls/TabOperatorFactoryChain.ts +++ b/src/background/operators/impls/TabOperatorFactoryChain.ts @@ -7,7 +7,7 @@ import CloseTabOperator from "./CloseTabOperator"; import CloseTabRightOperator from "./CloseTabRightOperator"; import ReopenTabOperator from "./ReopenTabOperator"; import SelectTabPrevOperator from "./SelectTabPrevOperator"; -import SelectTabNextOperator from "./SelectTabPrevOperator"; +import SelectTabNextOperator from "./SelectTabNextOperator"; import SelectFirstTabOperator from "./SelectFirstTabOperator"; import SelectLastTabOperator from "./SelectLastTabOperator"; import SelectPreviousSelectedTabOperator from "./SelectPreviousSelectedTabOperator"; @@ -39,9 +39,9 @@ export default class TabOperatorFactoryChain implements OperatorFactoryChain { case operations.TAB_REOPEN: return new ReopenTabOperator(this.tabPresenter); case operations.TAB_PREV: - return new SelectTabPrevOperator(this.tabPresenter, 1); + return new SelectTabPrevOperator(this.tabPresenter); case operations.TAB_NEXT: - return new SelectTabNextOperator(this.tabPresenter, 1); + return new SelectTabNextOperator(this.tabPresenter); case operations.TAB_FIRST: return new SelectFirstTabOperator(this.tabPresenter); case operations.TAB_LAST: |