[vte/wip/egmont/bidi: 27/82] cursor
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 27/82] cursor
- Date: Wed, 12 Sep 2018 11:56:08 +0000 (UTC)
commit 231cc40f862281fea6c6f005b0845485e24b58bf
Author: Egmont Koblinger <egmont gmail com>
Date: Sat Aug 18 17:21:21 2018 +0200
cursor
src/vte.cc | 21 +++++++++++++++++++--
src/vteinternal.hh | 3 +++
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index c1abc1f7..97573313 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -432,6 +432,22 @@ Terminal::find_charcell(vte::grid::column_t col,
return ret;
}
+VteCell const*
+Terminal::find_charcell_bidi(vte::grid::column_t col,
+ vte::grid::row_t row,
+ gboolean *rtl) 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);
+ *rtl = rowdata->attr.bidi_rtl;
+ }
+ return ret;
+}
+
// FIXMEchpe replace this with a method on VteRing
vte::grid::column_t
Terminal::find_start_column(vte::grid::column_t col,
@@ -9444,7 +9460,8 @@ 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. */
- auto cell = find_charcell(col, drow);
+ gboolean rtl;
+ auto cell = find_charcell_bidi(col, drow, &rtl);
while (cell != NULL && cell->attr.fragment() && cell->c != '\t' && col > 0) {
col--;
cell = find_charcell(col, drow);
@@ -9453,7 +9470,7 @@ Terminal::paint_cursor()
/* Draw the cursor. */
item.c = (cell && cell->c) ? cell->c : ' ';
item.columns = item.c == '\t' ? 1 : cell ? cell->attr.columns() : 1;
- item.x = col * width;
+ item.x = (rtl ? m_column_count - 1 - col : col) * width;
item.y = row_to_pixel(drow);
if (cell && cell->c != 0) {
style = _vte_draw_get_style(cell->attr.bold(), cell->attr.italic());
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index e55e8fc2..5922c4bc 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -646,6 +646,9 @@ public:
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,
+ gboolean *rtl) const;
inline vte::grid::column_t find_start_column(vte::grid::column_t col,
vte::grid::row_t row) const;
inline vte::grid::column_t find_end_column(vte::grid::column_t col,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]