Merge branch 'fix_search_callbacks' of https://github.com/jupart/qutebrowser

This commit is contained in:
Florian Bruhin 2017-12-06 07:51:19 +01:00
commit 9ec4e749f1

View File

@ -126,13 +126,19 @@ class WebEngineSearch(browsertab.AbstractSearch):
def __init__(self, parent=None):
super().__init__(parent)
self._flags = QWebEnginePage.FindFlags(0)
self.num_of_searches = 0
def _find(self, text, flags, callback, caller):
"""Call findText on the widget."""
self.search_displayed = True
self.num_of_searches += 1
def wrapped_callback(found):
"""Wrap the callback to do debug logging."""
self.num_of_searches -= 1
if self.num_of_searches > 0:
return
found_text = 'found' if found else "didn't find"
if flags:
flag_text = 'with flags {}'.format(debug.qflags_key(