From 7e53db8aacf860ccceaa562a470cfb0920d56eaf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 5 May 2021 13:58:10 +0530 Subject: [PATCH] DRYer --- kitty/tabs.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index 94f92dfce..030a76428 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -755,10 +755,8 @@ class TabManager: # {{{ def remove(self, tab: Tab) -> None: active_tab_before_removal = self.active_tab self._remove_tab(tab) - try: - active_tab_needs_to_change = (self.active_tab is None and active_tab_before_removal is None) or self.active_tab is tab - except IndexError: - active_tab_needs_to_change = True + active_tab = self.active_tab + active_tab_needs_to_change = (active_tab is None and active_tab_before_removal is None) or active_tab is tab while True: try: self.active_tab_history.remove(tab.id)