Merge branch 'master' of https://github.com/iordanisg/qutebrowser
This commit is contained in:
commit
06d4a24bd1
@ -157,12 +157,14 @@ class CommandDispatcher:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _tab_focus_last(self):
|
def _tab_focus_last(self, show_error=True):
|
||||||
"""Select the tab which was last focused."""
|
"""Select the tab which was last focused."""
|
||||||
try:
|
try:
|
||||||
tab = objreg.get('last-focused-tab', scope='window',
|
tab = objreg.get('last-focused-tab', scope='window',
|
||||||
window=self._win_id)
|
window=self._win_id)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
if not show_error:
|
||||||
|
return
|
||||||
raise cmdexc.CommandError("No last focused tab!")
|
raise cmdexc.CommandError("No last focused tab!")
|
||||||
idx = self._tabbed_browser.indexOf(tab)
|
idx = self._tabbed_browser.indexOf(tab)
|
||||||
if idx == -1:
|
if idx == -1:
|
||||||
@ -1076,12 +1078,15 @@ class CommandDispatcher:
|
|||||||
last tab.
|
last tab.
|
||||||
count: The tab index to focus, starting with 1.
|
count: The tab index to focus, starting with 1.
|
||||||
"""
|
"""
|
||||||
|
index = count if count is not None else index
|
||||||
|
|
||||||
if index == 'last':
|
if index == 'last':
|
||||||
self._tab_focus_last()
|
self._tab_focus_last()
|
||||||
return
|
return
|
||||||
index = count if count is not None else index
|
elif index == self._current_index() + 1:
|
||||||
|
self._tab_focus_last(show_error=False)
|
||||||
if index is None:
|
return
|
||||||
|
elif index is None:
|
||||||
self.tab_next()
|
self.tab_next()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ Feature: Javascript stuff
|
|||||||
And I open data/javascript/window_open.html in a new tab
|
And I open data/javascript/window_open.html in a new tab
|
||||||
And I run :click-element id open-normal
|
And I run :click-element id open-normal
|
||||||
And I wait for "Changing title for idx 2 to 'about:blank'" in the log
|
And I wait for "Changing title for idx 2 to 'about:blank'" in the log
|
||||||
And I run :tab-focus 2
|
And I run :buffer window_open.html
|
||||||
And I run :click-element id close-twice
|
And I run :click-element id close-twice
|
||||||
And I wait for "Focus object changed: *" in the log
|
And I wait for "Focus object changed: *" in the log
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
@ -236,6 +236,18 @@ Feature: Tab management
|
|||||||
- data/numbers/2.txt
|
- data/numbers/2.txt
|
||||||
- data/numbers/3.txt
|
- data/numbers/3.txt
|
||||||
|
|
||||||
|
Scenario: :tab-focus with current tab number
|
||||||
|
When 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
|
||||||
|
And I run :tab-focus 1
|
||||||
|
And I run :tab-focus 3
|
||||||
|
And I run :tab-focus 3
|
||||||
|
Then the following tabs should be open:
|
||||||
|
- data/numbers/1.txt (active)
|
||||||
|
- data/numbers/2.txt
|
||||||
|
- data/numbers/3.txt
|
||||||
|
|
||||||
Scenario: :tab-focus with -1
|
Scenario: :tab-focus with -1
|
||||||
When I open data/numbers/1.txt
|
When 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
|
||||||
|
Loading…
Reference in New Issue
Block a user