From 3fbb9a14e0829f39117e7c0c30aeb382647584a2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Mar 2017 21:34:33 +0100 Subject: [PATCH] Fix continuing a search after clearing it Fixes #2438 --- CHANGELOG.asciidoc | 1 + qutebrowser/browser/commands.py | 15 ++++++++------- tests/end2end/features/search.feature | 9 +++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 798b1fe48..aef9e0cb6 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,7 @@ Fixed (requires PyOpenGL to be installed) - Fixed crash when trying to retry downloads with QtWebEngine - Fixed crash when cloning page without history +- Fixed continuing a search after clearing it v0.10.1 ------- diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 2c2f0fdd2..0308fdac4 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1650,21 +1650,22 @@ class CommandDispatcher: tab = self._current_widget() tab.search.clear() + if not text: + return + options = { 'ignore_case': config.get('general', 'ignore-case'), 'reverse': reverse, } + self._tabbed_browser.search_text = text self._tabbed_browser.search_options = dict(options) - if text: - cb = functools.partial(self._search_cb, tab=tab, - old_scroll_pos=tab.scroller.pos_px(), - options=options, text=text, prev=False) - else: - cb = None - + cb = functools.partial(self._search_cb, tab=tab, + old_scroll_pos=tab.scroller.pos_px(), + options=options, text=text, prev=False) options['result_cb'] = cb + tab.search.search(text, **options) @cmdutils.register(instance='command-dispatcher', hide=True, diff --git a/tests/end2end/features/search.feature b/tests/end2end/features/search.feature index 87e51fc2c..a2e2bd6c9 100644 --- a/tests/end2end/features/search.feature +++ b/tests/end2end/features/search.feature @@ -110,6 +110,15 @@ Feature: Searching on a page And I run :yank selection Then the clipboard should contain "foo" + # https://github.com/qutebrowser/qutebrowser/issues/2438 + Scenario: Jumping to next match after clearing + When I set general -> ignore-case to true + And I run :search foo + And I run :search + And I run :search-next + And I run :yank selection + Then the clipboard should contain "foo" + ## :search-prev Scenario: Jumping to previous match