[vte] regex: Require MULTILINE compile option
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] regex: Require MULTILINE compile option
- Date: Sat, 26 Dec 2015 20:57:17 +0000 (UTC)
commit 7fdb3d136bde26a28d128eb1009eeccba69a4f4e
Author: Christian Persch <chpe gnome org>
Date: Sat Dec 26 21:56:28 2015 +0100
regex: Require MULTILINE compile option
Dingu match regexes should be compiled with MULTILINE option.
src/app.vala | 7 +++++--
src/vte.cc | 3 +--
src/vteapp.c | 2 +-
src/vtegtk.cc | 2 ++
4 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index bc2af66..b8c93c4 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -401,7 +401,7 @@ class Window : Gtk.ApplicationWindow
Vte.Regex regex;
regex = new Vte.Regex(dingus[i], dingus[i].length,
- 0x40080008u /* PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_CASELESS */);
+ 0x40080408u /* PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_CASELESS |
PCRE2_MULTILINE */);
try {
regex.jit(0x00000001u /* PCRE2_JIT_COMPLETE */);
regex.jit(0x00000002u /* PCRE2_JIT_PARTIAL_SOFT */);
@@ -416,7 +416,10 @@ class Window : Gtk.ApplicationWindow
{
GLib.Regex regex;
- regex = new GLib.Regex(dingus[i], GLib.RegexCompileFlags.OPTIMIZE, 0);
+ regex = new GLib.Regex(dingus[i],
+ GLib.RegexCompileFlags.OPTIMIZE |
+ GLib.RegexCompileFlags.MULTILINE,
+ 0);
tag = terminal.match_add_gregex(regex, 0);
}
diff --git a/src/vte.cc b/src/vte.cc
index 1d0e72e..570f122 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1408,8 +1408,7 @@ VteTerminalPrivate::match_check_pcre(
(PCRE2_SPTR8)line, line_length, /* subject, length */
position, /* start offset */
match_flags |
- PCRE2_NO_UTF_CHECK | PCRE2_NOTEMPTY | PCRE2_PARTIAL_SOFT /* FIXME: HARD? */ |
- PCRE2_MULTILINE,
+ PCRE2_NO_UTF_CHECK | PCRE2_NOTEMPTY | PCRE2_PARTIAL_SOFT /* FIXME: HARD? */,
match_data,
match_context)) >= 0 || r == PCRE2_ERROR_PARTIAL)) {
gsize ko = offset;
diff --git a/src/vteapp.c b/src/vteapp.c
index 43f87da..580cbe9 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -574,7 +574,7 @@ add_dingus (VteTerminal *terminal,
&error);
else
#endif
- gregex = g_regex_new(dingus[i], G_REGEX_OPTIMIZE, 0, &error);
+ gregex = g_regex_new(dingus[i], G_REGEX_OPTIMIZE | G_REGEX_MULTILINE, 0, &error);
if (error) {
g_warning("Failed to compile regex '%s': %s\n",
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index d7c4ec4..3e62eec 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1667,6 +1667,8 @@ vte_terminal_match_add_gregex(VteTerminal *terminal,
/* Can't mix GRegex and PCRE2 */
g_return_val_if_fail(terminal->pvt->m_match_regex_mode != VTE_REGEX_PCRE2, -1);
+ g_warn_if_fail(g_regex_get_compile_flags(gregex) & G_REGEX_MULTILINE);
+
new_regex_match.regex.mode = VTE_REGEX_GREGEX;
new_regex_match.regex.gregex.regex = g_regex_ref(gregex);
new_regex_match.regex.gregex.match_flags = gflags;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]