[vte] Simplify insert



commit 681db91a7772a77b903163f6985330a6f24ef977
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Aug 26 00:12:21 2009 -0400

    Simplify insert

 src/vte.c    |   11 ++---------
 src/vteseq.c |   11 ++---------
 2 files changed, 4 insertions(+), 18 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index f2ee482..fca1fb4 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -298,16 +298,9 @@ vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
 static VteRowData *
 vte_insert_line_internal(VteTerminal *terminal, glong position)
 {
-	/* Pad out the line data to the insertion point. */
-	while (_vte_ring_next(terminal->pvt->screen->row_data) < position) {
+	while (_vte_ring_next(terminal->pvt->screen->row_data) < position)
 		_vte_ring_append(terminal->pvt->screen->row_data);
-	}
-	/* If we haven't inserted a line yet, insert a new one. */
-	if (_vte_ring_next(terminal->pvt->screen->row_data) >= position) {
-		return _vte_ring_insert(terminal->pvt->screen->row_data, position);
-	} else {
-		return _vte_ring_append(terminal->pvt->screen->row_data);
-	}
+	return _vte_ring_insert(terminal->pvt->screen->row_data, position);
 }
 
 /* Remove a line at an arbitrary position. */
diff --git a/src/vteseq.c b/src/vteseq.c
index 8ee0270..377e2b3 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -117,16 +117,9 @@ vte_g_array_fill(GArray *array, gpointer item, guint final_size)
 static VteRowData *
 vte_insert_line_internal(VteTerminal *terminal, glong position)
 {
-	/* Pad out the line data to the insertion point. */
-	while (_vte_ring_next(terminal->pvt->screen->row_data) < position) {
+	while (_vte_ring_next(terminal->pvt->screen->row_data) < position)
 		_vte_ring_append(terminal->pvt->screen->row_data);
-	}
-	/* If we haven't inserted a line yet, insert a new one. */
-	if (_vte_ring_next(terminal->pvt->screen->row_data) >= position) {
-		return _vte_ring_insert(terminal->pvt->screen->row_data, position);
-	} else {
-		return _vte_ring_append(terminal->pvt->screen->row_data);
-	}
+	return _vte_ring_insert(terminal->pvt->screen->row_data, position);
 }
 
 /* Remove a line at an arbitrary position. */



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