Merge branch 'Carpetsmoker-issue-401'

This commit is contained in:
Florian Bruhin 2015-05-30 22:49:48 +02:00
commit 3c8e616eb9
2 changed files with 19 additions and 6 deletions

View File

@ -144,10 +144,10 @@ Contributors, sorted by the number of commits in descending order:
* John ShaggyTwoDope Jenkins
* Jimmy
* Zach-Button
* Martin Tournoij
* rikn00
* Patric Schmitz
* Martin Zimmermann
* Martin Tournoij
* Error 800
* Brian Jackson
* sbinix

View File

@ -487,12 +487,25 @@ class WebView(QWebView):
old_scroll_pos = self.scroll_pos
flags = QWebPage.FindFlags(flags)
found = self.findText(text, flags)
if not found and not flags & QWebPage.HighlightAllOccurrences and text:
message.error(self.win_id, "Text '{}' not found on "
"page!".format(text), immediately=True)
else:
backward = int(flags) & QWebPage.FindBackward
backward = int(flags) & QWebPage.FindBackward
if not found and not flags & QWebPage.HighlightAllOccurrences and text:
# User disabled wrapping; but findText() just returns False. If we
# have a selection, we know there's a match *somewhere* on the page
if (not flags & QWebPage.FindWrapsAroundDocument and
self.hasSelection()):
if not backward:
message.warning(self.win_id, "Search hit BOTTOM without "
"match for: {}".format(text),
immediately=True)
else:
message.warning(self.win_id, "Search hit TOP without "
"match for: {}".format(text),
immediately=True)
else:
message.error(self.win_id, "Text '{}' not found on "
"page!".format(text), immediately=True)
else:
def check_scroll_pos():
"""Check if the scroll position got smaller and show info."""
if not backward and self.scroll_pos < old_scroll_pos: