[vte/wip/egmont/bidi: 24/84] cleanup



commit 8250e744258216272a042ed3d48c3c883b7eca09
Author: Egmont Koblinger <egmont gmail com>
Date:   Mon Aug 20 00:16:11 2018 +0200

    cleanup

 src/vte.cc         | 30 +++++++++---------------------
 src/vteinternal.hh |  2 --
 2 files changed, 9 insertions(+), 23 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 2ebed391..082bf0b5 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -398,24 +398,11 @@ Terminal::find_row_data_writable(vte::grid::row_t row) const
 
 /* Find the character an the given position in the backscroll buffer. */
 // FIXMEchpe replace this with a method on VteRing
+// FIXME do we do overloading? and default parameter?
 VteCell const*
 Terminal::find_charcell(vte::grid::column_t col,
-                                  vte::grid::row_t row) const
-{
-       VteRowData const* rowdata;
-       VteCell const* ret = nullptr;
-
-       if (_vte_ring_contains(m_screen->row_data, row)) {
-               rowdata = _vte_ring_index(m_screen->row_data, row);
-               ret = _vte_row_data_get (rowdata, col);
-       }
-       return ret;
-}
-
-VteCell const*
-Terminal::find_charcell_bidi(vte::grid::column_t col,
                                   vte::grid::row_t row,
-                                  guint8 *bidi_flags) const
+                                  guint8 *bidi_flags = nullptr) const
 {
        VteRowData const* rowdata;
        VteCell const* ret = nullptr;
@@ -423,7 +410,8 @@ Terminal::find_charcell_bidi(vte::grid::column_t col,
        if (_vte_ring_contains(m_screen->row_data, row)) {
                rowdata = _vte_ring_index(m_screen->row_data, row);
                ret = _vte_row_data_get (rowdata, col);
-               *bidi_flags = rowdata->attr.bidi_flags;
+                if (bidi_flags != nullptr)
+                        *bidi_flags = rowdata->attr.bidi_flags;
        }
        return ret;
 }
@@ -8787,7 +8775,7 @@ Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items,
 
 
 /* XXX tmp hack */
-#define _vte_row_data_get_bidi(row_data_p, col) \
+#define _vte_row_data_get_visual(row_data_p, col) \
     (_vte_row_data_get ((row_data_p), (((row_data_p)->attr.bidi_flags & VTE_BIDI_RTL) ? (m_column_count - 1 
- (col)) : (col))))
 
 
@@ -8832,14 +8820,14 @@ Terminal::draw_rows(VteScreen *screen_,
                  * Locate runs of identical bg colors within a row, and paint each run as a single 
rectangle. */
                 do {
                         /* Get the first cell's contents. */
-                        cell = row_data ? _vte_row_data_get_bidi (row_data, i) : nullptr;
+                        cell = row_data ? _vte_row_data_get_visual (row_data, i) : nullptr;
                         /* Find the colors for this cell. */
                         selected = cell_is_selected(i, row);
                         determine_colors(cell, selected, &fore, &back, &deco);
 
                         while (++j < column_count) {
                                 /* Retrieve the next cell. */
-                                cell = row_data ? _vte_row_data_get_bidi (row_data, j) : nullptr;
+                                cell = row_data ? _vte_row_data_get_visual (row_data, j) : nullptr;
                                 /* Resolve attributes to colors where possible and
                                  * compare visual attributes to the first character
                                  * in this chunk. */
@@ -8879,7 +8867,7 @@ Terminal::draw_rows(VteScreen *screen_,
                 item_count = 0;
                 for (col = 0; col < column_count; col++) {
                         /* Get the character cell's contents. */
-                        cell = _vte_row_data_get_bidi (row_data, col);
+                        cell = _vte_row_data_get_visual (row_data, col);
                         if (cell == NULL) {
                                 /* We're rendering BiDi text in visual order, so an unused cell can be 
followed by a used one. */
                                 continue;
@@ -9064,7 +9052,7 @@ Terminal::paint_cursor()
         /* Find the first cell of the character "under" the cursor.
          * This is for CJK.  For TAB, paint the cursor where it really is. */
         guint8 bidi_flags = 0;
-       auto cell = find_charcell_bidi(col, drow, &bidi_flags);
+       auto cell = find_charcell(col, drow, &bidi_flags);
         while (cell != NULL && cell->attr.fragment() && cell->c != '\t' && col > 0) {
                col--;
                cell = find_charcell(col, drow);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index c0f8268f..739c7e33 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -650,8 +650,6 @@ public:
         inline VteRowData const* find_row_data(vte::grid::row_t row) const;
         inline VteRowData* find_row_data_writable(vte::grid::row_t row) const;
         inline VteCell const* find_charcell(vte::grid::column_t col,
-                                            vte::grid::row_t row) const;
-        inline VteCell const* find_charcell_bidi(vte::grid::column_t col,
                                             vte::grid::row_t row,
                                             guint8 *bidi_flags) const;
         inline vte::grid::column_t find_start_column(vte::grid::column_t col,


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