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.setAttribute(Qt.WA_DeleteOnClose)
|
||||||
diag.open(lambda: tab.print(diag.printer()))
|
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')
|
@cmdutils.register(instance='command-dispatcher')
|
||||||
def back(self, count=1):
|
def back(self, count=1):
|
||||||
"""Go back in the history of the current tab.
|
"""Go back in the history of the current tab.
|
||||||
|
@ -887,6 +887,7 @@ KEY_DATA = collections.OrderedDict([
|
|||||||
('tab-move +', ['gr']),
|
('tab-move +', ['gr']),
|
||||||
('tab-next', ['J']),
|
('tab-next', ['J']),
|
||||||
('tab-prev', ['K']),
|
('tab-prev', ['K']),
|
||||||
|
('tab-clone', ['gC']),
|
||||||
('reload', ['r']),
|
('reload', ['r']),
|
||||||
('back', ['H', '<Backspace>']),
|
('back', ['H', '<Backspace>']),
|
||||||
('forward', ['L']),
|
('forward', ['L']),
|
||||||
|
Loading…
Reference in New Issue
Block a user