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:
* +left+: Select the tab on the left.
* +right+: Select the tab on the right.
* +previous+: Select the previously selected tab.
* +prev+: Select the tab which came before the closed one (left in horizontal, above in vertical).
* +next+: Select the tab which came after the closed one (right in horizontal, below in vertical).
* +last-used+: Select the previously selected tab.
Default: +pass:[right]+
Default: +pass:[next]+
[[tabs-new-tab-position]]
=== new-tab-position

View File

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

View File

@ -579,7 +579,7 @@ def data(readonly=False):
"background."),
('select-on-remove',
SettingValue(typ.SelectOnRemove(), 'right'),
SettingValue(typ.SelectOnRemove(), 'next'),
"Which tab to select when the focused tab is removed."),
('new-tab-position',

View File

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

View File

@ -35,8 +35,8 @@ Feature: Tab management
- data/numbers/2.txt
- data/numbers/3.txt (active)
Scenario: :tab-close with select-on-remove = right
When I set tabs -> select-on-remove to right
Scenario: :tab-close with select-on-remove = next
When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt (active)
Scenario: :tab-close with select-on-remove = left
When I set tabs -> select-on-remove to left
Scenario: :tab-close with select-on-remove = prev
When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt
Scenario: :tab-close with select-on-remove = previous
When I set tabs -> select-on-remove to previous
Scenario: :tab-close with select-on-remove = last-used
When I set tabs -> select-on-remove to last-used
And I open data/numbers/1.txt
And I open data/numbers/2.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/4.txt (active)
Scenario: :tab-close with select-on-remove = left and --right
When I set tabs -> select-on-remove to left
Scenario: :tab-close with select-on-remove = prev and --right
When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt (active)
Scenario: :tab-close with select-on-remove = right and --left
When I set tabs -> select-on-remove to right
Scenario: :tab-close with select-on-remove = next and --left
When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt
Scenario: :tab-close with select-on-remove = left and --opposite
When I set tabs -> select-on-remove to left
Scenario: :tab-close with select-on-remove = prev and --opposite
When I set tabs -> select-on-remove to prev
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt (active)
Scenario: :tab-close with select-on-remove = right and --opposite
When I set tabs -> select-on-remove to right
Scenario: :tab-close with select-on-remove = next and --opposite
When I set tabs -> select-on-remove to next
And I open data/numbers/1.txt
And I open data/numbers/2.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/3.txt
Scenario: :tab-close with select-on-remove = previous and --opposite
When I set tabs -> select-on-remove to previous
Scenario: :tab-close with select-on-remove = last-used and --opposite
When I set tabs -> select-on-remove to last-used
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
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/2.txt in a new tab
And I open data/numbers/3.txt in a new tab