fix page search
This commit is contained in:
parent
0bc001dee3
commit
d3e25e8638
|
@ -307,7 +307,7 @@ class WebTab(BuilderBase, Gtk.Box):
|
|||
elif action == 'clear':
|
||||
if self._data.search:
|
||||
self.search.search_finish()
|
||||
self._data.search = False
|
||||
self._data.search = None
|
||||
|
||||
text.set_text('')
|
||||
|
||||
|
@ -315,22 +315,19 @@ class WebTab(BuilderBase, Gtk.Box):
|
|||
self.search_action('close' if search.get_visible() else 'open')
|
||||
|
||||
elif action == 'search':
|
||||
if self._data.search:
|
||||
return
|
||||
search_text = kwargs.get('text', text.get_text())
|
||||
|
||||
if kwargs.get('text'):
|
||||
search_text = kwargs.get('text')
|
||||
|
||||
else:
|
||||
search_text = text.get_text()
|
||||
if not kwargs.get('force', False) and search_text == self._data.search:
|
||||
return self.search_action('next')
|
||||
|
||||
options = WebKit2.FindOptions.WRAP_AROUND
|
||||
|
||||
if kwargs.get('insensitive'):
|
||||
options += WebKit2.FindOptions.CASE_INSENSITIVE
|
||||
if kwargs.get('insensitive', True):
|
||||
options = options | WebKit2.FindOptions.CASE_INSENSITIVE
|
||||
|
||||
self.search.search(search_text, options, int(kwargs.get('limit', 1000)))
|
||||
self._data.search = True
|
||||
self.search.search_previous()
|
||||
self._data.search = search_text
|
||||
|
||||
elif action == 'next':
|
||||
if not self._data.search:
|
||||
|
|
Reference in a new issue