[vte/wip/sixels: 51/82] terminal: Erase image backing characters to basic cell



commit 338137a853f00c20b8a70e57979c3b0f104ce770
Author: Hans Petter Jansson <hpj cl no>
Date:   Sat Jun 13 18:27:40 2020 +0200

    terminal: Erase image backing characters to basic cell
    
    We can't use the current defaults for image backing, since background
    colors would be painted on top of images.

 src/vteinternal.hh |  2 +-
 src/vteseq.cc      | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 36088602..e865e870 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1573,7 +1573,7 @@ public:
         inline vte::grid::column_t get_cursor_column_unclamped() const;
         inline void move_cursor_up(vte::grid::row_t rows);
         inline void move_cursor_down(vte::grid::row_t rows);
-        inline void erase_characters(long count);
+        inline void erase_characters(long count, bool use_basic);
         inline void insert_blank_character();
 
         template<unsigned int redbits, unsigned int greenbits, unsigned int bluebits>
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 390f1035..010e0646 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -960,13 +960,16 @@ Terminal::move_cursor_down(vte::grid::row_t rows)
 }
 
 void
-Terminal::erase_characters(long count)
+Terminal::erase_characters(long count, bool use_basic)
 {
        VteCell *cell;
+        VteCell blank_cell;
        long col, i;
 
         ensure_cursor_is_onscreen();
 
+        blank_cell = use_basic ? basic_cell : m_color_defaults;
+
        /* Clear out the given number of characters. */
        auto rowdata = ensure_row();
         if (_vte_ring_next(m_screen->row_data) > m_screen->cursor.row) {
@@ -983,10 +986,10 @@ Terminal::erase_characters(long count)
                                        /* Replace this cell with the current
                                         * defaults. */
                                        cell = _vte_row_data_get_writable (rowdata, col);
-                                        *cell = m_color_defaults;
+                                        *cell = blank_cell;
                                } else {
                                        /* Add new cells until we have one here. */
-                                        _vte_row_data_fill (rowdata, &m_color_defaults, col + 1);
+                                        _vte_row_data_fill (rowdata, &blank_cell, col + 1);
                                }
                        }
                }
@@ -3141,7 +3144,7 @@ Terminal::seq_load_sixel(char const* dcs)
 
        /* Erase characters on the image */
        for (i = 0; i < height; ++i) {
-               erase_characters(width);
+               erase_characters(width, true);
                if (i == height - 1) {
                        if (m_sixel_scrolls_right)
                                move_cursor_forward(width);
@@ -5490,7 +5493,7 @@ Terminal::ECH(vte::parser::Sequence const& seq)
 
         // FIXMEchpe limit to column_count - cursor.x ?
         auto const count = seq.collect1(0, 1, 1, int(65535));
-        erase_characters(count);
+        erase_characters(count, false);
 }
 
 void


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