[vte] widget: Merge identical m_color_defaults and m_fill_defaults



commit d0f65fb1f982ba0b58d75184ee1e8d03bb9e3d2e
Author: Egmont Koblinger <egmont gmail com>
Date:   Sat Jun 29 23:39:17 2019 +0200

    widget: Merge identical m_color_defaults and m_fill_defaults
    
    https://gitlab.gnome.org/GNOME/vte/issues/136

 src/vte.cc         | 16 +++++++---------
 src/vteinternal.hh | 18 +++++++-----------
 src/vteseq.cc      | 17 ++++++++---------
 3 files changed, 22 insertions(+), 29 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index ee1c673f..7c2ef159 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -136,16 +136,16 @@ Terminal::ring_insert(vte::grid::row_t position,
 {
        VteRowData *row;
        VteRing *ring = m_screen->row_data;
-        bool const not_default_bg = (m_fill_defaults.attr.back() != VTE_DEFAULT_BG);
+        bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
 
        while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
                row = _vte_ring_append (ring);
                 if (not_default_bg)
-                        _vte_row_data_fill (row, &m_fill_defaults, m_column_count);
+                        _vte_row_data_fill (row, &m_color_defaults, m_column_count);
        }
        row = _vte_ring_insert (ring, position);
         if (fill && not_default_bg)
-                _vte_row_data_fill (row, &m_fill_defaults, m_column_count);
+                _vte_row_data_fill (row, &m_color_defaults, m_column_count);
        return row;
 }
 
@@ -168,7 +168,7 @@ void
 Terminal::reset_default_attributes(bool reset_hyperlink)
 {
         auto const hyperlink_idx_save = m_defaults.attr.hyperlink_idx;
-        m_defaults = m_color_defaults = m_fill_defaults = basic_cell;
+        m_defaults = m_color_defaults = basic_cell;
         if (!reset_hyperlink)
                 m_defaults.attr.hyperlink_idx = hyperlink_idx_save;
 }
@@ -2714,11 +2714,11 @@ Terminal::cursor_down(bool explicit_sequence)
                  * only fill the new row with the background color if scrolling
                  * happens due to an explicit escape sequence, not due to autowrapping.
                  * See bug 754596 for details. */
