[vte/wip/egmont/bidi: 14/23] etap10



commit 16677982d5418436dd3c767832ea9ad90ce0edf0
Author: Egmont Koblinger <egmont gmail com>
Date:   Fri May 24 17:35:44 2019 +0200

    etap10

 src/bidi.cc        |  3 +++
 src/ringview.cc    | 38 +++++++++++++-------------------------
 src/ringview.hh    | 22 ++++++++++++++++++++--
 src/vte.cc         | 32 ++++++++++++++++----------------
 src/vtegtk.cc      | 12 ++++++------
 src/vteinternal.hh |  2 +-
 6 files changed, 59 insertions(+), 50 deletions(-)
---
diff --git a/src/bidi.cc b/src/bidi.cc
index 71764833..34f4d0c5 100644
--- a/src/bidi.cc
+++ b/src/bidi.cc
@@ -361,6 +361,9 @@ void BidiRunner::paragraph(vte::grid::row_t start, vte::grid::row_t end)
         const VteRowData *row_data = m_ringview->get_row(start);
 
 #ifdef WITH_FRIBIDI
+        /* Have a consistent limit on the number of rows in a paragraph
+         * that can get implicit BiDi treatment, which is independent from
+         * the current scroll position. */
         if ((row_data->attr.bidi_flags & VTE_BIDI_IMPLICIT) &&
             end - start <= VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX) {
                 if (implicit_paragraph(start, end))
diff --git a/src/ringview.cc b/src/ringview.cc
index 6065ad27..5138f7f3 100644
--- a/src/ringview.cc
+++ b/src/ringview.cc
@@ -16,26 +16,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-/*
- * RingView provides a "view" to a continuous segment of the Ring (or stream),
- * typically the user visible area.
- *
- * It computes additional data that are needed to display the contents (or handle
- * user events such as mouse click), but not needed for the terminal emulation logic.
- * In order to save tons of resources, these data are computed when the Ring's
- * contents are about to be displayed, rather than whenever they change.
- *
- * For computing these data, context lines (outside of the specified region of the
- * Ring) are also taken into account up to the next hard newline or a safety limit.
- *
- * Currently RingView is used for BiDi: to figure out which logical character is
- * mapped to which visual position.
- *
- * Future possible uses include "highlight all" for the search match, and
- * syntax highlighting. URL autodetection might also be ported to this
- * infrastructure one day.
- */
-
 #include <config.h>
 
 #include "bidi.hh"
@@ -168,7 +148,7 @@ VteRowData *RingView::get_row(vte::grid::row_t row) {
         return m_rows[row - m_top];
 }
 
-void RingView::maybe_update()
+void RingView::update()
 {
         if (!m_invalid)
                 return;
@@ -176,9 +156,11 @@ void RingView::maybe_update()
                 unpause();
 
         /* Find the beginning of the topmost paragraph.
-         * Extract at most VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX rows.
-         * Together with the row of m_start, this paragraph fragment is already
-         * longer than VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX lines, and thus the
+         *
+         * Extract at most VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX context rows.
+         * If this safety limit is reached then together with the first
+         * non-context row this paragraph fragment is already longer
+         * than VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX lines, and thus the
          * BiDi code will skip it. */
         vte::grid::row_t row = m_start;
         const VteRowData *row_data;
@@ -197,7 +179,13 @@ void RingView::maybe_update()
         }
 
         /* Extract the data beginning at the found row.
-         * Proceed by at most VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX rows beyond the end of the specified area. */
+         *
+         * Extract at most VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX rows
+         * beyond the end of the specified area. Again, if this safety
+         * limit is reached then together with the last non-context row
+         * this paragraph fragment is already longer than
+         * VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX lines, and thus the
+         * BiDi code will skip it. */
         m_top = row;
         m_rows_len = 0;
         while (row < m_start + m_len + VTE_RINGVIEW_PARAGRAPH_LENGTH_MAX) {
diff --git a/src/ringview.hh b/src/ringview.hh
index 1489d1a3..3a68fdb9 100644
--- a/src/ringview.hh
+++ b/src/ringview.hh
@@ -33,7 +33,25 @@ namespace base {  // FIXME ???
 class BidiRow;
 class BidiRunner;
 
-/* RingView contains the BiDi transformations for all the rows of the viewport. */
+/*
+ * RingView provides a "view" to a continuous segment of the Ring (or stream),
+ * typically the user visible area.
+ *
+ * It computes additional data that are needed to display the contents (or handle
+ * user events such as mouse click), but not needed for the terminal emulation logic.
+ * In order to save tons of resources, these data are computed when the Ring's
+ * contents are about to be displayed, rather than whenever they change.
+ *
+ * For computing these data, context lines (outside of the specified region of the
+ * Ring) are also taken into account up to the next hard newline or a safety limit.
+ *
+ * Currently RingView is used for BiDi: to figure out which logical character is
+ * mapped to which visual position.
+ *
+ * Future possible uses include "highlight all" for the search match, and
+ * syntax highlighting. URL autodetection might also be ported to this
+ * infrastructure one day.
+ */
 class RingView {
 public:
         RingView();
@@ -53,7 +71,7 @@ public:
         vte::grid::column_t get_width() { return m_width; }
 
         inline void invalidate() { m_invalid = true; }
-        void maybe_update();
+        void update();
         void pause();
 
         VteRowData *get_row(vte::grid::row_t row);
diff --git a/src/vte.cc b/src/vte.cc
index fba76d4b..0eb39f12 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1681,7 +1681,7 @@ Terminal::selection_maybe_swap_endpoints(vte::view::coords const& pos)
         if (m_selection_resolved.empty())
                 return;
 
-        ringview_maybe_update();
+        ringview_update();
 
         auto current = selection_grid_halfcoords_from_view_coords (pos);
 
@@ -3879,7 +3879,7 @@ Terminal::process_incoming()
         /* BiDi properties might have changed, even when !modified.
          * emit_pending_signals() requires the ringview to be updated. */
         m_ringview.invalidate();
-        ringview_maybe_update();
+        ringview_update();
 
        emit_pending_signals();
 
@@ -5009,7 +5009,7 @@ Terminal::widget_key_press(GdkEventKey *event)
                                 ringview->set_ring(m_screen->row_data);
                                 ringview->set_rows(m_screen->cursor.row, 1);
                                 ringview->set_width(m_column_count);
-                                ringview->maybe_update();
+                                ringview->update();
                                 if (ringview->get_row_map(m_screen->cursor.row)->base_is_rtl()) {
                                         switch (keyval) {
                                         case GDK_KEY_Left:
@@ -5555,7 +5555,7 @@ Terminal::modify_selection (vte::view::coords const& pos)
 {
         g_assert (m_selecting);
 
-        ringview_maybe_update();
+        ringview_update();
 
         auto current = selection_grid_halfcoords_from_view_coords (pos);
 
@@ -6284,7 +6284,7 @@ Terminal::get_text(vte::grid::row_t start_row,
                 ringview->set_ring(m_screen->row_data);
                 ringview->set_rows(start_row, end_row - start_row + 1);
                 ringview->set_width(m_column_count);
-                ringview->maybe_update();
+                ringview->update();
         }
 
         vte::grid::column_t col = block ? 0 : start_col;
@@ -6991,7 +6991,7 @@ Terminal::widget_motion_notify(GdkEventMotion *event)
 {
        bool handled = false;
 
-        ringview_maybe_update();
+        ringview_update();
 
         GdkEvent* base_event = reinterpret_cast<GdkEvent*>(event);
         auto pos = view_coords_from_event(base_event);
@@ -7001,7 +7001,7 @@ Terminal::widget_motion_notify(GdkEventMotion *event)
                          "Motion notify %s %s\n",
                          pos.to_string(), rowcol.to_string());
 
-        ringview_maybe_update();
+        ringview_update();
 
        read_modifiers(base_event);
 
@@ -7060,7 +7060,7 @@ Terminal::widget_button_press(GdkEventButton *event)
        bool handled = false;
        gboolean start_selecting = FALSE, extend_selecting = FALSE;
 
-        ringview_maybe_update();
+        ringview_update();
 
         GdkEvent* base_event = reinterpret_cast<GdkEvent*>(event);
         auto pos = view_coords_from_event(base_event);
@@ -7211,7 +7211,7 @@ Terminal::widget_button_release(GdkEventButton *event)
 {
        bool handled = false;
 
-        ringview_maybe_update();
+        ringview_update();
 
         GdkEvent* base_event = reinterpret_cast<GdkEvent*>(event);
         auto pos = view_coords_from_event(base_event);
@@ -7330,7 +7330,7 @@ Terminal::widget_focus_out(GdkEventFocus *event)
 void
 Terminal::widget_enter(GdkEventCrossing *event)
 {
-        ringview_maybe_update();
+        ringview_update();
 
         GdkEvent* base_event = reinterpret_cast<GdkEvent*>(event);
         auto pos = view_coords_from_event(base_event);
@@ -7349,7 +7349,7 @@ Terminal::widget_enter(GdkEventCrossing *event)
 void
 Terminal::widget_leave(GdkEventCrossing *event)
 {
-        ringview_maybe_update();
+        ringview_update();
 
         GdkEvent* base_event = reinterpret_cast<GdkEvent*>(event);
         auto pos = view_coords_from_event(base_event);
@@ -9024,7 +9024,7 @@ Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items,
 
 
 void
-Terminal::ringview_maybe_update()
+Terminal::ringview_update()
 {
         m_ringview.set_ring (m_screen->row_data);
         /* Due to possibly unaligned height and per-pixel scrolling, up to 2 more lines than the
@@ -9036,7 +9036,7 @@ Terminal::ringview_maybe_update()
          */
         m_ringview.set_rows ((long) m_screen->scroll_delta, m_row_count + 2);
         m_ringview.set_width (m_column_count);
-        m_ringview.maybe_update ();
+        m_ringview.update ();
 }
 
 /* XXX tmp hack */
@@ -9568,7 +9568,7 @@ Terminal::widget_draw(cairo_t *cr)
         if (region == NULL)
                 return;
 
-        ringview_maybe_update();
+        ringview_update();
 
         allocated_width = get_allocated_width();
         allocated_height = get_allocated_height();
@@ -9703,7 +9703,7 @@ Terminal::widget_scroll(GdkEventScroll *event)
 
         GdkEvent *base_event = reinterpret_cast<GdkEvent*>(event);
 
-        ringview_maybe_update();
+        ringview_update();
 
        read_modifiers(base_event);
 
@@ -10587,7 +10587,7 @@ Terminal::process(bool emit_adj_changed)
         } else {
                 // FIXMEegmont why is it needed here, and is this the best place?
                 // Without this, sudden two-finger kinetic scrolls result in crash.
-                ringview_maybe_update();
+                ringview_update();
 
                 emit_pending_signals();
         }
diff --git a/src/vtegtk.cc b/src/vtegtk.cc
index 262691bd..f5d92d0f 100644
--- a/src/vtegtk.cc
+++ b/src/vtegtk.cc
@@ -1787,16 +1787,16 @@ const char *
 vte_get_features (void)
 {
         return
-#ifdef WITH_GNUTLS
-                "+GNUTLS"
-#else
-                "-GNUTLS"
-#endif
-                " "
 #ifdef WITH_FRIBIDI
                 "+BIDI"
 #else
                 "-BIDI"
+#endif
+                " "
+#ifdef WITH_GNUTLS
+                "+GNUTLS"
+#else
+                "-GNUTLS"
 #endif
                 ;
 }
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 8193610b..b1891e1a 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1331,7 +1331,7 @@ public:
                                    vte::parser::StringTokeniser::const_iterator& token,
                                    vte::parser::StringTokeniser::const_iterator const& endtoken) noexcept;
 
-        void ringview_maybe_update();
+        void ringview_update();
 
         /* Sequence handlers */
         bool m_line_wrapped; // signals line wrapped from character insertion


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