Merge remote-tracking branch 'origin/pr/4008'

This commit is contained in:
Florian Bruhin 2018-10-05 17:15:42 +02:00
commit fddb10e157
3 changed files with 95 additions and 9 deletions

View File

@ -1475,12 +1475,27 @@ tabs.mousewheel_switching:
tabs.new_position.related: tabs.new_position.related:
default: next default: next
type: NewTabPosition 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: tabs.new_position.unrelated:
default: last default: last
type: NewTabPosition 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 related 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: tabs.padding:
default: default:

View File

@ -527,14 +527,20 @@ 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':
if config.val.tabs.new_position.stacking:
idx = self._tab_insert_idx_left idx = self._tab_insert_idx_left
# On first sight, we'd think we have to decrement # On first sight, we'd think we have to decrement
# self._tab_insert_idx_left here, as we want the next tab to be # self._tab_insert_idx_left here, as we want the next tab to be
# *before* the one we just opened. However, since we opened a tab # *before* the one we just opened. However, since we opened a
# *before* the currently focused tab, indices will shift by # tab *before* the currently focused tab, indices will shift by
# 1 automatically. # 1 automatically.
else:
idx = self.widget.currentIndex()
elif pos == 'next': elif pos == 'next':
if config.val.tabs.new_position.stacking:
idx = self._tab_insert_idx_right idx = self._tab_insert_idx_right
else:
idx = self.widget.currentIndex() + 1
self._tab_insert_idx_right += 1 self._tab_insert_idx_right += 1
elif pos == 'first': elif pos == 'first':
idx = 0 idx = 0

View File

@ -894,6 +894,71 @@ Feature: Tab management
- about:blank - about:blank
- data/hello.txt (active) - 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: 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
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
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