add debug logging to searchbar

This commit is contained in:
Matt Rose 2020-06-01 21:00:13 -04:00
parent 9d5c2a6bb3
commit 31eb79b1e9
1 changed files with 5 additions and 0 deletions

View File

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