setting values tabs->new-tab-position[-explicit]

left -> prev
right -> next
This commit is contained in:
Daniel Karbach 2016-10-18 14:46:16 +02:00
parent 7eafa30084
commit ef3968c165
7 changed files with 35 additions and 27 deletions

View File

@ -1041,12 +1041,12 @@ How new tabs are positioned.
Valid values:
* +left+: On the left of the current tab.
* +right+: On the right of the current tab.
* +first+: At the left end.
* +last+: At the right end.
* +prev+: Before the current tab.
* +next+: After the current tab.
* +first+: At the beginning.
* +last+: At the end.
Default: +pass:[right]+
Default: +pass:[next]+
[[tabs-new-tab-position-explicit]]
=== new-tab-position-explicit
@ -1054,10 +1054,10 @@ How new tabs opened explicitly are positioned.
Valid values:
* +left+: On the left of the current tab.
* +right+: On the right of the current tab.
* +first+: At the left end.
* +last+: At the right end.
* +prev+: Before the current tab.
* +next+: After the current tab.
* +first+: At the beginning.
* +last+: At the end.
Default: +pass:[last]+

View File

@ -411,6 +411,14 @@ class ConfigManager(QObject):
CHANGED_OPTIONS = {
('content', 'cookies-accept'):
_get_value_transformer({'default': 'no-3rdparty'}),
('tabs', 'new-tab-position'):
_get_value_transformer({
'left': 'prev',
'right': 'next'}),
('tabs', 'new-tab-position-explicit'):
_get_value_transformer({
'left': 'prev',
'right': 'next'}),
('tabs', 'position'): _transform_position,
('tabs', 'select-on-remove'):
_get_value_transformer({

View File

@ -583,7 +583,7 @@ def data(readonly=False):
"Which tab to select when the focused tab is removed."),
('new-tab-position',
SettingValue(typ.NewTabPosition(), 'right'),
SettingValue(typ.NewTabPosition(), 'next'),
"How new tabs are positioned."),
('new-tab-position-explicit',

View File

@ -1436,10 +1436,10 @@ class NewTabPosition(BaseType):
def __init__(self, none_ok=False):
super().__init__(none_ok)
self.valid_values = ValidValues(
('left', "On the left of the current tab."),
('right', "On the right of the current tab."),
('first', "At the left end."),
('last', "At the right end."))
('prev', "Before the current tab."),
('next', "After the current tab."),
('first', "At the beginning."),
('last', "At the end."))
class IgnoreCase(Bool):

View File

@ -61,8 +61,8 @@ class TabbedBrowser(tabwidget.TabWidget):
_filter: A SignalFilter instance.
_now_focused: The tab which is focused now.
_tab_insert_idx_left: Where to insert a new tab with
tabbar -> new-tab-position set to 'left'.
_tab_insert_idx_right: Same as above, for 'right'.
tabbar -> new-tab-position set to 'prev'.
_tab_insert_idx_right: Same as above, for 'next'.
_undo_stack: List of UndoEntry namedtuples of closed tabs.
shutting_down: Whether we're currently shutting down.
_local_marks: Jump markers local to each page
@ -410,14 +410,14 @@ class TabbedBrowser(tabwidget.TabWidget):
pos = config.get('tabs', 'new-tab-position-explicit')
else:
pos = config.get('tabs', 'new-tab-position')
if pos == 'left':
if pos == 'prev':
idx = self._tab_insert_idx_left
# On first sight, we'd think we have to decrement
# 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
# *to the left* of the currently focused tab, indices will shift by
# *before* of the currently focused tab, indices will shift by
# 1 automatically.
elif pos == 'right':
elif pos == 'next':
idx = self._tab_insert_idx_right
self._tab_insert_idx_right += 1
elif pos == 'first':

View File

@ -75,8 +75,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (explicit)
Given I open about:blank
When I set tabs -> new-tab-position-explicit to right
And I set tabs -> new-tab-position to left
When I set tabs -> new-tab-position-explicit to next
And I set tabs -> new-tab-position to prev
And I run :tab-only
And I run :open -t http://localhost:(port)/data/numbers/7.txt
And I wait until data/numbers/7.txt is loaded
@ -86,8 +86,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (implicit)
Given I open about:blank
When I set tabs -> new-tab-position-explicit to right
And I set tabs -> new-tab-position to left
When I set tabs -> new-tab-position-explicit to next
And I set tabs -> new-tab-position to prev
And I run :tab-only
And I run :open -t -i http://localhost:(port)/data/numbers/8.txt
And I wait until data/numbers/8.txt is loaded

View File

@ -821,8 +821,8 @@ Feature: Tab management
- data/hints/html/simple.html (active)
- data/hello.txt
Scenario: opening tab with tabs->new-tab-position left
When I set tabs -> new-tab-position to left
Scenario: opening tab with tabs->new-tab-position prev
When I set tabs -> new-tab-position to prev
And I set tabs -> background-tabs to false
And I open about:blank
And I open data/hints/html/simple.html in a new tab
@ -833,8 +833,8 @@ Feature: Tab management
- data/hello.txt (active)
- data/hints/html/simple.html
Scenario: opening tab with tabs->new-tab-position right
When I set tabs -> new-tab-position to right
Scenario: opening tab with tabs->new-tab-position next
When I set tabs -> new-tab-position to next
And I set tabs -> background-tabs to false
And I open about:blank
And I open data/hints/html/simple.html in a new tab