[vte/wip/sixels] sixel: Don't add new character cells in image columns



commit 859093a89d7616b32b0b10b590a7e9f11a15bdd5
Author: Hans Petter Jansson <hpj hpjansson org>
Date:   Sat Nov 7 21:52:30 2020 +0100

    sixel: Don't add new character cells in image columns
    
    Fixes issue where blank cells on an image would be rewrapped when
    terminal was made narrower than the image, causing the latter's vertical
    position to change for no apparent reason.

 src/vteinternal.hh | 3 ++-
 src/vteseq.cc      | 9 +++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index ed57e9e1..55e471f7 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1307,7 +1307,8 @@ public:
         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,
-                                     bool use_basic = false);
+                                     bool use_basic = false,
+                                     bool add_new_cells = true);
         void erase_image_rect(vte::grid::row_t rows,
                               vte::grid::column_t columns);
         inline void insert_blank_character();
diff --git a/src/vteseq.cc b/src/vteseq.cc
index e2c17852..c45bfa9e 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -946,7 +946,8 @@ Terminal::move_cursor_down(vte::grid::row_t rows)
 
 void
 Terminal::erase_characters(long count,
-                           bool use_basic)
+                           bool use_basic,
+                           bool add_new_cells)
 {
        VteCell *cell;
        long col, i;
@@ -970,7 +971,7 @@ Terminal::erase_characters(long count,
                                         * defaults. */
                                        cell = _vte_row_data_get_writable (rowdata, col);
                                         *cell = use_basic ? basic_cell : m_color_defaults;
-                               } else {
+                               } else if (add_new_cells) {
                                        /* Add new cells until we have one here. */
                                         _vte_row_data_fill (rowdata, use_basic ? &basic_cell : 
&m_color_defaults, col + 1);
                                }
@@ -994,7 +995,7 @@ Terminal::erase_image_rect(vte::grid::row_t rows,
         for (auto i = 0; i < rows; ++i) {
                 auto const row = top + i;
 
-                erase_characters(columns, true);
+                erase_characters(columns, true, false);
 
                 if (row > m_screen->insert_delta - 1 &&
                     row < m_screen->insert_delta + m_row_count)
@@ -5544,7 +5545,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, false);
+        erase_characters(count, false, true);
 }
 
 void


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