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

View File

@ -411,6 +411,14 @@ class ConfigManager(QObject):
CHANGED_OPTIONS = { CHANGED_OPTIONS = {
('content', 'cookies-accept'): ('content', 'cookies-accept'):
_get_value_transformer({'default': 'no-3rdparty'}), _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', 'position'): _transform_position,
('tabs', 'select-on-remove'): ('tabs', 'select-on-remove'):
_get_value_transformer({ _get_value_transformer({

View File

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

View File

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

View File

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

View File

@ -75,8 +75,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (explicit) Scenario: Opening in a new tab (explicit)
Given I open about:blank Given I open about:blank
When I set tabs -> new-tab-position-explicit to right When I set tabs -> new-tab-position-explicit to next
And I set tabs -> new-tab-position to left And I set tabs -> new-tab-position to prev
And I run :tab-only And I run :tab-only
And I run :open -t http://localhost:(port)/data/numbers/7.txt And I run :open -t http://localhost:(port)/data/numbers/7.txt
And I wait until data/numbers/7.txt is loaded And I wait until data/numbers/7.txt is loaded
@ -86,8 +86,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (implicit) Scenario: Opening in a new tab (implicit)
Given I open about:blank Given I open about:blank
When I set tabs -> new-tab-position-explicit to right When I set tabs -> new-tab-position-explicit to next
And I set tabs -> new-tab-position to left And I set tabs -> new-tab-position to prev
And I run :tab-only And I run :tab-only
And I run :open -t -i http://localhost:(port)/data/numbers/8.txt And I run :open -t -i http://localhost:(port)/data/numbers/8.txt
And I wait until data/numbers/8.txt is loaded 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/hints/html/simple.html (active)
- data/hello.txt - data/hello.txt
Scenario: opening tab with tabs->new-tab-position left Scenario: opening tab with tabs->new-tab-position prev
When I set tabs -> new-tab-position to left When I set tabs -> new-tab-position to prev
And I set tabs -> background-tabs to false And I set tabs -> background-tabs to false
And I open about:blank And I open about:blank
And I open data/hints/html/simple.html in a new tab And I open data/hints/html/simple.html in a new tab
@ -833,8 +833,8 @@ Feature: Tab management
- data/hello.txt (active) - data/hello.txt (active)
- data/hints/html/simple.html - data/hints/html/simple.html
Scenario: opening tab with tabs->new-tab-position right Scenario: opening tab with tabs->new-tab-position next
When I set tabs -> new-tab-position to right When I set tabs -> new-tab-position to next
And I set tabs -> background-tabs to false And I set tabs -> background-tabs to false
And I open about:blank And I open about:blank
And I open data/hints/html/simple.html in a new tab And I open data/hints/html/simple.html in a new tab