From 0755e163bb383f0f4d97d05da5904b8602b24879 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Tue, 19 Apr 2016 20:46:45 -0400 Subject: [PATCH] Only set the ' mark on normal/current hinting. Don't set ' for downloading, hovering, or opening a link in a tab. --- qutebrowser/browser/hints.py | 11 +++++++---- tests/integration/features/marks.feature | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index c1ba62ee1..9ec14388f 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -466,6 +466,13 @@ class HintManager(QObject): QMouseEvent(QEvent.MouseButtonRelease, pos, Qt.LeftButton, Qt.NoButton, modifiers), ] + + if context.target in [Target.normal, Target.current]: + # Set the pre-jump mark ', so we can jump back here after following + tabbed_browser = objreg.get('tabbed-browser', scope='window', + window=self._win_id) + tabbed_browser.set_mark("'") + if context.target == Target.current: elem.remove_blank_target() for evt in events: @@ -921,10 +928,6 @@ class HintManager(QObject): immediately=True) return if self._context.target in elem_handlers: - # Set the pre-jump mark ', so we can jump back here after following - tabbed_browser = objreg.get('tabbed-browser', scope='window', - window=self._win_id) - tabbed_browser.set_mark("'") handler = functools.partial( elem_handlers[self._context.target], elem, self._context) elif self._context.target in url_handlers: diff --git a/tests/integration/features/marks.feature b/tests/integration/features/marks.feature index c0d557236..585168367 100644 --- a/tests/integration/features/marks.feature +++ b/tests/integration/features/marks.feature @@ -81,3 +81,11 @@ Feature: Setting positional marks And I run :search-next And I run :jump-mark "'" Then the page should be scrolled to 0 0 + + Scenario: Hovering a hint does not set the ' mark + When I run :scroll-px 30 20 + And I run :scroll-perc 0 + And I run :hint links hover + And I run :follow-hint s + And I run :jump-mark "'" + Then the page should be scrolled to 30 20