From 1855deb46bda149aa1463e05761e3e7f583eed64 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Wed, 7 Oct 2015 22:15:05 +0200 Subject: regex: Add some more debug output Print out the no-match region. --- src/vte.cc | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/vte.cc b/src/vte.cc index 7a24ecca..2f526328 100644 --- a/src/vte.cc +++ b/src/vte.cc @@ -1755,13 +1755,13 @@ vte_terminal_match_check_internal_pcre(VteTerminal *terminal, eblank = rm_so; } - if (sblank > start_blank) { - start_blank = sblank; - } - if (eblank < end_blank) { - end_blank = eblank; - } - } + if (sblank > start_blank) { + start_blank = sblank; + } + if (eblank < end_blank) { + end_blank = eblank; + } + } if (G_UNLIKELY(r < PCRE2_ERROR_PARTIAL)) _vte_debug_print(VTE_DEBUG_REGEX, "Unexpected pcre2_match error code: %d\n", r); @@ -1774,6 +1774,19 @@ vte_terminal_match_check_internal_pcre(VteTerminal *terminal, *start = start_blank; *end = end_blank - 1; + _VTE_DEBUG_IF(VTE_DEBUG_REGEX) { + struct _VteCharAttributes *_sattr, *_eattr; + _sattr = &g_array_index(terminal->pvt->match_attributes, + struct _VteCharAttributes, + start_blank); + _eattr = &g_array_index(terminal->pvt->match_attributes, + struct _VteCharAttributes, + end_blank - 1); + g_printerr("No-match region from %" G_GSIZE_FORMAT "(%ld,%ld) to %" G_GSIZE_FORMAT "(%ld,%ld)\n", + start_blank, _sattr->column, _sattr->row, + end_blank - 1, _eattr->column, _eattr->row); + } + return NULL; } @@ -1909,6 +1922,19 @@ vte_terminal_match_check_internal_gregex(VteTerminal *terminal, *start = start_blank; *end = end_blank - 1; + _VTE_DEBUG_IF(VTE_DEBUG_REGEX) { + struct _VteCharAttributes *_sattr, *_eattr; + _sattr = &g_array_index(terminal->pvt->match_attributes, + struct _VteCharAttributes, + start_blank); + _eattr = &g_array_index(terminal->pvt->match_attributes, + struct _VteCharAttributes, + end_blank - 1); + g_printerr("No-match region from %" G_GSIZE_FORMAT "(%ld,%ld) to %" G_GSIZE_FORMAT "(%ld,%ld)\n", + start_blank, _sattr->column, _sattr->row, + end_blank - 1, _eattr->column, _eattr->row); + } + return NULL; } -- cgit v1.2.1