[vte/wip/egmont/bidi: 45/75] redo draw_cells and draw_rows changes



commit 34904281892b69076c9dff5993690b80869eb391
Author: Egmont Koblinger <egmont gmail com>
Date:   Sat Aug 25 15:25:08 2018 +0200

    redo draw_cells and draw_rows changes

 src/vte.cc | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 54e1cb6e..fb09010c 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -8985,7 +8985,7 @@ Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items,
 
 /* XXX tmp hack */
 #define _vte_row_data_get_visual(row_data_p, bidimap, col) \
-        _vte_row_data_get(row_data_p, bidimap[col].vis2log)
+        row_data_p == nullptr ? nullptr : _vte_row_data_get(row_data_p, bidimap[col].vis2log)
 
 
 /* Paint the contents of a given row at the given location.  Take advantage
@@ -9013,9 +9013,20 @@ Terminal::draw_rows(VteScreen *screen_,
        guint item_count;
        const VteCell *cell;
        VteRowData const* row_data;
+        bidicellmap const* bidimap;
 
         uint32_t const attr_mask = m_allow_bold ? ~0 : ~VTE_ATTR_BOLD_MASK;
 
+
+
+        // FIXME find a nicer place for these
+        m_ringview.set_ring (m_screen->row_data);
+        m_ringview.set_rows ((long) m_screen->scroll_delta, m_row_count + 3);
+        m_ringview.set_width (m_column_count);
+        m_ringview.update ();
+
+
+
         /* Adjust for the absolute start of row. */
        start_x -= start_column * column_width;
 
@@ -9026,20 +9037,21 @@ Terminal::draw_rows(VteScreen *screen_,
        rows = end_row - start_row;
        do {
                row_data = find_row_data(row);
+                bidimap = m_ringview.get_row_map(row);
                /* Back up in case this is a multicolumn character,
                 * making the drawing area a little wider. */
                 i = j = start_column;
                 /* Walk the line. */
                 do {
                         /* Get the first cell's contents. */
-                        cell = row_data ? _vte_row_data_get (row_data, i) : nullptr;
+                        cell = row_data ? _vte_row_data_get_visual (row_data, bidimap, i) : nullptr;
                         /* Find the colors for this cell. */
                         selected = cell_is_selected(i, row);
                         determine_colors(cell, selected, &fore, &back, &deco);
 
                         while (++j < end_column) {
                                 /* Retrieve the next cell. */
-                                cell = row_data ? _vte_row_data_get (row_data, j) : nullptr;
+                                cell = row_data ? _vte_row_data_get_visual (row_data, bidimap, j) : nullptr;
                                 /* Resolve attributes to colors where possible and
                                  * compare visual attributes to the first character
                                  * in this chunk. */
@@ -9081,6 +9093,7 @@ Terminal::draw_rows(VteScreen *screen_,
                         cell = NULL;
                         while (row < end_row) {
                                 row_data = find_row_data(row);
+                                bidimap = m_ringview.get_row_map(row);
                                 if (row_data == NULL) {
                                         /* Skip row. */
                                         row++;
@@ -9090,14 +9103,14 @@ Terminal::draw_rows(VteScreen *screen_,
 
                                 /* Walk the line. */
                                 while (col < end_column) {  // FIXME gcc warning: missed loop optimization
-                                        cell = _vte_row_data_get (row_data, col);
+                                        cell = _vte_row_data_get_visual (row_data, bidimap, col);
                                         if (cell == NULL) {
-                                                /* There'll be no more real cells in this row, go to next 
row. */
-                                                break;
+                                                col++;
+                                                continue;
                                         }
 
                                         /* Get the character cell's contents. */
-                                        cell = _vte_row_data_get (row_data, col);
+                                        cell = _vte_row_data_get_visual (row_data, bidimap, col);
                                         nhyperlink = (m_allow_hyperlink && cell->attr.hyperlink_idx != 0);
                                         if (cell->c == 0 ||
                                                 ((cell->c == ' ' || cell->c == '\t') &&  // FIXME '\t' is 
newly added now, double check
@@ -9169,8 +9182,10 @@ Terminal::draw_rows(VteScreen *screen_,
 
                         items[item_count].c = cell->c;
                         items[item_count].columns = cell->attr.columns();
-                        items[item_count].x = start_x + col * column_width;
+                        items[item_count].x = start_x + (col - (bidimap[col].vis_rtl ? cell->attr.columns() 
- 1 : 0)) * column_width;
                         items[item_count].y = y;
+                        items[item_count].mirror = bidimap[col].vis_rtl;
+                        items[item_count].box_mirror = !!(row_data->attr.bidi_flags & VTE_BIDI_BOX_MIRROR);
                         col += items[item_count++].columns;
                 }
 


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