Fix stacking tabs setting with new_tab prev

This commit is contained in:
Jay Kamat 2018-06-19 12:06:26 -04:00
parent 1919029858
commit 0e7bbccd71
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 42 additions and 7 deletions

View File

@ -526,18 +526,21 @@ class TabbedBrowser(QWidget):
else: else:
pos = config.val.tabs.new_position.unrelated pos = config.val.tabs.new_position.unrelated
if pos == 'prev': if pos == 'prev':
idx = self._tab_insert_idx_left if config.val.tabs.new_position.stacking:
# On first sight, we'd think we have to decrement idx = self._tab_insert_idx_left
# self._tab_insert_idx_left here, as we want the next tab to be # On first sight, we'd think we have to decrement
# *before* the one we just opened. However, since we opened a tab # self._tab_insert_idx_left here, as we want the next tab to be
# *before* the currently focused tab, indices will shift by # *before* the one we just opened. However, since we opened a tab
# 1 automatically. # *before* the currently focused tab, indices will shift by
# 1 automatically.
else:
idx = self.widget.currentIndex()
elif pos == 'next': elif pos == 'next':
if config.val.tabs.new_position.stacking: if config.val.tabs.new_position.stacking:
idx = self._tab_insert_idx_right idx = self._tab_insert_idx_right
self._tab_insert_idx_right += 1
else: else:
idx = self.widget.currentIndex() + 1 idx = self.widget.currentIndex() + 1
self._tab_insert_idx_right += 1
elif pos == 'first': elif pos == 'first':
idx = 0 idx = 0
elif pos == 'last': elif pos == 'last':

View File

@ -911,6 +911,22 @@ Feature: Tab management
- data/navigate/prev.html - data/navigate/prev.html
- data/navigate/next.html - data/navigate/next.html
Scenario: stacking tabs opening tab with tabs.new_position.related prev
When I set tabs.new_position.related to prev
And I set tabs.new_position.stacking to true
And I set tabs.background to true
And I open about:blank
And I open data/navigate/index.html in a new tab
And I hint with args "all tab-bg" and follow a
And I hint with args "all tab-bg" and follow s
And I wait until data/navigate/prev.html is loaded
And I wait until data/navigate/next.html is loaded
Then the following tabs should be open:
- about:blank
- data/navigate/next.html
- data/navigate/prev.html
- data/navigate/index.html (active)
Scenario: no stacking tabs opening tab with tabs.new_position.related next Scenario: no stacking tabs opening tab with tabs.new_position.related next
When I set tabs.new_position.related to next When I set tabs.new_position.related to next
And I set tabs.new_position.stacking to false And I set tabs.new_position.stacking to false
@ -927,6 +943,22 @@ Feature: Tab management
- data/navigate/next.html - data/navigate/next.html
- data/navigate/prev.html - data/navigate/prev.html
Scenario: no stacking tabs opening tab with tabs.new_position.related prev
When I set tabs.new_position.related to prev
And I set tabs.new_position.stacking to false
And I set tabs.background to true
And I open about:blank
And I open data/navigate/index.html in a new tab
And I hint with args "all tab-bg" and follow a
And I hint with args "all tab-bg" and follow s
And I wait until data/navigate/prev.html is loaded
And I wait until data/navigate/next.html is loaded
Then the following tabs should be open:
- about:blank
- data/navigate/prev.html
- data/navigate/next.html
- data/navigate/index.html (active)
# :buffer # :buffer
Scenario: :buffer without args or count Scenario: :buffer without args or count