Make it possible to go back/forward in a new tab.
This commit is contained in:
parent
17f2241bc0
commit
8635dc8848
6
doc/TODO
6
doc/TODO
@ -270,12 +270,6 @@ Other
|
|||||||
[n]gc
|
[n]gc
|
||||||
Clear tab n or of current tab, clears the history of the tab and loads about:blank. (command clear_tab, aliases: clear).
|
Clear tab n or of current tab, clears the history of the tab and loads about:blank. (command clear_tab, aliases: clear).
|
||||||
|
|
||||||
th
|
|
||||||
Go back in a new tab (command tab_hist_back, aliases: tabback, tba).
|
|
||||||
|
|
||||||
tl
|
|
||||||
Go forward in a new tab (command tab_hist_forward, aliases: tabforward, tfo).
|
|
||||||
|
|
||||||
c/
|
c/
|
||||||
Find forward, ignore case (command find_forward_ic, alias: iffind).
|
Find forward, ignore case (command find_forward_ic, alias: iffind).
|
||||||
|
|
||||||
|
@ -299,25 +299,39 @@ class CommandDispatcher:
|
|||||||
qtutils.deserialize(history, newtab.history())
|
qtutils.deserialize(history, newtab.history())
|
||||||
return newtab
|
return newtab
|
||||||
|
|
||||||
|
def _back_forward(self, tab, bg, count, forward):
|
||||||
|
"""Helper function for :back/:forward."""
|
||||||
|
if tab or bg:
|
||||||
|
widget = self.tab_clone(bg)
|
||||||
|
else:
|
||||||
|
widget = self._current_widget()
|
||||||
|
for _ in range(count):
|
||||||
|
if forward:
|
||||||
|
widget.go_forward()
|
||||||
|
else:
|
||||||
|
widget.go_back()
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher')
|
@cmdutils.register(instance='command-dispatcher')
|
||||||
def back(self, count=1):
|
def back(self, tab=False, bg=False, count=1):
|
||||||
"""Go back in the history of the current tab.
|
"""Go back in the history of the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
tab: Go back in a new tab.
|
||||||
|
bg: Go back in a background tab.
|
||||||
count: How many pages to go back.
|
count: How many pages to go back.
|
||||||
"""
|
"""
|
||||||
for _ in range(count):
|
self._back_forward(tab, bg, count, forward=False)
|
||||||
self._current_widget().go_back()
|
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher')
|
@cmdutils.register(instance='command-dispatcher')
|
||||||
def forward(self, count=1):
|
def forward(self, tab=False, bg=False, count=1):
|
||||||
"""Go forward in the history of the current tab.
|
"""Go forward in the history of the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
tab: Go forward in a new tab.
|
||||||
|
bg: Go back in a background tab.
|
||||||
count: How many pages to go forward.
|
count: How many pages to go forward.
|
||||||
"""
|
"""
|
||||||
for _ in range(count):
|
self._back_forward(tab, bg, count, forward=True)
|
||||||
self._current_widget().go_forward()
|
|
||||||
|
|
||||||
def _navigate_incdec(self, url, tab, incdec):
|
def _navigate_incdec(self, url, tab, incdec):
|
||||||
"""Helper method for :navigate when `where' is increment/decrement.
|
"""Helper method for :navigate when `where' is increment/decrement.
|
||||||
|
@ -890,7 +890,9 @@ KEY_DATA = collections.OrderedDict([
|
|||||||
('tab-clone', ['gC']),
|
('tab-clone', ['gC']),
|
||||||
('reload', ['r']),
|
('reload', ['r']),
|
||||||
('back', ['H', '<Backspace>']),
|
('back', ['H', '<Backspace>']),
|
||||||
|
('back -t', ['th']),
|
||||||
('forward', ['L']),
|
('forward', ['L']),
|
||||||
|
('forward -t', ['tl']),
|
||||||
('hint', ['f']),
|
('hint', ['f']),
|
||||||
('hint all tab', ['F']),
|
('hint all tab', ['F']),
|
||||||
('hint all tab-bg', [';b']),
|
('hint all tab-bg', [';b']),
|
||||||
|
Loading…
Reference in New Issue
Block a user