[vte/wip/egmont/bidi: 86/107] ring extra line



commit 897672f5aa004723d55b037ea28c25c9eb8e1b4c
Author: Egmont Koblinger <egmont gmail com>
Date:   Thu Jan 24 23:22:58 2019 +0100

    ring extra line

 src/ring.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/ring.cc b/src/ring.cc
index cb51bc56..7cbbbee6 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -737,7 +737,10 @@ Ring::discard_one_row()
 void
 Ring::maybe_freeze_one_row()
 {
-        if (G_LIKELY(m_mask >= m_visible_rows &&
+        /* Keep at least m_visible_rows + 1 rows in the ring.
+         * The BiDi spec requires that the just scrolled out row
+         * is still alterable (can be switched to hard line ending). */
+        if (G_LIKELY(m_mask >= m_visible_rows + 1 &&
                      m_writable + m_mask + 1 == m_end))
                freeze_one_row();
        else
@@ -758,7 +761,8 @@ Ring::ensure_writable_room()
        row_t new_mask, old_mask, i, end;
        VteRowData* old_array, *new_array;;
 
-        if (G_LIKELY(m_mask >= m_visible_rows &&
+        /* See the comment about m_visible_rows + 1 above at maybe_freeze_one_row(). */
+        if (G_LIKELY(m_mask >= m_visible_rows + 1 &&
                      m_writable + m_mask + 1 > m_end))
                return;
 
@@ -767,7 +771,7 @@ Ring::ensure_writable_room()
 
        do {
                m_mask = (m_mask << 1) + 1;
-        } while (m_mask < m_visible_rows || m_writable + m_mask + 1 <= m_end);
+        } while (m_mask < m_visible_rows + 1 || m_writable + m_mask + 1 <= m_end);
 
        _vte_debug_print(VTE_DEBUG_RING, "Enlarging writable array from %lu to %lu\n", old_mask, m_mask);
 


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