[Xfce4-commits] [apps/xfce4-terminal] 01/01: Prepare for upcoming vte regex API change

noreply at xfce.org noreply at xfce.org
Sat Aug 20 18:13:20 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit e0f55caf275b88115ad7d49c874c879d0dde3a52
Author: Igor <f2404 at yandex.ru>
Date:   Sat Aug 20 19:13:15 2016 +0300

    Prepare for upcoming vte regex API change
---
 terminal/terminal-widget.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/terminal/terminal-widget.c b/terminal/terminal-widget.c
index 6a844d6..bc4d9d0 100644
--- a/terminal/terminal-widget.c
+++ b/terminal/terminal-widget.c
@@ -37,6 +37,11 @@
 #include <terminal/terminal-widget.h>
 #include <terminal/terminal-private.h>
 
+#if VTE_CHECK_VERSION (0, 46, 00)
+#define PCRE2_CODE_UNIT_WIDTH 0
+#include <pcre2.h>
+#endif
+
 
 
 #define MAILTO          "mailto:"
@@ -723,7 +728,11 @@ terminal_widget_update_highlight_urls (TerminalWidget *widget)
 {
   guint                       i;
   gboolean                    highlight_urls;
+#if VTE_CHECK_VERSION (0, 46, 00)
+  VteRegex                   *regex;
+#else
   GRegex                     *regex;
+#endif
   const TerminalRegexPattern *pattern;
   GError                     *error;
 
@@ -755,9 +764,15 @@ terminal_widget_update_highlight_urls (TerminalWidget *widget)
 
           /* build the regex */
           error = NULL;
+#if VTE_CHECK_VERSION (0, 46, 00)
+          regex = vte_regex_new_for_match (pattern->pattern, -1,
+                                           PCRE2_CASELESS | PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_MULTILINE,
+                                           &error);
+#else
           regex = g_regex_new (pattern->pattern,
                                G_REGEX_CASELESS | G_REGEX_OPTIMIZE | G_REGEX_MULTILINE,
                                0, &error);
+#endif
           if (G_UNLIKELY (error != NULL))
             {
               g_critical ("Failed to parse regular expression pattern %d: %s",
@@ -767,12 +782,21 @@ terminal_widget_update_highlight_urls (TerminalWidget *widget)
             }
 
           /* set the new regular expression */
+#if VTE_CHECK_VERSION (0, 46, 00)
+          widget->regex_tags[i] = vte_terminal_match_add_regex (VTE_TERMINAL (widget),
+                                                                regex, 0);
+#else
           widget->regex_tags[i] = vte_terminal_match_add_gregex (VTE_TERMINAL (widget),
                                                                  regex, 0);
+#endif
           vte_terminal_match_set_cursor_type (VTE_TERMINAL (widget),
                                               widget->regex_tags[i], GDK_HAND2);
           /* release the regex owned by vte now */
+#if VTE_CHECK_VERSION (0, 46, 00)
+          vte_regex_unref (regex);
+#else
           g_regex_unref (regex);
+#endif
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list