[vte] [ring] Remove insert_preserve(), just call insert()



commit c84078230b8a9078843cf027846e16d25555128f
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Aug 25 18:40:28 2009 -0400

    [ring] Remove insert_preserve(), just call insert()
    
    I changed the semantics of insert_preserve() and broke vim.  Reading
    the old code however, it seems equivalent functionally to insert().
    Just use that.

 src/ring.c |   44 --------------------------------------------
 src/ring.h |    1 -
 src/vte.c  |    4 ++--
 3 files changed, 2 insertions(+), 47 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index 6ff7150..8d99187 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -238,50 +238,6 @@ _vte_ring_insert(VteRing * ring, long position)
 }
 
 /**
- * _vte_ring_insert_preserve:
- * @ring: a #VteRing
- * @position: an index
- *
- * Inserts a new, empty, row into @ring at the @position'th offset.  If @ring
- * already has an item stored at the desired location, it (and any successive
- * items) will be moved down, items that need to be removed will be removed
- * from the *top*.
- *
- * Return: the newly added row.
- */
-VteRowData *
-_vte_ring_insert_preserve(VteRing * ring, long position)
-{
-	long i;
-	VteRowData *row;
-
-	g_return_val_if_fail(position <= _vte_ring_next(ring), NULL);
-
-	_vte_debug_print(VTE_DEBUG_RING,
-			"Inserting+ at position %ld.\n"
-			" Delta = %ld, Length = %ld, Max = %ld.\n",
-			position, ring->delta, ring->length, ring->max);
-	_vte_ring_validate(ring);
-
-	if (ring->length < ring->max)
-		return _vte_ring_insert (ring, position);
-
-	/* Otherwise, we need to shift items back */
-	_vte_row_data_fini (&ring->array[ring->delta % ring->max], TRUE);
-	for (i = ring->delta; i < position; i++)
-		*_vte_ring_index(ring, i) = *_vte_ring_index(ring, i + 1);
-	_vte_row_data_fini (&ring->array[position % ring->max], FALSE);
-	row = _vte_row_data_init(&ring->array[position % ring->max]);
-
-	_vte_debug_print(VTE_DEBUG_RING,
-			" Delta = %ld, Length = %ld, Max = %ld.\n",
-			ring->delta, ring->length, ring->max);
-	_vte_ring_validate(ring);
-
-	return row;
-}
-
-/**
  * _vte_ring_append:
  * @ring: a #VteRing
  * @data: the new item
diff --git a/src/ring.h b/src/ring.h
index efd0afd..ac96d86 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -87,7 +87,6 @@ struct _VteRing {
 VteRing *_vte_ring_new(glong max_elements);
 void _vte_ring_resize(VteRing *ring, glong max_elements);
 VteRowData *_vte_ring_insert(VteRing *ring, glong position);
-VteRowData *_vte_ring_insert_preserve(VteRing *ring, glong position);
 VteRowData *_vte_ring_append(VteRing *ring);
 void _vte_ring_remove(VteRing *ring, glong position);
 void _vte_ring_free(VteRing *ring);
diff --git a/src/vte.c b/src/vte.c
index 1c4d8e1..875c3d3 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2913,8 +2913,8 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
 				 * to insert_delta. */
 				start++;
 				end++;
-				_vte_ring_insert_preserve(terminal->pvt->screen->row_data,
-							  screen->cursor_current.row);
+				_vte_ring_insert(terminal->pvt->screen->row_data,
+						 screen->cursor_current.row);
 				/* Force the areas below the region to be
 				 * redrawn -- they've moved. */
 				_vte_terminal_scroll_region(terminal, start,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]