From ca3df5e169d2483f27b3a60a6cb50c999d058e03 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 26 Jun 2014 11:10:31 +0200 Subject: [PATCH] Highlight and select text when searching --- qutebrowser/commands/managers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qutebrowser/commands/managers.py b/qutebrowser/commands/managers.py index 07dc781df..e7944491d 100644 --- a/qutebrowser/commands/managers.py +++ b/qutebrowser/commands/managers.py @@ -66,7 +66,9 @@ class SearchManager(QObject): do_search: If a search should be started. """ if self._text is not None and self._text != text: + # We first clear the marked text, then the highlights self.do_search.emit('', 0) + self.do_search.emit('', QWebPage.HighlightAllOccurrences) self._text = text self._flags = 0 if not config.get('general', 'ignore-case'): @@ -75,7 +77,11 @@ class SearchManager(QObject): self._flags |= QWebPage.FindWrapsAroundDocument if rev: self._flags |= QWebPage.FindBackward + # We actually search *twice* - once to highlight everything, then again + # to get a mark so we can navigate. self.do_search.emit(self._text, self._flags) + self.do_search.emit(self._text, self._flags | + QWebPage.HighlightAllOccurrences) @pyqtSlot(str) def search(self, text):