--- vte-0.36.3-old/src/vterowdata.h	2014-07-10 12:27:10.961856172 -0400
+++ vte-0.36.3/src/vterowdata.h	2014-07-16 17:15:13.059835161 -0400
@@ -32,8 +32,9 @@
 #define VTE_DIM_FG			259
 #define VTE_HIGHLIGHT_FG		260
 #define VTE_HIGHLIGHT_BG		261
-#define VTE_CURSOR_BG			262
-#define VTE_PALETTE_SIZE		263
+#define VTE_CURSOR_FG			262
+#define VTE_CURSOR_BG			263
+#define VTE_PALETTE_SIZE		264
 
 
 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
--- vte-0.36.3-old/src/vte.c	2014-07-10 12:27:10.966856172 -0400
+++ vte-0.36.3/src/vte.c	2014-07-16 17:08:35.897972166 -0400
@@ -2483,7 +2483,7 @@
 /*
  * Get the actually used color from the palette.
  * The return value can be NULL only if entry is one of VTE_CURSOR_BG,
- * VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG.
+ * VTE_CURSOR_FG, VTE_HIGHLIGHT_BG or VTE_HIGHLIGHT_FG.
  */
 PangoColor *
 _vte_terminal_get_color(const VteTerminal *terminal, int entry)
@@ -2547,7 +2547,7 @@
 	}
 
 	/* and redraw */
-	if (entry == VTE_CURSOR_BG)
+	if (entry == VTE_CURSOR_BG || entry == VTE_CURSOR_FG)
 		_vte_invalidate_cursor_once(terminal, FALSE);
 	else
 		_vte_invalidate_all (terminal);
@@ -2685,9 +2685,9 @@
  * @terminal: a #VteTerminal
  * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
  *
- * Sets the background color for text which is under the cursor.  If %NULL, text
- * under the cursor will be drawn with foreground and background colors
- * reversed.
+ * Sets the background color for text which is under the cursor.  If %NULL,
+ * it is unset.  If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors reversed.
  *
  * Since: 0.11.11
  */
@@ -2699,18 +2699,48 @@
 
 	if (cursor_background != NULL) {
 		_vte_debug_print(VTE_DEBUG_MISC,
-				"Set cursor color to (%04x,%04x,%04x).\n",
+				"Set cursor background color to (%04x,%04x,%04x).\n",
 				cursor_background->red,
 				cursor_background->green,
 				cursor_background->blue);
 	} else {
 		_vte_debug_print(VTE_DEBUG_MISC,
-				"Reset cursor color.\n");
+				"Reset cursor background color.\n");
 	}
 	_vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
 }
 
 /**
+ * vte_terminal_set_color_cursor_foreground:
+ * @terminal: a #VteTerminal
+ * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL
+ *
+ * Sets the foreground color for text which is under the cursor.  If %NULL,
+ * it is unset.  If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors reversed.
+ *
+ * Since: 0.11.11
+ */
+void
+vte_terminal_set_color_cursor_foreground(VteTerminal *terminal,
+			      const GdkColor *cursor_foreground)
+{
+	g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+	if (cursor_foreground != NULL) {
+		_vte_debug_print(VTE_DEBUG_MISC,
+				"Set cursor foreground color to (%04x,%04x,%04x).\n",
+				cursor_foreground->red,
+				cursor_foreground->green,
+				cursor_foreground->blue);
+	} else {
+		_vte_debug_print(VTE_DEBUG_MISC,
+				"Reset cursor foreground color.\n");
+	}
+	_vte_terminal_set_color_internal(terminal, VTE_CURSOR_FG, VTE_COLOR_SOURCE_API, cursor_foreground);
+}
+
+/**
  * vte_terminal_set_color_highlight:
  * @terminal: a #VteTerminal
  * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
@@ -2896,6 +2926,9 @@
 			case VTE_CURSOR_BG:
 				unset = TRUE;
 				break;
+			case VTE_CURSOR_FG:
+				unset = TRUE;
+				break;
 			}
 
 		/* Override from the supplied palette if there is one. */
