Add setting for controlling stacking of new tabs

This commit is contained in:
Jay Kamat 2018-06-18 18:09:13 -04:00
parent 3399f2df96
commit 1919029858
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
3 changed files with 54 additions and 3 deletions

View File

@ -1348,12 +1348,27 @@ tabs.mousewheel_switching:
tabs.new_position.related:
default: next
type: NewTabPosition
desc: Position of new tabs opened from another tab.
desc: >-
Position of new tabs opened from another tab.
See `tabs.new_position.stacking` for controlling stacking behavior.
tabs.new_position.unrelated:
default: last
type: NewTabPosition
desc: "Position of new tabs which aren't opened from another tab."
desc: >-
Position of new tabs which are not opened from another tab.
See `tabs.new_position.stacking` for controlling stacking behavior.
tabs.new_position.stacking:
default: true
type: Bool
desc: >-
Stack relative tabs on top of each other when opened consecutively.
Only applies `next` and `prev` values of `tabs.new_position.related` and
`tabs.new_position.unrelated`.
tabs.padding:
default:

View File

@ -533,7 +533,10 @@ class TabbedBrowser(QWidget):
# *before* the currently focused tab, indices will shift by
# 1 automatically.
elif pos == 'next':
idx = self._tab_insert_idx_right
if config.val.tabs.new_position.stacking:
idx = self._tab_insert_idx_right
else:
idx = self.widget.currentIndex() + 1
self._tab_insert_idx_right += 1
elif pos == 'first':
idx = 0

View File

@ -894,6 +894,39 @@ Feature: Tab management
- about:blank
- data/hello.txt (active)
# stacking tabs
Scenario: stacking tabs opening tab with tabs.new_position.related next
When I set tabs.new_position.related to next
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/index.html (active)
- data/navigate/prev.html
- data/navigate/next.html
Scenario: no stacking tabs opening tab with tabs.new_position.related next
When I set tabs.new_position.related to next
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/index.html (active)
- data/navigate/next.html
- data/navigate/prev.html
# :buffer
Scenario: :buffer without args or count