[vte] [ring] Move row attrs into a struct



commit a24f3bd3a7f9830245d4382df48f7063fd2340ea
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Sep 9 21:09:26 2009 -0400

    [ring] Move row attrs into a struct

 src/ring.h   |   11 ++++++++++-
 src/vte.c    |    8 ++++----
 src/vteseq.c |    8 ++++----
 3 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/src/ring.h b/src/ring.h
index 9885886..02389e2 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -132,6 +132,15 @@ typedef union _VteRowStorage {
 ASSERT_STATIC (sizeof (VteRowStorage) == 1);
 
 /*
+ * VteRowAttr: A single row's attributes
+ */
+
+typedef struct _VteRowAttr {
+	guint32 soft_wrapped: 1;
+} VteRowAttr;
+ASSERT_STATIC (sizeof (VteRowAttr) == 4);
+
+/*
  * VteRowData: A single row's data
  */
 
@@ -141,8 +150,8 @@ typedef struct _VteRowData {
 		guchar *bytes;  /* for compact storage */
 	} data;
 	guint32 len;
+	VteRowAttr attr;
 	VteRowStorage storage;
-	guint8 soft_wrapped: 1;
 } VteRowData;
 
 
diff --git a/src/vte.c b/src/vte.c
index fb8d7f2..f2e8870 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2971,7 +2971,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 			col = screen->cursor_current.col = 0;
 			/* Mark this line as soft-wrapped. */
 			row = _vte_terminal_ensure_row (terminal);
-			row->soft_wrapped = 1;
+			row->attr.soft_wrapped = 1;
 			_vte_terminal_cursor_down (terminal);
 		} else {
 			/* Don't wrap, stay at the rightmost column. */
@@ -3010,7 +3010,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 				row = _vte_terminal_find_row_data_writable (terminal, row_num);
 
 				if (row) {
-					if (!row->soft_wrapped)
+					if (!row->attr.soft_wrapped)
 						row = NULL;
 					else
 						col = _vte_row_data_length (row);
@@ -3139,7 +3139,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 			/* Wrap. */
 			screen->cursor_current.col = 0;
 			/* Mark this line as soft-wrapped. */
-			row->soft_wrapped = 1;
+			row->attr.soft_wrapped = 1;
 			_vte_terminal_cursor_down (terminal);
 		}
 	}
@@ -5173,7 +5173,7 @@ vte_line_is_wrappable(VteTerminal *terminal, glong row)
 {
 	const VteRowData *rowdata;
 	rowdata = _vte_terminal_find_row_data(terminal, row);
-	return rowdata && rowdata->soft_wrapped;
+	return rowdata && rowdata->attr.soft_wrapped;
 }
 
 /* Check if the given point is in the region between the two points,
diff --git a/src/vteseq.c b/src/vteseq.c
index b95cec1..4bdd8df 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -308,7 +308,7 @@ _vte_terminal_clear_current_line (VteTerminal *terminal)
 		_vte_row_data_shrink (rowdata, 0);
 		/* Add enough cells to the end of the line to fill out the row. */
 		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
-		rowdata->soft_wrapped = 0;
+		rowdata->attr.soft_wrapped = 0;
 		/* Repaint this row. */
 		_vte_invalidate_cells(terminal,
 				      0, terminal->column_count,
@@ -338,7 +338,7 @@ _vte_terminal_clear_above_current (VteTerminal *terminal)
 			_vte_row_data_shrink (rowdata, 0);
 			/* Add new cells until we fill the row. */
 			_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
-			rowdata->soft_wrapped = 0;
+			rowdata->attr.soft_wrapped = 0;
 			/* Repaint the row. */
 			_vte_invalidate_cells(terminal,
 					0, terminal->column_count, i, 1);
@@ -1067,7 +1067,7 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
 		}
 		/* Pad out the row. */
 		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
-		rowdata->soft_wrapped = 0;
+		rowdata->attr.soft_wrapped = 0;
 		/* Repaint this row. */
 		_vte_invalidate_cells(terminal,
 				      0, terminal->column_count,
@@ -1100,7 +1100,7 @@ vte_sequence_handler_ce (VteTerminal *terminal, GValueArray *params)
 		/* Add enough cells to fill out the row. */
 		_vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
 	}
-	rowdata->soft_wrapped = 0;
+	rowdata->attr.soft_wrapped = 0;
 	/* Repaint this row. */
 	_vte_invalidate_cells(terminal,
 			      screen->cursor_current.col,



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