dont forget state on closing unrelated tab; forget state if more than one background children is created
This commit is contained in:
parent
df1893860c
commit
68ccc3c136
|
|
@ -464,9 +464,11 @@ class TabbedBrowser(QWidget):
|
|||
return False
|
||||
|
||||
opened = self._opened_tab()
|
||||
self._opened_tab = None # Clear state
|
||||
if opened is tab:
|
||||
self._opened_tab = None # Consume state
|
||||
return True
|
||||
|
||||
return opened is tab
|
||||
return False
|
||||
|
||||
def close_tab(self, tab, *, add_undo=True, new_undo=True, transfer=False,
|
||||
allow_firefox_behavior=True):
|
||||
|
|
@ -700,7 +702,10 @@ class TabbedBrowser(QWidget):
|
|||
|
||||
# Track opened tab for tabs.select_on_remove = 'firefox'
|
||||
if self.widget.count() > 0:
|
||||
self._opened_tab = weakref.ref(tab)
|
||||
if self._opened_tab is not None and background:
|
||||
self._opened_tab = None
|
||||
else:
|
||||
self._opened_tab = weakref.ref(tab)
|
||||
|
||||
if background:
|
||||
# Make sure the background tab has the correct initial size.
|
||||
|
|
|
|||
|
|
@ -76,3 +76,34 @@ Feature: Tab selection on remove (firefox behavior)
|
|||
When I set tabs.select_on_remove to firefox
|
||||
And I run :tab-close --opposite
|
||||
Then the error "-o is not supported with 'tabs.select_on_remove' set to 'firefox'!" should be shown
|
||||
|
||||
Scenario: Opening a second background tab forgets the state
|
||||
When I set tabs.select_on_remove to firefox
|
||||
And I open data/numbers/1.txt
|
||||
And I open data/numbers/4.txt in a new tab
|
||||
And I run :tab-focus 1
|
||||
And I open data/numbers/2.txt in a new background tab
|
||||
And I open data/numbers/3.txt in a new background tab
|
||||
And I run :tab-focus 3
|
||||
And I run :tab-close
|
||||
Then the following tabs should be open:
|
||||
"""
|
||||
- data/numbers/1.txt
|
||||
- data/numbers/2.txt
|
||||
- data/numbers/4.txt (active)
|
||||
"""
|
||||
|
||||
Scenario: Opening a foreground tab creates a state
|
||||
When I set tabs.select_on_remove to firefox
|
||||
And I open data/numbers/1.txt
|
||||
And I open data/numbers/4.txt in a new tab
|
||||
And I run :tab-focus 1
|
||||
And I open data/numbers/2.txt in a new background tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :tab-close
|
||||
Then the following tabs should be open:
|
||||
"""
|
||||
- data/numbers/1.txt (active)
|
||||
- data/numbers/4.txt
|
||||
- data/numbers/2.txt
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue