Merge tab-focus-last into tab-focus.
This commit is contained in:
parent
d302886b87
commit
b68f22541c
@ -125,6 +125,16 @@ class CommandDispatcher:
|
|||||||
elif direction == '+':
|
elif direction == '+':
|
||||||
return self._tabs.currentIndex() + delta
|
return self._tabs.currentIndex() + delta
|
||||||
|
|
||||||
|
def _tab_focus_last(self):
|
||||||
|
"""Select the tab which was last focused."""
|
||||||
|
if self._tabs.last_focused is None:
|
||||||
|
raise CommandError("No last focused tab!")
|
||||||
|
idx = self._tabs.indexOf(self._tabs.last_focused)
|
||||||
|
if idx == -1:
|
||||||
|
raise CommandError("Last focused tab vanished!")
|
||||||
|
self._tabs.setCurrentIndex(idx)
|
||||||
|
|
||||||
|
|
||||||
def _editor_cleanup(self, oshandle, filename):
|
def _editor_cleanup(self, oshandle, filename):
|
||||||
"""Clean up temporary file when the editor was closed."""
|
"""Clean up temporary file when the editor was closed."""
|
||||||
os.close(oshandle)
|
os.close(oshandle)
|
||||||
@ -574,9 +584,13 @@ class CommandDispatcher:
|
|||||||
"""Select the tab given as argument/[count].
|
"""Select the tab given as argument/[count].
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
index: The tab index to focus, starting with 1.
|
index: The tab index to focus, starting with 1. The special value
|
||||||
|
`last` focuses the last focused tab.
|
||||||
count: The tab index to focus, starting with 1.
|
count: The tab index to focus, starting with 1.
|
||||||
"""
|
"""
|
||||||
|
if index == 'last':
|
||||||
|
self._tab_focus_last()
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
idx = cmdutils.arg_or_count(index, count, default=1,
|
idx = cmdutils.arg_or_count(index, count, default=1,
|
||||||
countzero=self._tabs.count())
|
countzero=self._tabs.count())
|
||||||
@ -619,16 +633,6 @@ class CommandDispatcher:
|
|||||||
self._tabs.insertTab(new_idx, tab, icon, label)
|
self._tabs.insertTab(new_idx, tab, icon, label)
|
||||||
self._tabs.setCurrentIndex(new_idx)
|
self._tabs.setCurrentIndex(new_idx)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
|
||||||
def tab_focus_last(self):
|
|
||||||
"""Select the tab which was last focused."""
|
|
||||||
if self._tabs.last_focused is None:
|
|
||||||
raise CommandError("No last focused tab!")
|
|
||||||
idx = self._tabs.indexOf(self._tabs.last_focused)
|
|
||||||
if idx == -1:
|
|
||||||
raise CommandError("Last focused tab vanished!")
|
|
||||||
self._tabs.setCurrentIndex(idx)
|
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', split=False)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', split=False)
|
||||||
def spawn(self, *args):
|
def spawn(self, *args):
|
||||||
"""Spawn a command in a shell.
|
"""Spawn a command in a shell.
|
||||||
|
@ -650,7 +650,7 @@ DATA = OrderedDict([
|
|||||||
('wi', 'inspector'),
|
('wi', 'inspector'),
|
||||||
('gd', 'download-page'),
|
('gd', 'download-page'),
|
||||||
('ad', 'cancel-download'),
|
('ad', 'cancel-download'),
|
||||||
('<Ctrl-Tab>', 'tab-focus-last'),
|
('<Ctrl-Tab>', 'tab-focus last'),
|
||||||
('<Ctrl-V>', 'enter-mode passthrough'),
|
('<Ctrl-V>', 'enter-mode passthrough'),
|
||||||
('<Ctrl-Q>', 'quit'),
|
('<Ctrl-Q>', 'quit'),
|
||||||
('<Ctrl-Shift-T>', 'undo'),
|
('<Ctrl-Shift-T>', 'undo'),
|
||||||
|
Loading…
Reference in New Issue
Block a user