[vte] Bug 596163 - Doesn't display expected background color in ncurses apps



commit 58d0affa8eea77353ef47c53923cd82c4203fe1a
Author: Behdad Esfahbod <behdad behdad org>
Date:   Thu Sep 24 15:22:30 2009 -0400

    Bug 596163 - Doesn't display expected background color in ncurses apps
    
    Revert semantic change introduced in 08caf3b174e68ba3d02f04c2595ad552cd50db30

 src/ring.c        |   25 +++----------------------
 src/vte-private.h |    3 +++
 src/vte.c         |   30 +++++++++++++++++++++++++-----
 src/vteseq.c      |   31 +++++++++++--------------------
 4 files changed, 42 insertions(+), 47 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index fe23707..ab13d42 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -480,8 +480,8 @@ _vte_ring_shrink (VteRing *ring, guint max_len)
  *
  * Return: the newly added row.
  */
-static VteRowData *
-_vte_ring_insert_internal (VteRing *ring, guint position)
+VteRowData *
+_vte_ring_insert (VteRing *ring, guint position)
 {
 	guint i;
 	VteRowData *row, tmp;
@@ -544,25 +544,6 @@ _vte_ring_remove (VteRing * ring, guint position)
 
 
 /**
- * _vte_ring_insert:
- * @ring: a #VteRing
- * @data: the new item
- *
- * Inserts a new, empty, row into @ring at the @position'th offset.
- * The item at that position and any items after that are shifted down.
- * It pads enough lines if @position is after the end of the ring.
- *
- * Return: the newly added row.
- */
-VteRowData *
-_vte_ring_insert (VteRing *ring, guint position)
-{
-	while (G_UNLIKELY (_vte_ring_next (ring) < position))
-		_vte_ring_append (ring);
-	return _vte_ring_insert_internal (ring, position);
-}
-
-/**
  * _vte_ring_append:
  * @ring: a #VteRing
  * @data: the new item
@@ -574,6 +555,6 @@ _vte_ring_insert (VteRing *ring, guint position)
 VteRowData *
 _vte_ring_append (VteRing * ring)
 {
-	return _vte_ring_insert_internal (ring, _vte_ring_next (ring));
+	return _vte_ring_insert (ring, _vte_ring_next (ring));
 }
 
diff --git a/src/vte-private.h b/src/vte-private.h
index 594b44d..97fbd79 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -416,6 +416,9 @@ void _vte_terminal_beep(VteTerminal *terminal);
 
 void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
 
+VteRowData *_vte_terminal_ring_insert (VteTerminal *terminal, guint position, gboolean fill);
+VteRowData *_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill);
+
 /* vteseq.c: */
 void _vte_terminal_handle_sequence(VteTerminal *terminal,
 				   const char *match_s,
diff --git a/src/vte.c b/src/vte.c
index b090315..38d52c0 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -285,6 +285,28 @@ vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
 }
 
 
+VteRowData *
+_vte_terminal_ring_insert (VteTerminal *terminal, guint position, gboolean fill)
+{
+	VteRowData *row;
+	VteRing *ring = terminal->pvt->screen->row_data;
+	while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
+		row = _vte_ring_append (ring);
+		_vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
+	}
+	row = _vte_ring_insert (ring, position);
+	if (fill)
+		_vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
+	return row;
+}
+
+VteRowData *
+_vte_terminal_ring_append (VteTerminal *terminal, gboolean fill)
+{
+	return _vte_terminal_ring_insert (terminal, _vte_ring_next (terminal->pvt->screen->row_data), fill);
+}
+
+
 /* Reset defaults for character insertion. */
 void
 _vte_terminal_set_default_attributes(VteTerminal *terminal)
@@ -2262,9 +2284,8 @@ static inline VteRowData *
 vte_terminal_insert_rows (VteTerminal *terminal, guint cnt)
 {
 	VteRowData *row;
-	VteScreen *screen = terminal->pvt->screen;
 	do {
-		row = _vte_ring_append (screen->row_data);
+		row = _vte_terminal_ring_append (terminal, FALSE);
 	} while(--cnt);
 	return row;
 }
@@ -2877,8 +2898,7 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
 				 * to insert_delta. */
 				start++;
 				end++;
-				_vte_ring_insert (terminal->pvt->screen->row_data,
-						  screen->cursor_current.row);
+				_vte_terminal_ring_insert (terminal, screen->cursor_current.row, FALSE);
 				/* Force the areas below the region to be
 				 * redrawn -- they've moved. */
 				_vte_terminal_scroll_region(terminal, start,
@@ -2890,7 +2910,7 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
 				 * region, add a line at the top to scroll the
 				 * bottom off. */
 				_vte_ring_remove (terminal->pvt->screen->row_data, start);
-				_vte_ring_insert (terminal->pvt->screen->row_data, end);
+				_vte_terminal_ring_insert (terminal, end, TRUE);
 				/* Update the display. */
 				_vte_terminal_scroll_region(terminal, start,
 							   end - start + 1, -1);
diff --git a/src/vteseq.c b/src/vteseq.c
index d409f7e..e70d246 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -277,7 +277,7 @@ _vte_terminal_clear_screen (VteTerminal *terminal)
 	initial = _vte_ring_next(screen->row_data);
 	/* Add a new screen's worth of rows. */
 	for (i = 0; i < terminal->row_count; i++)
-		_vte_ring_append(screen->row_data);
+		_vte_terminal_ring_append (terminal, TRUE);
 	/* Move the cursor and insertion delta to the first line in the
 	 * newly-cleared area and scroll if need be. */
 	screen->insert_delta = initial;
@@ -366,17 +366,17 @@ _vte_terminal_scroll_text (VteTerminal *terminal, int scroll_amount)
 	}
 
 	while (_vte_ring_next(screen->row_data) <= end)
