From f59b4a2acb3c55d755bc76d7be7bd07f963f331a Mon Sep 17 00:00:00 2001 From: David-Solodukhin Date: Sat, 5 Dec 2020 01:14:34 -0800 Subject: [PATCH] Fix search with vte 0.6+ --- guake/boxes.py | 8 ++++---- guake/globals.py | 4 ++++ .../notes/fix_search_vte0.46-b92145bc1e572521.yaml | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/fix_search_vte0.46-b92145bc1e572521.yaml diff --git a/guake/boxes.py b/guake/boxes.py index d09045168..2e305f437 100644 --- a/guake/boxes.py +++ b/guake/boxes.py @@ -18,6 +18,7 @@ from guake.callbacks import TerminalContextMenuCallbacks from guake.dialogs import PromptResetColorsDialog from guake.dialogs import RenameDialog +from guake.globals import PCRE2_MULTILINE from guake.menus import mk_tab_context_menu from guake.menus import mk_terminal_context_menu from guake.utils import HidePrevention @@ -366,7 +367,7 @@ def on_search_entry_keypress(self, widget, event): self.search_prev = True def reset_term_search(self, term): - term.search_set_gregex(GLib.Regex("", 0, 0), 0) + term.search_set_regex(None, 0) term.search_find_next() def set_search(self, widget): @@ -381,9 +382,8 @@ def set_search(self, widget): # Set search regex on term self.searchstring = text - self.searchre = GLib.Regex(text, 0, 0) - term.search_set_gregex(self.searchre, 0) - + self.searchre = Vte.Regex.new_for_search(text, -1, Vte.REGEX_FLAGS_DEFAULT | PCRE2_MULTILINE) + term.search_set_regex(self.searchre, 0) self.do_search(None) def do_search(self, widget): diff --git a/guake/globals.py b/guake/globals.py index c3269ec1b..fcc03264e 100644 --- a/guake/globals.py +++ b/guake/globals.py @@ -110,3 +110,7 @@ def is_run_from_git_workdir(): # Tabs session schema version TABS_SESSION_SCHEMA_VERSION = 2 + +# Constants for vte regex matching are documented in the pcre2 api: +# https://www.pcre.org/current/doc/html/pcre2api.html +PCRE2_MULTILINE = 0x00000400 diff --git a/releasenotes/notes/fix_search_vte0.46-b92145bc1e572521.yaml b/releasenotes/notes/fix_search_vte0.46-b92145bc1e572521.yaml new file mode 100644 index 000000000..33755a5fe --- /dev/null +++ b/releasenotes/notes/fix_search_vte0.46-b92145bc1e572521.yaml @@ -0,0 +1,3 @@ +fixes: + - | + Update search box to work with updated regex vte apis for v0.46+, #1752