[vte/wip/egmont/bidi: 7/29] widget: Set the soft_wrapped flag via wrapper methods
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 7/29] widget: Set the soft_wrapped flag via wrapper methods
- Date: Fri, 31 May 2019 12:49:05 +0000 (UTC)
commit 25510db240e6ecee97658a08fe6edbce2218b6b6
Author: Egmont Koblinger <egmont gmail com>
Date: Fri May 31 12:33:39 2019 +0200
widget: Set the soft_wrapped flag via wrapper methods
This is in preparation for RingView and BiDi where there'll be more to do.
src/vte.cc | 22 +++++++++++++++++++++-
src/vteinternal.hh | 3 +++
src/vteseq.cc | 10 +++++-----
3 files changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index b0131352..afedf8d2 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -470,6 +470,26 @@ Terminal::find_end_column(vte::grid::column_t col,
return MIN(col + columns, m_column_count);
}
+/* Sets the line ending to hard wrapped (explicit newline). */
+void
+Terminal::set_hard_wrapped(vte::grid::row_t row)
+{
+ VteRowData *row_data = find_row_data_writable(row);
+ g_assert(row_data != nullptr);
+
+ row_data->attr.soft_wrapped = false;
+}
+
+/* Sets the line ending to soft wrapped (overflow to the next line). */
+void
+Terminal::set_soft_wrapped(vte::grid::row_t row)
+{
+ VteRowData *row_data = find_row_data_writable(row);
+ g_assert(row_data != nullptr);
+
+ row_data->attr.soft_wrapped = true;
+}
+
/* Determine the width of the portion of the preedit string which lies
* to the left of the cursor, or the entire string, in columns. */
// FIXMEchpe this is for the view, so use int not gssize
@@ -2855,7 +2875,7 @@ Terminal::insert_char(gunichar c,
col = m_screen->cursor.col = 0;
/* Mark this line as soft-wrapped. */
row = ensure_row();
- row->attr.soft_wrapped = 1;
+ set_soft_wrapped(m_screen->cursor.row);
cursor_down(false);
} else {
/* Don't wrap, stay at the rightmost column. */
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index f321105e..7d4815e0 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -636,6 +636,9 @@ public:
VteRowData *ensure_cursor();
void update_insert_delta();
+ void set_hard_wrapped(vte::grid::row_t row);
+ void set_soft_wrapped(vte::grid::row_t row);
+
void cleanup_fragments(long start,
long end);
diff --git a/src/vteseq.cc b/src/vteseq.cc
index d596d8b9..d7855226 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -314,7 +314,7 @@ Terminal::clear_current_line()
_vte_row_data_shrink (rowdata, 0);
/* Add enough cells to the end of the line to fill out the row. */
_vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
- rowdata->attr.soft_wrapped = 0;
+ set_hard_wrapped(m_screen->cursor.row);
/* Repaint this row. */
invalidate_row(m_screen->cursor.row);
}
@@ -338,7 +338,7 @@ Terminal::clear_above_current()
_vte_row_data_shrink (rowdata, 0);
/* Add new cells until we fill the row. */
_vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
- rowdata->attr.soft_wrapped = 0;
+ set_hard_wrapped(i);
/* Repaint the row. */
invalidate_row(i);
}
@@ -731,7 +731,7 @@ Terminal::clear_below_current()
if (not_default_bg) {
_vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
}
- rowdata->attr.soft_wrapped = 0;
+ set_hard_wrapped(i);
/* Repaint this row. */
invalidate_row(i);
}
@@ -770,7 +770,7 @@ Terminal::clear_to_eol()
/* Add enough cells to fill out the row. */
_vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
}
- rowdata->attr.soft_wrapped = 0;
+ set_hard_wrapped(m_screen->cursor.row);
/* Repaint this row. */
invalidate_row(m_screen->cursor.row);
}
@@ -902,7 +902,7 @@ Terminal::delete_character()
_vte_row_data_fill(rowdata, &m_fill_defaults, m_column_count);
len = m_column_count;
}
- rowdata->attr.soft_wrapped = 0;
+ set_hard_wrapped(m_screen->cursor.row);
/* Repaint this row. */
invalidate_row(m_screen->cursor.row);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]