setting values tabs->select-on-remove

left -> prev
right -> next
previous -> last-used

refs #1619
This commit is contained in:
Daniel Karbach 2016-10-18 11:40:17 +02:00
parent 1dd308b50b
commit 828b7d744a
5 changed files with 36 additions and 29 deletions

View File

@ -1029,11 +1029,11 @@ Which tab to select when the focused tab is removed.
Valid values: Valid values:
* +left+: Select the tab on the left. * +prev+: Select the tab which came before the closed one (left in horizontal, above in vertical).
* +right+: Select the tab on the right. * +next+: Select the tab which came after the closed one (right in horizontal, below in vertical).
* +previous+: Select the previously selected tab. * +last-used+: Select the previously selected tab.
Default: +pass:[right]+ Default: +pass:[next]+
[[tabs-new-tab-position]] [[tabs-new-tab-position]]
=== new-tab-position === new-tab-position

View File

@ -412,6 +412,11 @@ class ConfigManager(QObject):
('content', 'cookies-accept'): ('content', 'cookies-accept'):
_get_value_transformer({'default': 'no-3rdparty'}), _get_value_transformer({'default': 'no-3rdparty'}),
('tabs', 'position'): _transform_position, ('tabs', 'position'): _transform_position,
('tabs', 'select-on-remove'):
_get_value_transformer({
'left': 'prev',
'right': 'next',
'previous': 'last-used'}),
('ui', 'downloads-position'): _transform_position, ('ui', 'downloads-position'): _transform_position,
('ui', 'remove-finished-downloads'): ('ui', 'remove-finished-downloads'):
_get_value_transformer({'false': '-1', 'true': '1000'}), _get_value_transformer({'false': '-1', 'true': '1000'}),

View File

@ -579,7 +579,7 @@ def data(readonly=False):
"background."), "background."),
('select-on-remove', ('select-on-remove',
SettingValue(typ.SelectOnRemove(), 'right'), SettingValue(typ.SelectOnRemove(), 'next'),
"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',

View File

@ -1379,18 +1379,20 @@ class SelectOnRemove(MappingType):
"""Which tab to select when the focused tab is removed.""" """Which tab to select when the focused tab is removed."""
MAPPING = { MAPPING = {
'left': QTabBar.SelectLeftTab, 'prev': QTabBar.SelectLeftTab,
'right': QTabBar.SelectRightTab, 'next': QTabBar.SelectRightTab,
'previous': QTabBar.SelectPreviousTab, 'last-used': QTabBar.SelectPreviousTab,
} }
def __init__(self, none_ok=False): def __init__(self, none_ok=False):
super().__init__( super().__init__(
none_ok, none_ok,
valid_values=ValidValues( valid_values=ValidValues(
('left', "Select the tab on the left."), ('prev', "Select the tab which came before the closed one "
('right', "Select the tab on the right."), "(left in horizontal, above in vertical)."),
('previous', "Select the previously selected tab."))) ('next', "Select the tab which came after the closed one "
"(right in horizontal, below in vertical)."),
('last-used', "Select the previously selected tab.")))
class ConfirmQuit(FlagList): class ConfirmQuit(FlagList):

View File

@ -35,8 +35,8 @@ Feature: Tab management
- data/numbers/2.txt - data/numbers/2.txt
- data/numbers/3.txt (active) - data/numbers/3.txt (active)
Scenario: :tab-close with select-on-remove = right Scenario: :tab-close with select-on-remove = next
When I set tabs -> select-on-remove to right When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -46,8 +46,8 @@ Feature: Tab management
- data/numbers/1.txt - data/numbers/1.txt
- data/numbers/3.txt (active) - data/numbers/3.txt (active)
Scenario: :tab-close with select-on-remove = left Scenario: :tab-close with select-on-remove = prev
When I set tabs -> select-on-remove to left When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -57,8 +57,8 @@ Feature: Tab management
- data/numbers/1.txt (active) - data/numbers/1.txt (active)
- data/numbers/3.txt - data/numbers/3.txt
Scenario: :tab-close with select-on-remove = previous Scenario: :tab-close with select-on-remove = last-used
When I set tabs -> select-on-remove to previous When I set tabs -> select-on-remove to last-used
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -70,8 +70,8 @@ Feature: Tab management
- data/numbers/3.txt - data/numbers/3.txt
- data/numbers/4.txt (active) - data/numbers/4.txt (active)
Scenario: :tab-close with select-on-remove = left and --right Scenario: :tab-close with select-on-remove = prev and --right
When I set tabs -> select-on-remove to left When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -81,8 +81,8 @@ Feature: Tab management
- data/numbers/1.txt - data/numbers/1.txt
- data/numbers/3.txt (active) - data/numbers/3.txt (active)
Scenario: :tab-close with select-on-remove = right and --left Scenario: :tab-close with select-on-remove = next and --left
When I set tabs -> select-on-remove to right When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -92,8 +92,8 @@ Feature: Tab management
- data/numbers/1.txt (active) - data/numbers/1.txt (active)
- data/numbers/3.txt - data/numbers/3.txt
Scenario: :tab-close with select-on-remove = left and --opposite Scenario: :tab-close with select-on-remove = prev and --opposite
When I set tabs -> select-on-remove to left When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -103,8 +103,8 @@ Feature: Tab management
- data/numbers/1.txt - data/numbers/1.txt
- data/numbers/3.txt (active) - data/numbers/3.txt (active)
Scenario: :tab-close with select-on-remove = right and --opposite Scenario: :tab-close with select-on-remove = next and --opposite
When I set tabs -> select-on-remove to right When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab
@ -114,13 +114,13 @@ Feature: Tab management
- data/numbers/1.txt (active) - data/numbers/1.txt (active)
- data/numbers/3.txt - data/numbers/3.txt
Scenario: :tab-close with select-on-remove = previous and --opposite Scenario: :tab-close with select-on-remove = last-used and --opposite
When I set tabs -> select-on-remove to previous When I set tabs -> select-on-remove to last-used
And I run :tab-close --opposite And I run :tab-close --opposite
Then the error "-o is not supported with 'tabs->select-on-remove' set to 'previous'!" should be shown Then the error "-o is not supported with 'tabs->select-on-remove' set to 'last-used'!" should be shown
Scenario: :tab-close should restore selection behavior Scenario: :tab-close should restore selection behavior
When I set tabs -> select-on-remove to right When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt And I open data/numbers/1.txt
And I open data/numbers/2.txt in a new tab And I open data/numbers/2.txt in a new tab
And I open data/numbers/3.txt in a new tab And I open data/numbers/3.txt in a new tab