Add a :tab-clone command.
This commit is contained in:
parent
4410536f69
commit
17f2241bc0
@ -282,6 +282,23 @@ class CommandDispatcher:
|
||||
diag.setAttribute(Qt.WA_DeleteOnClose)
|
||||
diag.open(lambda: tab.print(diag.printer()))
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher')
|
||||
def tab_clone(self, bg=False):
|
||||
"""Duplicate the current tab.
|
||||
|
||||
Args:
|
||||
bg: Open in a background tab.
|
||||
|
||||
Return:
|
||||
The new QWebView.
|
||||
"""
|
||||
curtab = self._current_widget()
|
||||
tabbed_browser = objreg.get('tabbed-browser')
|
||||
newtab = tabbed_browser.tabopen(background=bg, explicit=True)
|
||||
history = qtutils.serialize(curtab.history())
|
||||
qtutils.deserialize(history, newtab.history())
|
||||
return newtab
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher')
|
||||
def back(self, count=1):
|
||||
"""Go back in the history of the current tab.
|
||||
|
@ -887,6 +887,7 @@ KEY_DATA = collections.OrderedDict([
|
||||
('tab-move +', ['gr']),
|
||||
('tab-next', ['J']),
|
||||
('tab-prev', ['K']),
|
||||
('tab-clone', ['gC']),
|
||||
('reload', ['r']),
|
||||
('back', ['H', '<Backspace>']),
|
||||
('forward', ['L']),
|
||||
|
Loading…
Reference in New Issue
Block a user