[vte/wip/egmont/bidi: 68/76] preedit



commit 5473d47cda40326e10cf2829e0b8a357a282054a
Author: Egmont Koblinger <egmont gmail com>
Date:   Wed Sep 19 12:52:28 2018 +0200

    preedit

 BIDI-STATUS |  2 +-
 src/vte.cc  | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/BIDI-STATUS b/BIDI-STATUS
index ccac1564..a30f5f33 100644
--- a/BIDI-STATUS
+++ b/BIDI-STATUS
@@ -20,7 +20,6 @@ Bugs:
 
 Missing from first release:
 - Adjust mouse reporting.
-- Adjust the preedit box.
 - The entire screen is always invalidated. Have some more fine grained
   solution (see also vte #26).
 - Probably we'd need to make Erase in Display (Below or All) sequences turn
@@ -37,6 +36,7 @@ Planned future improvements:
 - Mirror the glyphs that don't have mirrored counterpart.
 - Play with other possibilities for placing the cursor (especially when it's
   at the end of the logical line).
+- Play with better placement of the preedit box.
 - Keyboard arrow swapping.
 - Remember some lines that are no longer user-accessible as they scroll out,
   to properly BiDi the still remaining part of that paragraph.
diff --git a/src/vte.cc b/src/vte.cc
index df136031..00507f2d 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -9280,12 +9280,19 @@ void
 Terminal::paint_im_preedit_string()
 {
        int col, columns;
+       long row;
        long width, height;
        int i, len;
 
        if (m_im_preedit.empty())
                return;
 
+        /* Get the row's BiDi information. */
+        row = m_screen->cursor.row;
+        if (row < first_displayed_row() || row > last_displayed_row())
+                return;
+        vte::base::BidiRow const *bidirow = m_ringview.get_row_map(row);
+
        /* Keep local copies of rendering information. */
        width = m_cell_width;
        height = m_cell_height;
@@ -9296,7 +9303,7 @@ Terminal::paint_im_preedit_string()
 
        /* If the pre-edit string won't fit on the screen if we start
         * drawing it at the cursor's position, move it left. */
-        col = m_screen->cursor.col;
+        col = bidirow->log2vis(m_screen->cursor.col);
        if (col + columns > m_column_count) {
                col = MAX(0, m_column_count - columns);
        }
@@ -9307,7 +9314,7 @@ Terminal::paint_im_preedit_string()
                const char *preedit = m_im_preedit.c_str();
                int preedit_cursor;
 
-               items = g_new(struct _vte_draw_text_request, len);
+               items = g_new0(struct _vte_draw_text_request, len);
                for (i = columns = 0; i < len; i++) {
                        items[i].c = g_utf8_get_char(preedit);
                         items[i].columns = _vte_unichar_width(items[i].c,


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