[vte] widget: Move some methods to VteTerminalPrivate
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] widget: Move some methods to VteTerminalPrivate
- Date: Thu, 14 Jan 2016 16:13:21 +0000 (UTC)
commit 0d7f5e98c4eae90fb96f5f804c9cca5fac211dc7
Author: Christian Persch <chpe gnome org>
Date: Thu Jan 14 17:05:37 2016 +0100
widget: Move some methods to VteTerminalPrivate
src/vteinternal.hh | 2 +
src/vteseq.cc | 79 +++++++++++++++++++++++++++++-----------------------
2 files changed, 46 insertions(+), 35 deletions(-)
---
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 35c81f9..8c32ad9 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -1156,6 +1156,8 @@ public:
inline void set_keypad_mode(VteKeymode mode);
inline void seq_erase_in_display(long param);
inline void seq_erase_in_line(long param);
+ inline void seq_insert_lines(vte::grid::row_t param);
+ inline void seq_delete_lines(vte::grid::row_t param);
};
#define m_invalidated_all invalidated_all
diff --git a/src/vteseq.cc b/src/vteseq.cc
index 8c07504..494636b 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -2702,94 +2702,103 @@ vte_sequence_handler_full_reset (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
{
- GValue *value;
- VteScreen *screen;
- long param, end, row, i, limit;
- screen = terminal->pvt->screen;
/* The default is one. */
- param = 1;
+ long param = 1;
/* Extract any parameters. */
if ((params != NULL) && (params->n_values > 0)) {
- value = g_value_array_get_nth(params, 0);
+ GValue* value = g_value_array_get_nth(params, 0);
if (G_VALUE_HOLDS_LONG(value)) {
param = g_value_get_long(value);
}
}
+
+ terminal->pvt->seq_insert_lines(param);
+}
+
+void
+VteTerminalPrivate::seq_insert_lines(vte::grid::row_t param)
+{
+ vte::grid::row_t end, i;
+
/* Find the region we're messing with. */
- row = terminal->pvt->cursor.row;
- if (terminal->pvt->scrolling_restricted) {
- end = screen->insert_delta + terminal->pvt->scrolling_region.end;
+ auto row = m_cursor.row;
+ if (m_scrolling_restricted) {
+ end = m_screen->insert_delta + m_scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
+ end = m_screen->insert_delta + m_row_count - 1;
}
/* Only allow to insert as many lines as there are between this row
* and the end of the scrolling region. See bug #676090.
*/
- limit = end - row + 1;
+ auto limit = end - row + 1;
param = MIN (param, limit);
for (i = 0; i < param; i++) {
/* Clear a line off the end of the region and add one to the
* top of the region. */
- _vte_terminal_ring_remove (terminal, end);
- _vte_terminal_ring_insert (terminal, row, TRUE);
+ _vte_terminal_ring_remove(m_terminal, end);
+ _vte_terminal_ring_insert(m_terminal, row, TRUE);
}
- terminal->pvt->cursor.col = 0;
+ m_cursor.col = 0;
/* Update the display. */
- terminal->pvt->scroll_region(row, end - row + 1, param);
+ scroll_region(row, end - row + 1, param);
/* Adjust the scrollbars if necessary. */
- terminal->pvt->adjust_adjustments();
+ adjust_adjustments();
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_inserted_flag = TRUE;
+ m_text_inserted_flag = TRUE;
}
/* Delete certain lines from the scrolling region. */
static void
vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
{
- GValue *value;
- VteScreen *screen;
- long param, end, row, i, limit;
-
- screen = terminal->pvt->screen;
/* The default is one. */
- param = 1;
+ long param = 1;
/* Extract any parameters. */
if ((params != NULL) && (params->n_values > 0)) {
- value = g_value_array_get_nth(params, 0);
+ GValue* value = g_value_array_get_nth(params, 0);
if (G_VALUE_HOLDS_LONG(value)) {
param = g_value_get_long(value);
}
}
+
+ terminal->pvt->seq_delete_lines(param);
+}
+
+void
+VteTerminalPrivate::seq_delete_lines(vte::grid::row_t param)
+{
+ vte::grid::row_t end, i;
+
/* Find the region we're messing with. */
- row = terminal->pvt->cursor.row;
- if (terminal->pvt->scrolling_restricted) {
- end = screen->insert_delta + terminal->pvt->scrolling_region.end;
+ auto row = m_cursor.row;
+ if (m_scrolling_restricted) {
+ end = m_screen->insert_delta + m_scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->pvt->row_count - 1;
+ end = m_screen->insert_delta + m_row_count - 1;
}
/* Only allow to delete as many lines as there are between this row
* and the end of the scrolling region. See bug #676090.
*/
- limit = end - row + 1;
+ auto limit = end - row + 1;
param = MIN (param, limit);
/* Clear them from below the current cursor. */
for (i = 0; i < param; i++) {
/* Insert a line at the end of the region and remove one from
* the top of the region. */
- _vte_terminal_ring_remove (terminal, row);
- _vte_terminal_ring_insert (terminal, end, TRUE);
+ _vte_terminal_ring_remove(m_terminal, row);
+ _vte_terminal_ring_insert(m_terminal, end, TRUE);
}
- terminal->pvt->cursor.col = 0;
+ m_cursor.col = 0;
/* Update the display. */
- terminal->pvt->scroll_region(row, end - row + 1, -param);
+ scroll_region(row, end - row + 1, -param);
/* Adjust the scrollbars if necessary. */
- terminal->pvt->adjust_adjustments();
+ adjust_adjustments();
/* We've modified the display. Make a note of it. */
- terminal->pvt->text_deleted_flag = TRUE;
+ m_text_deleted_flag = TRUE;
}
/* Device status reports. The possible reports are the cursor position and
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]