-		_vte_ring_append(terminal->pvt->screen->row_data);
+		_vte_terminal_ring_append (terminal, FALSE);
 
 	if (scroll_amount > 0) {
 		for (i = 0; i < scroll_amount; i++) {
 			_vte_ring_remove (terminal->pvt->screen->row_data, end);
-			_vte_ring_insert (terminal->pvt->screen->row_data, start);
+			_vte_terminal_ring_insert (terminal, start, TRUE);
 		}
 	} else {
 		for (i = 0; i < -scroll_amount; i++) {
 			_vte_ring_remove (terminal->pvt->screen->row_data, start);
-			_vte_ring_insert (terminal->pvt->screen->row_data, end);
+			_vte_terminal_ring_insert (terminal, end, TRUE);
 		}
 	}
 
@@ -897,7 +897,6 @@ static void
 vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
 {
 	VteScreen *screen;
-	VteRowData *rowdata;
 	long start, end, param, i;
 	GValue *value;
 
@@ -924,9 +923,7 @@ vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
 		/* Clear a line off the end of the region and add one to the
 		 * top of the region. */
 		_vte_ring_remove (terminal->pvt->screen->row_data, end);
-		rowdata = _vte_ring_insert (terminal->pvt->screen->row_data, start);
-		/* Add enough cells to it so that it has the default columns. */
-		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+		_vte_terminal_ring_insert (terminal, start, TRUE);
 		/* Adjust the scrollbars if necessary. */
 		_vte_terminal_adjust_adjustments(terminal);
 	}
@@ -1063,7 +1060,7 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
 			rowdata = _vte_ring_index_writable (screen->row_data, i);
 			g_assert(rowdata != NULL);
 		} else {
-			rowdata = _vte_ring_append (screen->row_data);
+			rowdata = _vte_terminal_ring_append (screen->row_data, FALSE);
 		}
 		/* Pad out the row. */
 		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
@@ -1410,7 +1407,7 @@ vte_sequence_handler_dl (VteTerminal *terminal, GValueArray *params)
 		/* Clear a line off the end of the region and add one to the
 		 * top of the region. */
 		_vte_ring_remove (terminal->pvt->screen->row_data, start);
-		_vte_ring_insert (terminal->pvt->screen->row_data, end);
+		_vte_terminal_ring_insert (terminal, end, TRUE);
 		/* Adjust the scrollbars if necessary. */
 		_vte_terminal_adjust_adjustments(terminal);
 	}
@@ -1979,7 +1976,7 @@ vte_sequence_handler_sr (VteTerminal *terminal, GValueArray *params)
 		/* If we're at the top of the scrolling region, add a
 		 * line at the top to scroll the bottom off. */
 		_vte_ring_remove (terminal->pvt->screen->row_data, end);
-		_vte_ring_insert (terminal->pvt->screen->row_data, start);
+		_vte_terminal_ring_insert (terminal, start, TRUE);
 		/* Update the display. */
 		_vte_terminal_scroll_region(terminal, start, end - start + 1, 1);
 		_vte_invalidate_cells(terminal,
@@ -2734,7 +2731,6 @@ vte_sequence_handler_insert_blank_characters (VteTerminal *terminal, GValueArray
 static void
 vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
 {
-	VteRowData *rowdata;
 	GValue *value;
 	VteScreen *screen;
 	long param, end, row;
@@ -2761,9 +2757,7 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
 		/* Clear a line off the end of the region and add one to the
 		 * top of the region. */
 		_vte_ring_remove (terminal->pvt->screen->row_data, end);
-		rowdata = _vte_ring_insert (terminal->pvt->screen->row_data, row);
-		/* Add enough cells to it so that it has the default colors. */
-		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+		_vte_terminal_ring_insert (terminal, row, TRUE);
 	}
 	/* Update the display. */
 	_vte_terminal_scroll_region(terminal, row, end - row + 1, param);
@@ -2778,7 +2772,6 @@ static void
 vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
 {
 	GValue *value;
-	VteRowData *rowdata;
 	VteScreen *screen;
 	long param, end, row;
 	int i;
@@ -2805,9 +2798,7 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
 		/* Insert a line at the end of the region and remove one from
 		 * the top of the region. */
 		_vte_ring_remove (terminal->pvt->screen->row_data, row);
-		rowdata = _vte_ring_insert (terminal->pvt->screen->row_data, end);
-		/* Add enough cells to it so that it has the default colors. */
-		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+		_vte_terminal_ring_insert (terminal, end, TRUE);
 	}
 	/* Update the display. */
 	_vte_terminal_scroll_region(terminal, row, end - row + 1, -param);
@@ -2973,7 +2964,7 @@ vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *
 	     row++) {
 		/* Find this row. */
 		while (_vte_ring_next(screen->row_data) <= row)
-			_vte_ring_append(screen->row_data);
+			_vte_terminal_ring_append (terminal, FALSE);
 		_vte_terminal_adjust_adjustments(terminal);
 		rowdata = _vte_ring_index_writable (screen->row_data, row);
 		g_assert(rowdata != NULL);



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