[vte] ring: Add _vte_ring_reset()
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] ring: Add _vte_ring_reset()
- Date: Sat, 29 Nov 2014 12:30:23 +0000 (UTC)
commit fc9dcbba2e875e44e646287f8551a89297021a11
Author: Egmont Koblinger <egmont gmail com>
Date: Sat Nov 29 13:28:46 2014 +0100
ring: Add _vte_ring_reset()
https://bugzilla.gnome.org/show_bug.cgi?id=738601#c75
src/ring.c | 10 ++++++++++
src/ring.h | 1 +
src/vte.c | 8 ++------
3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index 6eb3569..59330b2 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 ec38019..c23b06d 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 9ee5e73..01602c2 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]