diff -ur vte-0.34.7.orig/src/vte.c vte-0.34.7/src/vte.c
--- vte-0.34.7.orig/src/vte.c	2013-06-28 16:44:33.000000000 +0200
+++ vte-0.34.7/src/vte.c	2013-09-04 18:46:21.925871047 +0200
@@ -318,10 +318,6 @@
 #endif
 #endif /* GTK 3.0 */
 
-/* Indexes in the "palette" color array for the dim colors.
- * Only the first %VTE_LEGACY_COLOR_SET_SIZE colors have dim versions.  */
-static const guchar corresponding_dim_index[] = {16,88,28,100,18,90,30,102};
-
 static void
 vte_g_array_fill(GArray *array, gconstpointer item, guint final_size)
 {
@@ -373,6 +369,8 @@
 	screen->defaults = basic_cell.cell;
 	screen->color_defaults = screen->defaults;
 	screen->fill_defaults = screen->defaults;
+	screen->fg_sgr_extended = FALSE;
+	screen->bg_sgr_extended = FALSE;
 }
 
 /* Cause certain cells to be repainted. */
@@ -3290,8 +3288,8 @@
 	_vte_debug_print(VTE_DEBUG_PARSE,
 			"Inserting %ld '%c' (%d/%d) (%ld+%d, %ld), delta = %ld; ",
 			(long)c, c < 256 ? c : ' ',
-			screen->defaults.attr.fore,
-			screen->defaults.attr.back,
+			screen->color_defaults.attr.fore,
+			screen->color_defaults.attr.back,
 			col, columns, (long)screen->cursor_current.row,
 			(long)screen->insert_delta);
 
@@ -3396,6 +3394,8 @@
 	}
 
 	attr = screen->defaults.attr;
+	attr.fore = screen->color_defaults.attr.fore;
+	attr.back = screen->color_defaults.attr.back;
 	attr.columns = columns;
 
 	if (G_UNLIKELY (c == '_' && terminal->pvt->flags.ul)) {
@@ -9196,29 +9196,6 @@
 			back = VTE_DEF_FG;
 	}
 
-	/* Handle bold by using set bold color or brightening */
-	if (cell->attr.bold) {
-		if (fore == VTE_DEF_FG)
-			fore = VTE_BOLD_FG;
-		else if (fore < VTE_LEGACY_COLOR_SET_SIZE) {
-			fore += VTE_COLOR_BRIGHT_OFFSET;
-		}
-	}
-
-	/* Handle half similarly */
-	if (cell->attr.half) {
-		if (fore == VTE_DEF_FG)
-			fore = VTE_DIM_FG;
-		else if ((fore < VTE_LEGACY_COLOR_SET_SIZE))
-			fore = corresponding_dim_index[fore];
-	}
-
-	/* And standout */
-	if (cell->attr.standout) {
-		if (back < VTE_LEGACY_COLOR_SET_SIZE)
-			back += VTE_COLOR_BRIGHT_OFFSET;
-	}
-
 	/* Reverse cell? */
 	if (cell->attr.reverse) {
 		swap (&fore, &back);
@@ -11079,8 +11056,8 @@
 				row * height + terminal->pvt->inner_border.top,
 				width * columns,
 				height);
-		fore = screen->defaults.attr.fore;
-		back = screen->defaults.attr.back;
+		fore = screen->color_defaults.attr.fore;
+		back = screen->color_defaults.attr.back;
 		vte_terminal_draw_cells_with_attributes(terminal,
 							items, len,
 							terminal->pvt->im_preedit_attrs,
diff -ur vte-0.34.7.orig/src/vte-private.h vte-0.34.7/src/vte-private.h
--- vte-0.34.7.orig/src/vte-private.h	2013-06-28 16:44:33.000000000 +0200
+++ vte-0.34.7/src/vte-private.h	2013-09-04 19:17:40.473792046 +0200
@@ -227,14 +227,19 @@
 		long insert_delta;	/* insertion offset */
 		VteCell defaults;	/* default characteristics
 					   for insertion of any new
-					   characters */
+					   characters; colors not yet
+					   adjusted for bold/dim/standout */
 		VteCell color_defaults;	/* original defaults
 					   plus the current
-					   fore/back */
+					   fore/back already adjusted for
+					   bold/dim/standout */
 		VteCell fill_defaults;	/* original defaults
 					   plus the current
-					   fore/back with no
+					   fore/back already adjusted for
+					   bold/dim/standout with no
 					   character data */
+		gboolean fg_sgr_extended, bg_sgr_extended;	/* whether fg/bg were set by
+								   256 color sequences */
 		gboolean alternate_charset;
 		gboolean status_line;
 		GString *status_line_contents;
diff -ur vte-0.34.7.orig/src/vteseq.c vte-0.34.7/src/vteseq.c
--- vte-0.34.7.orig/src/vteseq.c	2013-06-28 16:44:33.000000000 +0200
+++ vte-0.34.7/src/vteseq.c	2013-09-04 18:57:03.249844077 +0200
@@ -493,6 +493,53 @@
 }
 
 