-                bool const not_default_bg = (m_fill_defaults.attr.back() != VTE_DEFAULT_BG);
+                bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
 
                 if (explicit_sequence && not_default_bg) {
                        VteRowData *rowdata = ensure_row();
-                        _vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
+                        _vte_row_data_fill (rowdata, &m_color_defaults, m_column_count);
                }
        } else {
                /* Otherwise, just move the cursor down. */
@@ -2755,7 +2755,6 @@ Terminal::restore_cursor(VteScreen *screen__)
 
         m_defaults = screen__->saved.defaults;
         m_color_defaults = screen__->saved.color_defaults;
-        m_fill_defaults = screen__->saved.fill_defaults;
         m_character_replacements[0] = screen__->saved.character_replacements[0];
         m_character_replacements[1] = screen__->saved.character_replacements[1];
         m_character_replacement = screen__->saved.character_replacement;
@@ -2775,7 +2774,6 @@ Terminal::save_cursor(VteScreen *screen__)
 
         screen__->saved.defaults = m_defaults;
         screen__->saved.color_defaults = m_color_defaults;
-        screen__->saved.fill_defaults = m_fill_defaults;
         screen__->saved.character_replacements[0] = m_character_replacements[0];
         screen__->saved.character_replacements[1] = m_character_replacements[1];
         screen__->saved.character_replacement = m_character_replacement;
@@ -8719,7 +8717,7 @@ Terminal::translate_pango_cells(PangoAttrList *attrs,
        guint i;
 
        for (i = 0; i < n_cells; i++) {
-                cells[i] = m_fill_defaults;
+                cells[i] = m_color_defaults;
        }
 
        attriter = pango_attr_list_get_iterator(attrs);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index f321105e..9eaed1e6 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -163,7 +163,6 @@ public:
                 bool origin_mode;
                 VteCell defaults;
                 VteCell color_defaults;
-                VteCell fill_defaults;
                 VteCharacterReplacement character_replacements[2];
                 VteCharacterReplacement *character_replacement;
         } saved;
@@ -369,16 +368,13 @@ public:
         VteScreen m_alternate_screen;
         VteScreen *m_screen; /* points to either m_normal_screen or m_alternate_screen */
 
-        VteCell m_defaults;       /* default characteristics
-                                     for insertion of any new
-                                     characters */
-        VteCell m_color_defaults; /* original defaults
-                                     plus the current
-                                     fore/back */
-        VteCell m_fill_defaults;  /* original defaults
-                                     plus the current
-                                     fore/back with no
-                                     character data */
+        VteCell m_defaults;        /* Default characteristics for insertion of new characters:
+                                      colors (fore, back, deco) and other attributes (bold, italic,
+                                      explicit hyperlink etc.). */
+        VteCell m_color_defaults;  /* Default characteristics for erasing characters:
+                                      colors (fore, back, deco) but no other attributes,
+                                      and the U+0000 character that denotes erased cells. */
+
         VteCharacterReplacement m_character_replacements[2];  /* charsets in the G0 and G1 slots */
         VteCharacterReplacement *m_character_replacement;     /* pointer to the active one */
 
diff --git a/src/vteseq.cc b/src/vteseq.cc
index f01da516..15358aca 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -313,7 +313,7 @@ Terminal::clear_current_line()
                /* Remove it. */
                _vte_row_data_shrink (rowdata, 0);
                /* Add enough cells to the end of the line to fill out the row. */
-                _vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
+                _vte_row_data_fill (rowdata, &m_color_defaults, m_column_count);
                rowdata->attr.soft_wrapped = 0;
                /* Repaint this row. */
                 invalidate_row(m_screen->cursor.row);
@@ -337,7 +337,7 @@ Terminal::clear_above_current()
                        /* Remove it. */
                        _vte_row_data_shrink (rowdata, 0);
                        /* Add new cells until we fill the row. */
-                        _vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
+                        _vte_row_data_fill (rowdata, &m_color_defaults, m_column_count);
                        rowdata->attr.soft_wrapped = 0;
                        /* Repaint the row. */
                         invalidate_row(i);
@@ -715,7 +715,7 @@ Terminal::clear_below_current()
                        _vte_row_data_shrink (rowdata, 0);
        }
        /* Now fill the cleared areas. */
-        bool const not_default_bg = (m_fill_defaults.attr.back() != VTE_DEFAULT_BG);
+        bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
 
         for (i = m_screen->cursor.row;
             i < m_screen->insert_delta + m_row_count;
@@ -729,7 +729,7 @@ Terminal::clear_below_current()
                }
                /* Pad out the row. */
                 if (not_default_bg) {
-                        _vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
+                        _vte_row_data_fill(rowdata, &m_color_defaults, m_column_count);
                }
                rowdata->attr.soft_wrapped = 0;
                /* Repaint this row. */
@@ -764,11 +764,11 @@ Terminal::clear_to_eol()
                /* We've modified the display.  Make a note of it. */
                m_text_deleted_flag = TRUE;
        }
-        bool const not_default_bg = (m_fill_defaults.attr.back() != VTE_DEFAULT_BG);
+        bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
 
         if (not_default_bg) {
                /* Add enough cells to fill out the row. */
-                _vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
+                _vte_row_data_fill(rowdata, &m_color_defaults, m_column_count);
        }
        rowdata->attr.soft_wrapped = 0;
        /* Repaint this row. */
@@ -896,10 +896,10 @@ Terminal::delete_character()
                         /* Clean up Tab/CJK fragments. */
                         cleanup_fragments(col, col + 1);
                        _vte_row_data_remove (rowdata, col);
-                        bool const not_default_bg = (m_fill_defaults.attr.back() != VTE_DEFAULT_BG);
+                        bool const not_default_bg = (m_color_defaults.attr.back() != VTE_DEFAULT_BG);
 
                         if (not_default_bg) {
-                                _vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
+                                _vte_row_data_fill(rowdata, &m_color_defaults, m_column_count);
                                 len = m_column_count;
                        }
                         rowdata->attr.soft_wrapped = 0;
@@ -7162,7 +7162,6 @@ Terminal::SGR(vte::parser::Sequence const& seq)
 
        /* Save the new colors. */
         m_color_defaults.attr.copy_colors(m_defaults.attr);
-        m_fill_defaults.attr.copy_colors(m_defaults.attr);
 }
 
 void


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