@@ -3028,9 +3061,9 @@
  * @terminal: a #VteTerminal
  * @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
  *
- * Sets the background color for text which is under the cursor.  If %NULL, text
- * under the cursor will be drawn with foreground and background colors
- * reversed.
+ * Sets the background color for text which is under the cursor.  If %NULL,
+ * it is unset.  If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors reversed.
  *
  * Since: 0.28
  */
@@ -3045,6 +3078,27 @@
 }
 
 /**
+ * vte_terminal_set_color_cursor_foreground_rgba:
+ * @terminal: a #VteTerminal
+ * @cursor_foreground: (allow-none): the new color to use for the text cursor, or %NULL
+ *
+ * Sets the foreground color for text which is under the cursor.  If %NULL,
+ * it is unset.  If neither cursor background nor cursor foreground are set,
+ * text under the cursor will be drawn with foreground and background colors reversed.
+ *
+ * Since: 0.28
+ */
+void
+vte_terminal_set_color_cursor_foreground_rgba(VteTerminal *terminal,
+				   const GdkRGBA *cursor_foreground)
+{
+        GdkColor color;
+
+	vte_terminal_set_color_cursor_foreground(terminal,
+                                      gdk_color_from_rgba(&color, cursor_foreground));
+}
+
+/**
  * vte_terminal_set_color_highlight_rgba:
  * @terminal: a #VteTerminal
  * @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
@@ -9416,12 +9470,19 @@
 			swap (&fore, &back);
 	}
 
-	/* Cursor: use cursor back, or inverse */
+	/* Cursor: use cursor back/fore, or inverse */
 	if (cursor) {
 		/* XXX what if cursor back is same color as current back? */
-		if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL)
+		gboolean do_swap = TRUE;
+		if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL) {
 			back = VTE_CURSOR_BG;
-		else
+			do_swap = FALSE;
+		}
+		if (_vte_terminal_get_color(terminal, VTE_CURSOR_FG) != NULL) {
+			fore = VTE_CURSOR_FG;
+			do_swap = FALSE;
+		}
+		if (do_swap)
 			swap (&fore, &back);
 	}
 
--- vte-0.36.3-old/src/vte.h	2014-07-10 12:27:10.972856172 -0400
+++ vte-0.36.3/src/vte.h	2014-07-16 17:09:48.375124570 -0400
@@ -267,6 +267,8 @@
 				       const GdkColor *background);
 void vte_terminal_set_color_cursor(VteTerminal *terminal,
 				   const GdkColor *cursor_background);
+void vte_terminal_set_color_cursor_foreground(VteTerminal *terminal,
+				   const GdkColor *cursor_foreground);
 void vte_terminal_set_color_highlight(VteTerminal *terminal,
 				      const GdkColor *highlight_background);
 void vte_terminal_set_color_highlight_foreground(VteTerminal *terminal,
@@ -287,6 +289,8 @@
 					    const GdkRGBA *background);
 void vte_terminal_set_color_cursor_rgba(VteTerminal *terminal,
 					const GdkRGBA *cursor_background);
