add debug logging to searchbar

This commit is contained in:
Matt Rose 2020-06-01 21:00:13 -04:00
parent 9d5c2a6bb3
commit 31eb79b1e9

View File

@ -12,6 +12,7 @@ from gi.repository import GLib
from .translation import _
from .config import Config
from . import regex
from .util import dbg
# pylint: disable-msg=R0904
class Searchbar(Gtk.HBox):
@ -125,7 +126,9 @@ class Searchbar(Gtk.HBox):
def do_search(self, widget):
"""Trap and re-emit the clicked signal"""
dbg('entered do_search')
searchtext = self.entry.get_text()
dbg('searchtext: %s' % searchtext)
if searchtext == '':
return
@ -136,6 +139,7 @@ class Searchbar(Gtk.HBox):
if regex.FLAGS_PCRE2:
try:
self.searchre = Vte.Regex.new_for_search(searchtext, len(searchtext), regex.FLAGS_PCRE2)
dbg('search RE: %s' % self.searchre)
self.vte.search_set_regex(self.searchre, 0)
except GLib.Error:
# happens when PCRE2 support is not builtin (Ubuntu < 19.10)
@ -144,6 +148,7 @@ class Searchbar(Gtk.HBox):
if not self.searchre:
# fall back to old GLib regex
self.searchre = GLib.Regex(searchtext, regex.FLAGS_GLIB, 0)
dbg('search RE: %s' % self.searchre)
self.vte.search_set_gregex(self.searchre, 0)
self.next.set_sensitive(True)