[vte/wip/egmont/bidi: 32/82] cleanup
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 32/82] cleanup
- Date: Wed, 12 Sep 2018 11:54:50 +0000 (UTC)
commit bfa701b5efa33676f5cc0a8148e1b6672dbaee95
Author: Egmont Koblinger <egmont gmail com>
Date: Mon Aug 20 00:16:11 2018 +0200
cleanup
src/vte.cc | 46 +++++++++++++++++-----------------------------
src/vteinternal.hh | 2 --
2 files changed, 17 insertions(+), 31 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 23fd547f..cfc4b320 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -418,24 +418,11 @@ Terminal::find_row_data_writable(vte::grid::row_t row) const
/* Find the character an the given position in the backscroll buffer. */
// FIXMEchpe replace this with a method on VteRing
+// FIXME do we do overloading? and default parameter?
VteCell const*
Terminal::find_charcell(vte::grid::column_t col,
- vte::grid::row_t row) 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);
- }
- return ret;
-}
-
-VteCell const*
-Terminal::find_charcell_bidi(vte::grid::column_t col,
vte::grid::row_t row,
- guint8 *bidi_flags) const
+ guint8 *bidi_flags = nullptr) const
{
VteRowData const* rowdata;
VteCell const* ret = nullptr;
@@ -443,7 +430,8 @@ Terminal::find_charcell_bidi(vte::grid::column_t col,
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);
- *bidi_flags = rowdata->attr.bidi_flags;
+ if (bidi_flags != nullptr)
+ *bidi_flags = rowdata->attr.bidi_flags;
}
return ret;
}
@@ -9038,7 +9026,7 @@ Terminal::draw_cells_with_attributes(struct _vte_draw_text_request *items,
/* XXX tmp hack */
-#define _vte_row_data_get_bidi(row_data_p, col) \
+#define _vte_row_data_get_visual(row_data_p, col) \
(_vte_row_data_get ((row_data_p), (((row_data_p)->attr.bidi_flags & VTE_BIDI_RTL) ? (m_column_count - 1
- (col)) : (col))))
@@ -9083,14 +9071,14 @@ Terminal::draw_rows(VteScreen *screen_,
* making the drawing area a little wider. */
i = start_column;
if (row_data != NULL) {
- cell = _vte_row_data_get_bidi (row_data, i);
+ cell = _vte_row_data_get_visual (row_data, i);
while (cell != NULL && cell->attr.fragment() && i > 0) {
- cell = _vte_row_data_get_bidi (row_data, --i);
+ cell = _vte_row_data_get_visual (row_data, --i);
}
/* Walk the line. */
do {
/* Get the character cell's contents. */
- cell = _vte_row_data_get_bidi (row_data, i);
+ cell = _vte_row_data_get_visual (row_data, i);
/* Find the colors for this cell. */
selected = cell_is_selected(i, row);
determine_colors(cell, selected, &fore, &back, &deco);
@@ -9099,7 +9087,7 @@ Terminal::draw_rows(VteScreen *screen_,
while (j < end_column){
/* Retrieve the cell. */
- cell = _vte_row_data_get_bidi (row_data, j);
+ cell = _vte_row_data_get_visual (row_data, j);
/* Don't render fragments of multicolumn characters
* which have the same attributes as the initial
* portions. */
@@ -9175,17 +9163,17 @@ Terminal::draw_rows(VteScreen *screen_,
/* Back up in case this is a multicolumn character,
* making the drawing area a little wider. */
i = start_column;
- cell = _vte_row_data_get_bidi (row_data, i);
+ cell = _vte_row_data_get_visual (row_data, i);
// if (cell == NULL) {
// goto fg_skip_row;
// }
while (cell != NULL && cell->attr.fragment() && i > 0)
- cell = _vte_row_data_get_bidi (row_data, --i);
+ cell = _vte_row_data_get_visual (row_data, --i);
/* Walk the line. */
do {
/* Get the character cell's contents. */
- cell = _vte_row_data_get_bidi (row_data, i);
+ cell = _vte_row_data_get_visual (row_data, i);
// if (cell == NULL) {
// // goto fg_skip_row;
// i++;
@@ -9201,7 +9189,7 @@ Terminal::draw_rows(VteScreen *screen_,
if (++i >= end_column) {
goto fg_skip_row;
}
- cell = _vte_row_data_get_bidi (row_data, i);
+ cell = _vte_row_data_get_visual (row_data, i);
// if (cell == NULL) {
// // goto fg_skip_row;
// i++;
@@ -9231,7 +9219,7 @@ Terminal::draw_rows(VteScreen *screen_,
while (j < end_column &&
item_count < G_N_ELEMENTS(items)) {
/* Retrieve the cell. */
- cell = _vte_row_data_get_bidi (row_data, j);
+ cell = _vte_row_data_get_visual (row_data, j);
if (cell == NULL) {
// goto fg_next_row;
j++;
@@ -9324,10 +9312,10 @@ fg_next_row:
* multicolumn character, making the drawing
* area a little wider. */
j = start_column;
- cell = _vte_row_data_get_bidi (row_data, j);
+ cell = _vte_row_data_get_visual (row_data, j);
} while (FALSE); // FIXME eliminate loop
while (cell != NULL && cell->attr.fragment() && j > 0) {
- cell = _vte_row_data_get_bidi (row_data, --j);
+ cell = _vte_row_data_get_visual (row_data, --j);
}
} while (TRUE);
fg_draw:
@@ -9471,7 +9459,7 @@ 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. */
guint8 bidi_flags = 0;
- auto cell = find_charcell_bidi(col, drow, &bidi_flags);
+ auto cell = find_charcell(col, drow, &bidi_flags);
while (cell != NULL && cell->attr.fragment() && cell->c != '\t' && col > 0) {
col--;
cell = find_charcell(col, drow);
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index d27a4ee1..4954bc26 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -652,8 +652,6 @@ public:
inline VteRowData const* find_row_data(vte::grid::row_t row) const;
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,
guint8 *bidi_flags) const;
inline vte::grid::column_t find_start_column(vte::grid::column_t col,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]