[vte] widget: Add match flags for search regex



commit 11d8fbf811819d124e6c678a70f82f0c151946bf
Author: Christian Persch <chpe gnome org>
Date:   Tue Jun 14 22:40:54 2011 +0200

    widget: Add match flags for search regex
    
    For API consistency.

 src/vte-private.h |    1 +
 src/vte.c         |    9 +++++++--
 src/vte.h         |    3 ++-
 3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/vte-private.h b/src/vte-private.h
index 3c7cd17..df64681 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -349,6 +349,7 @@ struct _VteTerminalPrivate {
 
        /* Search data. */
        GRegex *search_regex;
+        GRegexMatchFlags search_match_flags;
        gboolean search_wrap_around;
        GArray *search_attrs; /* Cache attrs */
 
diff --git a/src/vte.c b/src/vte.c
index edc3cc4..48357c0 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -13749,6 +13749,7 @@ vte_terminal_write_contents (VteTerminal *terminal,
  * vte_terminal_search_set_gregex:
  * @terminal: a #VteTerminal
  * @regex: (allow-none): a #GRegex, or %NULL
+ * @flags: flags from #GRegexMatchFlags
  *
  * Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL.
  *
@@ -13756,7 +13757,8 @@ vte_terminal_write_contents (VteTerminal *terminal,
  */
 void
 vte_terminal_search_set_gregex (VteTerminal *terminal,
-                               GRegex      *regex)
+                               GRegex      *regex,
+                                GRegexMatchFlags flags)
 {
         g_return_if_fail(VTE_IS_TERMINAL(terminal));
 
@@ -13770,6 +13772,7 @@ vte_terminal_search_set_gregex (VteTerminal *terminal,
 
        if (regex)
                terminal->pvt->search_regex = g_regex_ref (regex);
+        terminal->pvt->search_match_flags = flags;
 
        _vte_invalidate_all (terminal);
 }
@@ -13846,7 +13849,9 @@ vte_terminal_search_rows (VteTerminal *terminal,
 
        row_text = vte_terminal_get_text_range (terminal, start_row, 0, end_row, -1, NULL, NULL, NULL);
 
-       g_regex_match_full (pvt->search_regex, row_text, -1, 0, G_REGEX_MATCH_NOTEMPTY, &match_info, &error);
+       g_regex_match_full (pvt->search_regex, row_text, -1, 0,
+                            pvt->search_match_flags | G_REGEX_MATCH_NOTEMPTY,
+                            &match_info, &error);
        if (error) {
                g_printerr ("Error while matching: %s\n", error->message);
                g_error_free (error);
diff --git a/src/vte.h b/src/vte.h
index 4a417fa..01c3b80 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -342,7 +342,8 @@ char *vte_terminal_match_check(VteTerminal *terminal,
                               int *tag);
 
 void      vte_terminal_search_set_gregex      (VteTerminal *terminal,
-                                              GRegex      *regex);
+                                              GRegex      *regex,
+                                               GRegexMatchFlags flags);
 GRegex   *vte_terminal_search_get_gregex      (VteTerminal *terminal);
 void      vte_terminal_search_set_wrap_around (VteTerminal *terminal,
                                               gboolean     wrap_around);


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