From a31cacf4ee22fe2a963a0d431adfaea67f929b90 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 30 Apr 2022 09:58:20 -0700 Subject: [PATCH] focus the next tab after closing a tab - fixes #6325 --- tabby-core/src/services/app.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabby-core/src/services/app.service.ts b/tabby-core/src/services/app.service.ts index a49630e9..5a464092 100644 --- a/tabby-core/src/services/app.service.ts +++ b/tabby-core/src/services/app.service.ts @@ -144,7 +144,7 @@ export class AppService { } removeTab (tab: BaseTabComponent): void { - const newIndex = Math.max(0, this.tabs.indexOf(tab) - 1) + const newIndex = Math.min(this.tabs.length - 2, this.tabs.indexOf(tab)) this.tabs = this.tabs.filter((x) => x !== tab) if (tab === this._activeTab) { this.selectTab(this.tabs[newIndex])