+void vte_terminal_set_color_cursor_foreground_rgba(VteTerminal *terminal,
+					const GdkRGBA *cursor_foreground);
 void vte_terminal_set_color_highlight_rgba(VteTerminal *terminal,
 					   const GdkRGBA *highlight_background);
 void vte_terminal_set_color_highlight_foreground_rgba(VteTerminal *terminal,
--- vte-0.36.3-old/src/vteseq.c	2014-07-10 12:27:10.968856172 -0400
+++ vte-0.36.3/src/vteseq.c	2014-07-16 17:12:46.424504846 -0400
@@ -3628,7 +3628,7 @@
 
 /* Change the color of the cursor, BEL terminated */
 static void
-vte_sequence_handler_change_cursor_color_bel (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_background_color_bel (VteTerminal *terminal, GValueArray *params)
 {
 	vte_sequence_handler_change_special_color_internal (terminal, params,
 							    VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, BEL);
@@ -3636,7 +3636,7 @@
 
 /* Change the color of the cursor, ST terminated */
 static void
-vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_cursor_background_color_st (VteTerminal *terminal, GValueArray *params)
 {
 	vte_sequence_handler_change_special_color_internal (terminal, params,
 							    VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, ST);
@@ -3644,11 +3644,34 @@
 
 /* Reset the color of the cursor */
 static void
-vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_reset_cursor_background_color (VteTerminal *terminal, GValueArray *params)
 {
 	_vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
 }
 
+/* Change the color of the cursor, BEL terminated */
+static void
+vte_sequence_handler_change_cursor_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+	vte_sequence_handler_change_special_color_internal (terminal, params,
+							    VTE_CURSOR_FG, VTE_DEFAULT_BG, 12, BEL);
+}
+
+/* Change the color of the cursor, ST terminated */
+static void
+vte_sequence_handler_change_cursor_foreground_color_st (VteTerminal *terminal, GValueArray *params)
+{
+	vte_sequence_handler_change_special_color_internal (terminal, params,
+							    VTE_CURSOR_FG, VTE_DEFAULT_BG, 12, ST);
+}
+
+/* Reset the color of the cursor */
+static void
+vte_sequence_handler_reset_cursor_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+	_vte_terminal_set_color_internal(terminal, VTE_CURSOR_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
 /* Change the highlight background color, BEL terminated */
 static void
 vte_sequence_handler_change_highlight_background_color_bel (VteTerminal *terminal, GValueArray *params)
--- vte-0.36.3-old/src/vteseq-n.gperf	2014-07-10 12:27:10.960856172 -0400
+++ vte-0.36.3/src/vteseq-n.gperf	2014-07-16 17:13:36.338615580 -0400
@@ -79,9 +79,12 @@
 #"end-of-guarded-area", VTE_SEQUENCE_HANDLER_NULL
 "utf-8-character-set", VTE_SEQUENCE_HANDLER(vte_sequence_handler_utf_8_charset)
 "window-manipulation", VTE_SEQUENCE_HANDLER(vte_sequence_handler_window_manipulation)
-"change-cursor-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_bel)
-"change-cursor-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_st)
-"reset-cursor-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_color)
+"change-cursor-background-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_background_color_bel)
+"change-cursor-background-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_background_color_st)
+"reset-cursor-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_background_color)
+"change-cursor-foreground-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_foreground_color_bel)
+"change-cursor-foreground-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_foreground_color_st)
+"reset-cursor-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_foreground_color)
 "character-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_attributes)
 "device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_device_status_report)
 "set-scrolling-region", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_scrolling_region)
--- vte-0.36.3-old/src/caps.c	2014-07-10 12:27:10.969856172 -0400
+++ vte-0.36.3/src/caps.c	2014-07-16 17:18:22.505283749 -0400
@@ -528,7 +528,7 @@
         {OSC "7;%s" BEL, "set-current-directory-uri", 0},
 	{OSC "10;%s" BEL, "change-foreground-colors-bel", 0},
 	{OSC "11;%s" BEL, "change-background-colors-bel", 0},
-	{OSC "12;%s" BEL, "change-cursor-colors-bel", 0},
+	{OSC "12;%s" BEL, "change-cursor-background-colors-bel", 0},
 	{OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors-bel", 0},
 	{OSC "14;%s" BEL, "change-mouse-cursor-background-colors-bel", 0},
 	{OSC "15;%s" BEL, "change-tek-foreground-colors-bel", 0},
@@ -536,6 +536,7 @@
 	{OSC "17;%s" BEL, "change-highlight-background-colors-bel", 0},
 	{OSC "18;%s" BEL, "change-tek-cursor-colors-bel", 0},
 	{OSC "19;%s" BEL, "change-highlight-foreground-colors-bel", 0},
+	{OSC "20;%s" BEL, "change-cursor-foreground-colors-bel", 0},
 	{OSC "46;%s" BEL, "change-logfile", 0},
 	{OSC "50;#%d" BEL, "change-font-number", 0},
 	{OSC "50;%s" BEL, "change-font-name", 0},
@@ -543,7 +544,7 @@
 	{OSC "104;%m" BEL, "reset-color", 0},
 	{OSC "110" BEL, "reset-foreground-colors", 0},
 	{OSC "111" BEL, "reset-background-colors", 0},
-	{OSC "112" BEL, "reset-cursor-colors", 0},
+	{OSC "112" BEL, "reset-cursor-background-colors", 0},
 	{OSC "113" BEL, "reset-mouse-cursor-foreground-colors", 0},
 	{OSC "114" BEL, "reset-mouse-cursor-background-colors", 0},
 	{OSC "115" BEL, "reset-tek-foreground-colors", 0},
@@ -551,6 +552,7 @@
 	{OSC "117" BEL, "reset-highlight-background-colors", 0},
 	{OSC "118" BEL, "reset-tek-cursor-colors", 0},
 	{OSC "119" BEL, "reset-highlight-foreground-colors", 0},
+	{OSC "120" BEL, "reset-cursor-foreground-colors", 0},
 
 	/* Set text parameters, ST-terminated versions. */
 	{OSC ";%s" ST, "set-icon-and-window-title", 0}, /* undocumented default */
@@ -563,7 +565,7 @@
         {OSC "7;%s" ST, "set-current-directory-uri", 0},
 	{OSC "10;%s" ST, "change-foreground-colors-st", 0},
 	{OSC "11;%s" ST, "change-background-colors-st", 0},
-	{OSC "12;%s" ST, "change-cursor-colors-st", 0},
+	{OSC "12;%s" ST, "change-cursor-background-colors-st", 0},
 	{OSC "13;%s" ST, "change-mouse-cursor-foreground-colors-st", 0},
 	{OSC "14;%s" ST, "change-mouse-cursor-background-colors-st", 0},
 	{OSC "15;%s" ST, "change-tek-foreground-colors-st", 0},
@@ -571,6 +573,7 @@
 	{OSC "17;%s" ST, "change-highlight-background-colors-st", 0},
 	{OSC "18;%s" ST, "change-tek-cursor-colors-st", 0},
 	{OSC "19;%s" ST, "change-highlight-foreground-colors-st", 0},
+	{OSC "20;%s" ST, "change-cursor-foreground-colors-st", 0},
 	{OSC "46;%s" ST, "change-logfile", 0},
 	{OSC "50;#%d" ST, "change-font-number", 0},
 	{OSC "50;%s" ST, "change-font-name", 0},
@@ -578,7 +581,7 @@
 	{OSC "104;%m" ST, "reset-color", 0},
 	{OSC "110" ST, "reset-foreground-colors", 0},
 	{OSC "111" ST, "reset-background-colors", 0},
-	{OSC "112" ST, "reset-cursor-colors", 0},
+	{OSC "112" ST, "reset-cursor-background-colors", 0},
 	{OSC "113" ST, "reset-mouse-cursor-foreground-colors", 0},
 	{OSC "114" ST, "reset-mouse-cursor-background-colors", 0},
 	{OSC "115" ST, "reset-tek-foreground-colors", 0},
@@ -586,6 +589,7 @@
 	{OSC "117" ST, "reset-highlight-background-colors", 0},
 	{OSC "118" ST, "reset-tek-cursor-colors", 0},
 	{OSC "119" ST, "reset-highlight-foreground-colors", 0},
+	{OSC "120" ST, "reset-cursor-foreground-colors", 0},
 
 	/* These may be bogus, I can't find docs for them anywhere (#104154). */
 	{OSC "21;%s" BEL, "set-text-property-21", 0},
