History flag: test added, short version changed, minor fixes
This commit is contained in:
parent
058c3e6541
commit
918b3e2d12
@ -152,7 +152,7 @@ class HintContext:
|
|||||||
to_follow: The link to follow when enter is pressed.
|
to_follow: The link to follow when enter is pressed.
|
||||||
args: Custom arguments for userscript/spawn
|
args: Custom arguments for userscript/spawn
|
||||||
rapid: Whether to do rapid hinting.
|
rapid: Whether to do rapid hinting.
|
||||||
chronicle: Whether to add yanked or spawned link to the history.
|
history: Whether to add yanked or spawned link to the history.
|
||||||
filterstr: Used to save the filter string for restoring in rapid mode.
|
filterstr: Used to save the filter string for restoring in rapid mode.
|
||||||
tab: The WebTab object we started hinting in.
|
tab: The WebTab object we started hinting in.
|
||||||
group: The group of web elements to hint.
|
group: The group of web elements to hint.
|
||||||
@ -165,7 +165,7 @@ class HintContext:
|
|||||||
self.baseurl = None
|
self.baseurl = None
|
||||||
self.to_follow = None
|
self.to_follow = None
|
||||||
self.rapid = False
|
self.rapid = False
|
||||||
self.chronicle = False
|
self.history = False
|
||||||
self.filterstr = None
|
self.filterstr = None
|
||||||
self.args = []
|
self.args = []
|
||||||
self.tab = None
|
self.tab = None
|
||||||
@ -603,15 +603,16 @@ class HintManager(QObject):
|
|||||||
@cmdutils.register(instance='hintmanager', scope='tab', name='hint',
|
@cmdutils.register(instance='hintmanager', scope='tab', name='hint',
|
||||||
star_args_optional=True, maxsplit=2)
|
star_args_optional=True, maxsplit=2)
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
|
@cmdutils.argument('history', flag="s")
|
||||||
def start(self, rapid=False, group=webelem.Group.all, target=Target.normal,
|
def start(self, rapid=False, group=webelem.Group.all, target=Target.normal,
|
||||||
*args, win_id, mode=None, chronicle=False):
|
*args, win_id, mode=None, history=False):
|
||||||
"""Start hinting.
|
"""Start hinting.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
rapid: Whether to do rapid hinting. This is only possible with
|
rapid: Whether to do rapid hinting. This is only possible with
|
||||||
targets `tab` (with background-tabs=true), `tab-bg`,
|
targets `tab` (with background-tabs=true), `tab-bg`,
|
||||||
`window`, `run`, `hover`, `userscript` and `spawn`.
|
`window`, `run`, `hover`, `userscript` and `spawn`.
|
||||||
chronicle: Whether to add spawned or yanked linked to the
|
history: Whether to add spawned or yanked link to the
|
||||||
browsing history.
|
browsing history.
|
||||||
group: The element types to hint.
|
group: The element types to hint.
|
||||||
|
|
||||||
@ -695,7 +696,7 @@ class HintManager(QObject):
|
|||||||
self._context.target = target
|
self._context.target = target
|
||||||
self._context.rapid = rapid
|
self._context.rapid = rapid
|
||||||
self._context.hint_mode = mode
|
self._context.hint_mode = mode
|
||||||
self._context.chronicle = chronicle
|
self._context.history = history
|
||||||
try:
|
try:
|
||||||
self._context.baseurl = tabbed_browser.current_url()
|
self._context.baseurl = tabbed_browser.current_url()
|
||||||
except qtutils.QtValueError:
|
except qtutils.QtValueError:
|
||||||
@ -865,8 +866,8 @@ class HintManager(QObject):
|
|||||||
return
|
return
|
||||||
handler = functools.partial(url_handlers[self._context.target],
|
handler = functools.partial(url_handlers[self._context.target],
|
||||||
url, self._context)
|
url, self._context)
|
||||||
if self._context.chronicle:
|
if self._context.history:
|
||||||
objreg.get('web-history').add_from_tab(url, url, "")
|
objreg.get('web-history').add_url(url, "")
|
||||||
else:
|
else:
|
||||||
raise ValueError("No suitable handler found!")
|
raise ValueError("No suitable handler found!")
|
||||||
|
|
||||||
|
@ -58,6 +58,13 @@ Feature: Page history
|
|||||||
And I run :history-clear
|
And I run :history-clear
|
||||||
Then the history file should be empty
|
Then the history file should be empty
|
||||||
|
|
||||||
|
Scenario: History with yanked URL and 'add to history' flag
|
||||||
|
When I open data/hints/html/simple.html
|
||||||
|
And I hint with args "--history links yank" and follow a
|
||||||
|
Then the history file should contain:
|
||||||
|
http://localhost:(port)/data/hints/html/simple.html Simple link
|
||||||
|
http://localhost:(port)/data/hello.txt
|
||||||
|
|
||||||
## Bugs
|
## Bugs
|
||||||
|
|
||||||
@qtwebengine_skip
|
@qtwebengine_skip
|
||||||
|
Loading…
Reference in New Issue
Block a user