[vte] regex: Always add MULTILINE flag when translating from GRegex



commit 4c0d8533051fb80999e886884f7fb2729c1a0c58
Author: Christian Persch <chpe src gnome org>
Date:   Sun Sep 4 14:36:19 2016 +0200

    regex: Always add MULTILINE flag when translating from GRegex
    
    Instead of warning if the MULTILINE flag is not set in the GRegex,
    just add it, since we're translating the regex to PCRE2 anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770718

 src/vtegtk.cc   |    1 -
 src/vteregex.cc |    3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index b9de9f2..87e2a73 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1696,7 +1696,6 @@ vte_terminal_match_add_gregex(VteTerminal *terminal,
                               GRegexMatchFlags gflags)
 {
         g_return_val_if_fail(gregex != NULL, -1);
-        g_warn_if_fail(g_regex_get_compile_flags(gregex) & G_REGEX_MULTILINE);
 
         auto regex = _vte_regex_new_gregex(VteRegexPurpose::match, gregex);
         if (regex == NULL)
diff --git a/src/vteregex.cc b/src/vteregex.cc
index 039f289..129576a 100644
--- a/src/vteregex.cc
+++ b/src/vteregex.cc
@@ -213,7 +213,8 @@ _vte_regex_new_gregex(VteRegexPurpose purpose,
                 { G_REGEX_DUPNAMES,        PCRE2_DUPNAMES        }
         };
 
-        guint32 gflags = g_regex_get_compile_flags(gregex);
+        /* Always add the MULTILINE option */
+        guint32 gflags = g_regex_get_compile_flags(gregex) | G_REGEX_MULTILINE;
         translate_flags(table, G_N_ELEMENTS(table), &gflags, &pflags);
 
         if (gflags != 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]