summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgmont Koblinger <egmont@gmail.com>2014-11-29 13:28:46 +0100
committerEgmont Koblinger <egmont@gmail.com>2014-11-29 13:28:46 +0100
commitfc9dcbba2e875e44e646287f8551a89297021a11 (patch)
treee003e7da34bb342030971ab5e9c2113b5f1d07ed
parent6da6f95ba2efe565f92ab7ed7d27090237c3cb06 (diff)
downloadvte-fc9dcbba2e875e44e646287f8551a89297021a11.tar.gz
ring: Add _vte_ring_reset()
https://bugzilla.gnome.org/show_bug.cgi?id=738601#c75
-rw-r--r--src/ring.c10
-rw-r--r--src/ring.h1
-rw-r--r--src/vte.c8
3 files changed, 13 insertions, 6 deletions
diff --git a/src/ring.c b/src/ring.c
index 6eb35691..59330b21 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -316,6 +316,16 @@ _vte_ring_reset_streams (VteRing *ring, gulong position)
ring->last_attr.i = basic_cell.i.attr;
}
+void
+_vte_ring_reset (VteRing *ring)
+{
+ _vte_debug_print (VTE_DEBUG_RING, "Reseting the ring.\n");
+
+ _vte_ring_reset_streams (ring, 0);
+ ring->start = ring->end = ring->writable = 0;
+ ring->cached_row_num = (gulong) -1;
+}
+
static inline VteRowData *
_vte_ring_writable_index (VteRing *ring, gulong position)
{
diff --git a/src/ring.h b/src/ring.h
index ec38019b..c23b06df 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -80,6 +80,7 @@ VteRowData *_vte_ring_index_writable (VteRing *ring, gulong position);
void _vte_ring_init (VteRing *ring, gulong max_rows);
void _vte_ring_fini (VteRing *ring);
+void _vte_ring_reset (VteRing *ring);
void _vte_ring_resize (VteRing *ring, gulong max_rows);
void _vte_ring_shrink (VteRing *ring, gulong max_len);
VteRowData *_vte_ring_insert (VteRing *ring, gulong position);
diff --git a/src/vte.c b/src/vte.c
index 9ee5e731..01602c27 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -11789,12 +11789,8 @@ vte_terminal_reset(VteTerminal *terminal,
pvt->character_replacement = &pvt->character_replacements[0];
/* Clear the scrollback buffers and reset the cursors. */
if (clear_history) {
- _vte_ring_fini(pvt->normal_screen.row_data);
- _vte_ring_init(pvt->normal_screen.row_data, pvt->scrollback_lines);
- _vte_ring_set_visible_rows_hint(pvt->normal_screen.row_data, pvt->row_count);
- _vte_ring_fini(pvt->alternate_screen.row_data);
- _vte_ring_init(pvt->alternate_screen.row_data, pvt->row_count);
- _vte_ring_set_visible_rows_hint(pvt->alternate_screen.row_data, pvt->row_count);
+ _vte_ring_reset(pvt->normal_screen.row_data);
+ _vte_ring_reset(pvt->alternate_screen.row_data);
pvt->normal_screen.saved.cursor.row = 0;
pvt->normal_screen.saved.cursor.col = 0;
pvt->normal_screen.scroll_delta = 0;