From a924144d9a1efea8e230c0a8e9235077174ce319 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 16 Apr 2016 00:12:14 -0400 Subject: [PATCH] Set ' mark after searching. Allow jumping back to the previous position after a search jumps you around. --- qutebrowser/browser/commands.py | 3 +++ tests/integration/features/marks.feature | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index fd2c61963..cf431c99c 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1415,6 +1415,7 @@ class CommandDispatcher: text: The text to search for. reverse: Reverse search direction. """ + self.set_mark("'") view = self._current_widget() self._clear_search(view, text) flags = 0 @@ -1445,6 +1446,7 @@ class CommandDispatcher: Args: count: How many elements to ignore. """ + self.set_mark("'") view = self._current_widget() self._clear_search(view, self._tabbed_browser.search_text) @@ -1465,6 +1467,7 @@ class CommandDispatcher: Args: count: How many elements to ignore. """ + self.set_mark("'") view = self._current_widget() self._clear_search(view, self._tabbed_browser.search_text) diff --git a/tests/integration/features/marks.feature b/tests/integration/features/marks.feature index 14ab84bfc..85fc76708 100644 --- a/tests/integration/features/marks.feature +++ b/tests/integration/features/marks.feature @@ -69,3 +69,18 @@ Feature: Setting positional marks And I run :follow-hint s And I run :jump-mark "'" Then the page should be scrolled to 0 0 + + Scenario: Jumping back after searching + When I run :hint links normal + And I run :search 48 + And I run :jump-mark "'" + Then the page should be scrolled to 0 0 + + Scenario: Jumping back after search-next + When I run :hint links normal + And I run :search 9 + And I run :search-next + And I run :search-next + And I run :search-next + And I run :jump-mark "'" + Then the page should be scrolled to 0 0