[vte/wip/egmont/bidi] --- fix combining accents (e.g. on Hebrew) --- --- to be squashed into some preceding commit ---



commit 280c1bb9f3761b7b54fc5c3fbd88be7ace9d3569
Author: Egmont Koblinger <egmont gmail com>
Date:   Sat Jun 8 00:29:13 2019 +0200

    --- fix combining accents (e.g. on Hebrew) ---
    --- to be squashed into some preceding commit ---

 src/bidi.cc | 24 ++++++++++++------------
 src/bidi.hh |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/src/bidi.cc b/src/bidi.cc
index a881fd89..1fbdfed5 100644
--- a/src/bidi.cc
+++ b/src/bidi.cc
@@ -68,7 +68,7 @@ BidiRow::BidiRow()
         m_log2vis = nullptr;
         m_vis2log = nullptr;
         m_vis_rtl = nullptr;
-        m_vis_shaped_char = nullptr;
+        m_vis_shaped_base_char = nullptr;
 }
 
 BidiRow::~BidiRow()
@@ -76,7 +76,7 @@ BidiRow::~BidiRow()
         g_free (m_log2vis);
         g_free (m_vis2log);
         g_free (m_vis_rtl);
-        g_free (m_vis_shaped_char);
+        g_free (m_vis_shaped_base_char);
 }
 
 void
@@ -93,7 +93,7 @@ BidiRow::set_width(vte::grid::column_t width)
                 m_log2vis = (guint16 *) g_realloc (m_log2vis, sizeof (guint16) * m_width_alloc);
                 m_vis2log = (guint16 *) g_realloc (m_vis2log, sizeof (guint16) * m_width_alloc);
                 m_vis_rtl = (guint8 *) g_realloc (m_vis_rtl, sizeof (guint8) * m_width_alloc);
-                m_vis_shaped_char = (gunichar *) g_realloc (m_vis_shaped_char, sizeof (gunichar) * 
m_width_alloc);
+                m_vis_shaped_base_char = (gunichar *) g_realloc (m_vis_shaped_base_char, sizeof (gunichar) * 
m_width_alloc);
         }
 
         m_width = width;
@@ -161,10 +161,10 @@ BidiRow::log_is_rtl(vte::grid::column_t col) const
 vteunistr
 BidiRow::vis_get_shaped_char(vte::grid::column_t col, vteunistr s) const
 {
-        if (col >= m_width || m_vis_shaped_char[col] == 0)
+        if (col >= m_width || m_vis_shaped_base_char[col] == 0)
                 return s;
 
-        return m_vis_shaped_char[col];
+        return _vte_unistr_replace_base(s, m_vis_shaped_base_char[col]);
 }
 
 /* Whether the line's base direction is RTL. */
@@ -299,7 +299,7 @@ BidiRunner::explicit_line_shape(vte::grid::row_t row)
                         for (int k = 0; k < width; k++) {
                                 bidirow->m_log2vis[k] = bidirow->m_vis2log[k] = k;
                                 bidirow->m_vis_rtl[k] = false;
-                                bidirow->m_vis_shaped_char[k] = 0;
+                                bidirow->m_vis_shaped_base_char[k] = 0;
                         }
                 }
 
@@ -312,7 +312,7 @@ BidiRunner::explicit_line_shape(vte::grid::row_t row)
                         base = _vte_unistr_get_base(c);
                         if (*fribidi_chars != base) {
                                 /* Shaping changed the codepoint. Apply combining accents and store. */
-                                bidirow->m_vis_shaped_char[j] = _vte_unistr_replace_base(c, *fribidi_chars);
+                                bidirow->m_vis_shaped_base_char[j] = *fribidi_chars;
                         }
                         int len = _vte_unistr_strlen(c);
                         fribidi_chars += len;
@@ -357,7 +357,7 @@ BidiRunner::explicit_line(vte::grid::row_t row, bool rtl, bool do_shaping)
                 for (i = 0; i < width; i++) {
                         bidirow->m_log2vis[i] = bidirow->m_vis2log[i] = width - 1 - i;
                         bidirow->m_vis_rtl[i] = true;
-                        bidirow->m_vis_shaped_char[i] = 0;
+                        bidirow->m_vis_shaped_base_char[i] = 0;
                 }
         }
 
@@ -682,7 +682,7 @@ BidiRunner::implicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, boo
                         for (; tv < unused; tv++) {
                                 bidirow->m_vis2log[tv] = width - 1 - tv;
                                 bidirow->m_vis_rtl[tv] = true;
-                                bidirow->m_vis_shaped_char[tv] = 0;
+                                bidirow->m_vis_shaped_base_char[tv] = 0;
                         }
                 }
                 for (fv = lines[line]; fv < lines[line + 1]; fv++) {
@@ -699,7 +699,7 @@ BidiRunner::implicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, boo
                                 for (col = 0; col < cell->attr.columns(); col++) {
                                         bidirow->m_vis2log[tv + col] = tl + cell->attr.columns() - 1 - col;
                                         bidirow->m_vis_rtl[tv + col] = true;
-                                        bidirow->m_vis_shaped_char[tv + col] = fribidi_chars[fl];
+                                        bidirow->m_vis_shaped_base_char[tv + col] = fribidi_chars[fl];
                                 }
                                 tv += cell->attr.columns();
                                 tl += cell->attr.columns();
@@ -708,7 +708,7 @@ BidiRunner::implicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, boo
                                 for (col = 0; col < cell->attr.columns(); col++) {
                                         bidirow->m_vis2log[tv] = tl;
                                         bidirow->m_vis_rtl[tv] = false;
-                                        bidirow->m_vis_shaped_char[tv] = fribidi_chars[fl];
+                                        bidirow->m_vis_shaped_base_char[tv] = fribidi_chars[fl];
                                         tv++;
                                         tl++;
                                 }
@@ -720,7 +720,7 @@ BidiRunner::implicit_paragraph(vte::grid::row_t start, vte::grid::row_t end, boo
                         for (; tv < width; tv++) {
                                 bidirow->m_vis2log[tv] = tv;
                                 bidirow->m_vis_rtl[tv] = false;
-                                bidirow->m_vis_shaped_char[tv] = 0;
+                                bidirow->m_vis_shaped_base_char[tv] = 0;
                         }
                 }
                 g_assert_cmpint (tv, ==, width);
diff --git a/src/bidi.hh b/src/bidi.hh
index 44f43059..d7ef7815 100644
--- a/src/bidi.hh
+++ b/src/bidi.hh
@@ -65,7 +65,7 @@ private:
         guint16 *m_log2vis;
         guint16 *m_vis2log;
         guint8 *m_vis_rtl;
-        gunichar *m_vis_shaped_char;
+        gunichar *m_vis_shaped_base_char;
 
         guint8 m_base_rtl: 1;
         guint8 m_has_foreign: 1;


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