+/* Indexes in the "palette" color array for the dim colors.
+ * Only the first %VTE_LEGACY_COLOR_SET_SIZE colors have dim versions.  */
+static const guchar corresponding_dim_index[] = {16,88,28,100,18,90,30,102};
+
+static void
+vte_adjust_colors(VteTerminal *terminal)
+{
+	guint fore, back;
+
+	fore = terminal->pvt->screen->defaults.attr.fore;
+	back = terminal->pvt->screen->defaults.attr.back;
+
+	/* Handle bold by using set bold color or brightening */
+	if (terminal->pvt->screen->defaults.attr.bold) {
+		if (fore == VTE_DEF_FG) {
+			fore = VTE_BOLD_FG;
+		} else if (!terminal->pvt->screen->fg_sgr_extended
+			  && fore < VTE_LEGACY_COLOR_SET_SIZE) {
+				fore += VTE_COLOR_BRIGHT_OFFSET;
+		}
+	}
+
+	/* Handle half similarly */
+	if (terminal->pvt->screen->defaults.attr.half) {
+		if (fore == VTE_DEF_FG) {
+			fore = VTE_DIM_FG;
+		} else if (!terminal->pvt->screen->fg_sgr_extended
+			  && fore < VTE_LEGACY_COLOR_SET_SIZE) {
+			fore = corresponding_dim_index[fore];
+		}
+	}
+
+	/* And standout */
+	if (terminal->pvt->screen->defaults.attr.standout) {
+		if (!terminal->pvt->screen->bg_sgr_extended
+		  && back < VTE_LEGACY_COLOR_SET_SIZE) {
+			back += VTE_COLOR_BRIGHT_OFFSET;
+		}
+	}
+
+	/* Save the adjusted colors. */
+	terminal->pvt->screen->color_defaults.attr.fore = fore;
+	terminal->pvt->screen->color_defaults.attr.back = back;
+	terminal->pvt->screen->fill_defaults.attr.fore = fore;
+	terminal->pvt->screen->fill_defaults.attr.back = back;
+}
+
 /*
  * Sequence handling boilerplate
  */
@@ -2348,6 +2395,7 @@
 		case 35:
 		case 36:
 		case 37:
+			terminal->pvt->screen->fg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.fore = param - 30;
 			break;
 		case 38:
@@ -2363,14 +2411,17 @@
 					break;
 				param1 = g_value_get_long(value1);
 				param2 = g_value_get_long(value2);
-				if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
+				if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256)) {
+					terminal->pvt->screen->fg_sgr_extended = TRUE;
 					terminal->pvt->screen->defaults.attr.fore = param2;
+				}
 				i += 2;
 			}
 			break;
 		}
 		case 39:
 			/* default foreground */
+			terminal->pvt->screen->fg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.fore = VTE_DEF_FG;
 			break;
 		case 40:
@@ -2381,6 +2432,7 @@
 		case 45:
 		case 46:
 		case 47:
+			terminal->pvt->screen->bg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.back = param - 40;
 			break;
 		case 48:
@@ -2396,14 +2448,17 @@
 					break;
 				param1 = g_value_get_long(value1);
 				param2 = g_value_get_long(value2);
-				if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
+				if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256)) {
+					terminal->pvt->screen->bg_sgr_extended = TRUE;
 					terminal->pvt->screen->defaults.attr.back = param2;
+				}
 				i += 2;
 			}
 			break;
 		}
 		case 49:
 			/* default background */
+			terminal->pvt->screen->bg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.back = VTE_DEF_BG;
 			break;
 		case 90:
@@ -2414,6 +2469,7 @@
 		case 95:
 		case 96:
 		case 97:
+			terminal->pvt->screen->fg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.fore = param - 90 + VTE_COLOR_BRIGHT_OFFSET;
 			break;
 		case 100:
@@ -2424,6 +2480,7 @@
 		case 105:
 		case 106:
 		case 107:
+			terminal->pvt->screen->bg_sgr_extended = FALSE;
 			terminal->pvt->screen->defaults.attr.back = param - 100 + VTE_COLOR_BRIGHT_OFFSET;
 			break;
 		}
@@ -2433,14 +2490,7 @@
 		_vte_terminal_set_default_attributes(terminal);
 	}
 	/* Save the new colors. */
-	terminal->pvt->screen->color_defaults.attr.fore =
-		terminal->pvt->screen->defaults.attr.fore;
-	terminal->pvt->screen->color_defaults.attr.back =
-		terminal->pvt->screen->defaults.attr.back;
-	terminal->pvt->screen->fill_defaults.attr.fore =
-		terminal->pvt->screen->defaults.attr.fore;
-	terminal->pvt->screen->fill_defaults.attr.back =
-		terminal->pvt->screen->defaults.attr.back;
+	vte_adjust_colors(terminal);
 }
 
 /* Move the cursor to the given column, 1-based. */
