Merge pull request #110 from mattrose/add-debug-to-searchbar

add debug logging to searchbar
This commit is contained in:
Matt Rose 2020-06-02 11:02:44 -04:00 committed by GitHub
commit aefaad75a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

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)