[vte] Remove cell.attr.fragment and use cell.c == FRAGMENT instead



commit cbb3071086f9bc173b9d8b9d3f79f87bae256c6a
Author: Behdad Esfahbod <behdad behdad org>
Date:   Thu Aug 27 17:10:19 2009 -0400

    Remove cell.attr.fragment and use cell.c == FRAGMENT instead

 src/ring.h   |    6 +++---
 src/vte.c    |   42 +++++++++++++++++++-----------------------
 src/vteseq.c |    6 +++---
 3 files changed, 25 insertions(+), 29 deletions(-)
---
diff --git a/src/ring.h b/src/ring.h
index 22af42f..f8e2665 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -36,6 +36,8 @@ G_BEGIN_DECLS
 #define VTE_DEF_HL                      260
 #define VTE_CUR_BG			261
 
+#define FRAGMENT			-2
+
 typedef struct _vtecellattr {
 	guint32 columns: 4;	/* Number of visible columns
 				   (as determined by g_unicode_iswide(c)).
@@ -45,7 +47,6 @@ typedef struct _vtecellattr {
 	guint32 fore: 9;	/* Index into color palette */
 	guint32 back: 9;	/* Index into color palette. */
 
-	guint32 fragment: 1;	/* A continuation cell. */
 	guint32 standout: 1;	/* Single-bit attributes. */
 	guint32 underline: 1;
 	guint32 strikethrough: 1;
@@ -60,7 +61,7 @@ typedef struct _vtecellattr {
 	guint32 protect: 1;
 	 */
 
-	/* 31 bits */
+	/* 30 bits */
 } vtecellattr;
 
 
@@ -76,7 +77,6 @@ static const vtecell basic_cell = {
 	VTE_DEF_FG, /* fore */
 	VTE_DEF_BG, /* back */
 
-	0, /* fragment */
 	0, /* standout */
 	0, /* underline */
 	0, /* strikethrough */
diff --git a/src/vte.c b/src/vte.c
index 47cc74e..3ec7e20 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -522,7 +522,7 @@ find_start_column (VteTerminal *terminal, glong col, glong row)
 		return col;
 	if (row_data != NULL) {
 		const vtecell *cell = _vte_row_data_get (row_data, col);
-		while (cell != NULL && cell->attr.fragment && col > 0) {
+		while (cell != NULL && cell->c == FRAGMENT && col > 0) {
 			cell = _vte_row_data_get (row_data, --col);
 		}
 	}
@@ -537,7 +537,7 @@ find_end_column (VteTerminal *terminal, glong col, glong row)
 		return col;
 	if (row_data != NULL) {
 		const vtecell *cell = _vte_row_data_get (row_data, col);
-		while (cell != NULL && cell->attr.fragment && col > 0) {
+		while (cell != NULL && cell->c == FRAGMENT && col > 0) {
 			cell = _vte_row_data_get (row_data, --col);
 		}
 		if (cell) {
@@ -613,7 +613,7 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row)
 		const vtecell *cell;
 		cell = _vte_row_data_get (row_data, col);
 		if (cell != NULL) {
-			while (cell->attr.fragment && col> 0) {
+			while (cell->c == FRAGMENT && col> 0) {
 				cell = _vte_row_data_get (row_data, --col);
 			}
 			columns = cell->attr.columns;
@@ -2823,7 +2823,7 @@ _vte_terminal_cleanup_tab_fragments_at_cursor (VteTerminal *terminal)
 				 col);
 
 		/* go back to the beginning of the tab */
-		while (cell->attr.fragment && col > 0)
+		while (cell->c == FRAGMENT && col > 0)
 			cell = _vte_row_data_get_writable (row, --col);
 
 		num_columns = cell->attr.columns;
@@ -3025,7 +3025,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 			goto not_inserted;
 
 		/* Find the previous cell */
-		while (cell && cell->attr.fragment && col > 0)
+		while (cell && cell->c == FRAGMENT && col > 0)
 			cell = _vte_row_data_get_writable (row, --col);
 		if (G_UNLIKELY (!cell || cell->c == '\t'))
 			goto not_inserted;
@@ -3068,15 +3068,14 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 	if (G_LIKELY (col > 0)) {
 		glong col2 = col - 1;
 		vtecell *cell = _vte_row_data_get_writable (row, col2);
-		while (cell != NULL && cell->attr.fragment && col2 > 0)
+		while (cell != NULL && cell->c == FRAGMENT && col2 > 0)
 			cell = _vte_row_data_get_writable (row, --col2);
 		cell->attr.columns = col - col2;
 	}
 	{
 		glong col2 = col + columns;
 		vtecell *cell = _vte_row_data_get_writable (row, col2);
-		while (cell != NULL && cell->attr.fragment) {
-			cell->attr.fragment = 0;
+		while (cell != NULL && cell->c == FRAGMENT) {
 			cell->attr.columns = 1;
 			cell->c = 0;
 			cell = _vte_row_data_get_writable (row, ++col2);
@@ -3093,8 +3092,6 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 			/* restore previous contents */
 			c = pcell->c;
 			attr.columns = pcell->attr.columns;
-			attr.fragment = pcell->attr.fragment;
-
 			attr.underline = 1;
 		}
 	}
@@ -3108,10 +3105,9 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
 	}
 
 	/* insert wide-char fragments */
-	attr.fragment = 1;
 	for (i = 1; i < columns; i++) {
 		vtecell *pcell = _vte_row_data_get_writable (row, col);
-		pcell->c = c;
+		pcell->c = FRAGMENT;
 		pcell->attr = attr;
 		col++;
 	}
@@ -5789,7 +5785,7 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
 				/* If it's not part of a multi-column character,
 				 * and passes the selection criterion, add it to
 				 * the selection. */
-				if (!pcell->attr.fragment && is_selected(terminal, col, row, data)) {
+				if (pcell->c != FRAGMENT && is_selected(terminal, col, row, data)) {
 					/* Store the attributes of this character. */
 					fore = palette[pcell->attr.fore];
 					back = palette[pcell->attr.back];
@@ -5841,7 +5837,7 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
 				while ((pcell = _vte_row_data_get (row_data, col))) {
 					col++;
 
-					if (pcell->attr.fragment)
+					if (pcell->c == FRAGMENT)
 						continue;
 
 					if (pcell->c != 0)
@@ -6174,7 +6170,7 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
 		/* Find the last non-empty character on the first line. */
 		for (i = _vte_row_data_length (rowdata); i > 0; i--) {
 			cell = _vte_row_data_get (rowdata, i - 1);
-			if (cell->attr.fragment || cell->c != 0)
+			if (cell->c == FRAGMENT || cell->c != 0)
 				break;
 		}
 		/* If the start point is to its right, then move the
@@ -6202,7 +6198,7 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
 		/* Find the last non-empty character on the last line. */
 		for (i = _vte_row_data_length (rowdata); i > 0; i--) {
 			cell = _vte_row_data_get (rowdata, i - 1);
-			if (cell->attr.fragment || cell->c != 0)
+			if (cell->c == FRAGMENT || cell->c != 0)
 				break;
 		}
 		/* If the end point is to its right, then extend the
@@ -9933,7 +9929,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
 		if (row_data != NULL) {
 			cell = _vte_row_data_get (row_data, i);
 			if (cell != NULL) {
-				while (cell->attr.fragment && i > 0) {
+				while (cell->c == FRAGMENT && i > 0) {
 					cell = _vte_row_data_get (row_data, --i);
 				}
 			}
@@ -9958,7 +9954,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
 					/* Don't render fragments of multicolumn characters
 					 * which have the same attributes as the initial
 					 * portions. */
-					if (cell != NULL && cell->attr.fragment) {
+					if (cell != NULL && cell->c == FRAGMENT) {
 						j++;
 						continue;
 					}
@@ -10050,7 +10046,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
 		if (cell == NULL) {
 			goto fg_skip_row;
 		}
-		while (cell->attr.fragment && i > 0)
+		while (cell->c == FRAGMENT && i > 0)
 			cell = _vte_row_data_get (row_data, --i);
 
 		/* Walk the line. */
@@ -10064,7 +10060,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
 					(cell->c == ' ' &&
 					 !cell->attr.underline &&
 					 !cell->attr.strikethrough) ||
-					cell->attr.fragment) {
+					cell->c == FRAGMENT) {
 				if (++i >= end_column) {
 					goto fg_skip_row;
 				}
@@ -10129,7 +10125,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
 					/* Don't render blank cells or fragments of multicolumn characters
 					 * which have the same attributes as the initial
 					 * portions.  Don't render invisible cells */
-					if (cell->attr.fragment || cell->attr.invisible) {
+					if (cell->c == FRAGMENT || cell->attr.invisible) {
 						j++;
 						continue;
 					}
@@ -10231,7 +10227,7 @@ fg_next_row:
 					j = start_column;
 					cell = _vte_row_data_get (row_data, j);
 				} while (cell == NULL);
-				while (cell->attr.fragment && j > 0) {
+				while (cell->c == FRAGMENT && j > 0) {
 					cell = _vte_row_data_get (row_data, --j);
 				}
 			} while (TRUE);
@@ -10419,7 +10415,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
 
 	/* Find the character "under" the cursor. */
 	cell = vte_terminal_find_charcell(terminal, col, drow);
-	while ((cell != NULL) && (cell->attr.fragment) && (col > 0)) {
+	while ((cell != NULL) && (cell->c == FRAGMENT) && (col > 0)) {
 		col--;
 		cell = vte_terminal_find_charcell(terminal, col, drow);
 	}
diff --git a/src/vteseq.c b/src/vteseq.c
index 670db9d..026572e 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -2063,7 +2063,7 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
 			guint i;
 			for (i = _vte_row_data_length (rowdata); (glong) i > col; i--) {
 				cell = _vte_row_data_get (rowdata, i - 1);
-				if (cell->attr.fragment || cell->c != 0)
+				if (cell->c == FRAGMENT || cell->c != 0)
 					break;
 			}
 			_vte_row_data_shrink (rowdata, i);
@@ -2089,7 +2089,7 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
 		    _vte_row_data_append (rowdata, &cell);
 
 		    cell.attr = screen->fill_defaults.attr;
-		    cell.attr.fragment = 1;
+		    cell.c = FRAGMENT;
 		    _vte_row_data_fill (rowdata, &cell, newcol);
 		  }
 		else
@@ -2151,7 +2151,7 @@ vte_sequence_handler_uc (VteTerminal *terminal, GValueArray *params)
 	screen = terminal->pvt->screen;
 	column = screen->cursor_current.col;
 	cell = vte_terminal_find_charcell(terminal, column, screen->cursor_current.row);
-	while ((cell != NULL) && (cell->attr.fragment) && (column > 0)) {
+	while ((cell != NULL) && (cell->c == FRAGMENT) && (column > 0)) {
 		column--;
 		cell = vte_terminal_find_charcell(terminal, column, screen->cursor_current.row);
 	}



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