[vte] widget: Fix underlining the space character in a matched regex



commit 6a9580bab89c8d82d67cff538e1d0c483c6e142f
Author: Egmont Koblinger <egmont gmail com>
Date:   Wed May 13 11:46:48 2020 +0200

    widget: Fix underlining the space character in a matched regex
    
    https://gitlab.gnome.org/GNOME/vte/-/issues/248

 src/vte.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 034c3062..7ec837b6 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -8647,7 +8647,8 @@ Terminal::draw_rows(VteScreen *screen_,
         vte::grid::column_t i, j, lcol, vcol;
         int y;
         guint fore = VTE_DEFAULT_FG, nfore, back = VTE_DEFAULT_BG, nback, deco = VTE_DEFAULT_FG, ndeco;
-        gboolean hyperlink = FALSE, nhyperlink, hilite = FALSE, nhilite;
+        gboolean hyperlink = FALSE, nhyperlink;  /* non-hovered explicit hyperlink, needs dashed underlining 
*/
+        gboolean hilite = FALSE, nhilite;        /* hovered explicit hyperlink or regex match, needs 
continuous underlining */
         gboolean selected;
         gboolean nrtl = FALSE, rtl;  /* for debugging */
         uint32_t attr = 0, nattr;
@@ -8825,12 +8826,15 @@ Terminal::draw_rows(VteScreen *screen_,
                         g_assert(cell != nullptr);
 
                         nhyperlink = (m_allow_hyperlink && cell->attr.hyperlink_idx != 0);
+                        nhilite = (nhyperlink && cell->attr.hyperlink_idx == m_hyperlink_hover_idx) ||
+                                  (!nhyperlink && regex_match_has_current() && m_match_span.contains(row, 
lcol));
                         if (cell->c == 0 ||
                                 ((cell->c == ' ' || cell->c == '\t') &&  // FIXME '\t' is newly added now, 
double check
                                  cell->attr.has_none(VTE_ATTR_UNDERLINE_MASK |
                                                      VTE_ATTR_STRIKETHROUGH_MASK |
                                                      VTE_ATTR_OVERLINE_MASK) &&
-                                 !nhyperlink) ||
+                                 !nhyperlink &&
+                                 !nhilite) ||
                             cell->attr.fragment() ||
                             cell->attr.invisible()) {
                                 /* Skip empty or fragment cell. */
@@ -8843,9 +8847,6 @@ Terminal::draw_rows(VteScreen *screen_,
                         selected = cell_is_selected_log(lcol, row);
                         determine_colors(cell, selected, &nfore, &nback, &ndeco);
 
-                        nhilite = (nhyperlink && cell->attr.hyperlink_idx == m_hyperlink_hover_idx) ||
-                                  (!nhyperlink && regex_match_has_current() && m_match_span.contains(row, 
lcol));
-
                         /* See if it no longer fits the run. */
                         if (item_count > 0 &&
                                    (((attr ^ nattr) & (VTE_ATTR_BOLD_MASK |


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