When calling the active tab idx setter do not re-record the current tab in the active tab history if the current tab will not actually change. Fixes #3871
This commit is contained in:
parent
1bd39ff935
commit
9c9d68561e
1 changed files with 4 additions and 1 deletions
|
|
@ -625,6 +625,9 @@ def active_tab_idx(self) -> int:
|
|||
|
||||
@active_tab_idx.setter
|
||||
def active_tab_idx(self, val: int) -> None:
|
||||
new_active_tab_idx = max(0, min(val, len(self.tabs) - 1))
|
||||
if new_active_tab_idx == self._active_tab_idx:
|
||||
return
|
||||
try:
|
||||
old_active_tab: Optional[Tab] = self.tabs[self._active_tab_idx]
|
||||
except Exception:
|
||||
|
|
@ -632,7 +635,7 @@ def active_tab_idx(self, val: int) -> None:
|
|||
else:
|
||||
assert old_active_tab is not None
|
||||
add_active_id_to_history(self.active_tab_history, old_active_tab.id)
|
||||
self._active_tab_idx = max(0, min(val, len(self.tabs) - 1))
|
||||
self._active_tab_idx = new_active_tab_idx
|
||||
try:
|
||||
new_active_tab: Optional[Tab] = self.tabs[self._active_tab_idx]
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Reference in a new issue