Index: vte.c
===================================================================
RCS file: /cvs/gnome/vte/src/vte.c,v
retrieving revision 1.402
diff -u -p -r1.402 vte.c
--- vte.c	30 Apr 2004 06:06:44 -0000	1.402
+++ vte.c	30 Apr 2004 08:42:24 -0000
@@ -477,7 +477,8 @@ static char *vte_terminal_get_text_range
 									      glong,
 									      gpointer),
 						       gpointer data,
-						       GArray *attributes);
+						       GArray *attributes,
+						       gboolean include_trailing_spaces);
 static char *vte_terminal_get_text_maybe_wrapped(VteTerminal *terminal,
 						 gboolean wrap,
 						 gboolean(*is_selected)(VteTerminal *,
@@ -485,7 +486,8 @@ static char *vte_terminal_get_text_maybe
 									glong,
 									gpointer),
 						 gpointer data,
-						 GArray *attributes);
+						 GArray *attributes,
+						 gboolean include_trailing_spaces);
 static void _vte_terminal_disconnect_pty_read(VteTerminal *terminal);
 static void _vte_terminal_disconnect_pty_write(VteTerminal *terminal);
 
@@ -9203,7 +9205,8 @@ vte_terminal_get_text_range(VteTerminal 
 							 TRUE,
 							 is_selected,
 							 data,
-							 attributes);
+							 attributes,
+							 FALSE);
 }
 
 static char *
@@ -9216,7 +9219,8 @@ vte_terminal_get_text_range_maybe_wrappe
 								 glong,
 								 gpointer),
 					  gpointer data,
-					  GArray *attributes)
+					  GArray *attributes,
+					  gboolean include_trailing_spaces)
 {
 	long col, row, last_space, last_spacecol,
 	     last_nonspace, last_nonspacecol, line_start;
@@ -9323,7 +9327,8 @@ vte_terminal_get_text_range_maybe_wrappe
 			/* If pcell is NULL, then there was no printing
 			 * character to the right of the endpoint, so truncate
 			 * the string at the end of the printing chars. */
-			if (pcell == NULL) {
+			if (pcell == NULL &&
+			    !include_trailing_spaces) {
 				g_string_truncate(string, last_nonspace + 1);
 			}
 		}
@@ -9386,7 +9391,8 @@ vte_terminal_get_text_maybe_wrapped(VteT
 							   glong,
 							   gpointer),
 				    gpointer data,
-				    GArray *attributes)
+				    GArray *attributes,
+				    gboolean include_trailing_spaces)
 {
 	long start_row, start_col, end_row, end_col;
 	start_row = terminal->pvt->screen->scroll_delta;
@@ -9401,7 +9407,8 @@ vte_terminal_get_text_maybe_wrapped(VteT
 							 is_selected :
 							 always_selected,
 							 data,
-							 attributes);
+							 attributes,
+                                                         include_trailing_spaces);
 }
 
 /**
@@ -9435,7 +9442,45 @@ vte_terminal_get_text(VteTerminal *termi
 						   is_selected :
 						   always_selected,
 						   data,
-						   attributes);
+						   attributes,
+                                                   FALSE);
+}
+
+/**
+ * vte_terminal_get_text_include_trailing_spaces:
+ * @terminal: a #VteTerminal
+ * @is_selected: a callback
+ * @data: user data to be passed to the callback
+ * @attributes: location for storing text attributes
+ *
+ * Extracts a view of the visible part of the terminal.  If @is_selected is not
+ * NULL, characters will only be read if @is_selected returns TRUE after being
+ * passed the column and row, respectively.  A #VteCharAttributes structure
+ * is added to @attributes for each byte added to the returned string detailing
+ * the character's position, colors, and other characteristics. This function
+ * differs from vte_terminal_get_text in that trailing spaces at the end of
+ * lines are included.
+ *
+ * Returns: a text string which must be freed by the caller, or NULL.
+ */
+char *
+vte_terminal_get_text_include_trailing_spaces(VteTerminal *terminal,
+		      gboolean(*is_selected)(VteTerminal *,
+					     glong,
+					     glong,
+					     gpointer),
+		      gpointer data,
+		      GArray *attributes)
+{
+	g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+	return vte_terminal_get_text_maybe_wrapped(terminal,
+						   TRUE,
+						   is_selected ?
+						   is_selected :
+						   always_selected,
+						   data,
+						   attributes,
+                                                   TRUE);
 }
 
 /**
Index: vte.h
===================================================================
RCS file: /cvs/gnome/vte/src/vte.h,v
retrieving revision 1.77
diff -u -p -r1.77 vte.h
--- vte.h	30 Apr 2004 01:16:53 -0000	1.77
+++ vte.h	30 Apr 2004 08:42:24 -0000
@@ -336,6 +336,13 @@ char *vte_terminal_get_text(VteTerminal 
 						   gpointer data),
 			    gpointer data,
 			    GArray *attributes);
+char *vte_terminal_get_text_include_trailing_spaces(VteTerminal *terminal,
+			    gboolean(*is_selected)(VteTerminal *terminal,
+						   glong column,
+						   glong row,
+						   gpointer data),
+			    gpointer data,
+			    GArray *attributes);
 char *vte_terminal_get_text_range(VteTerminal *terminal,
 				  glong start_row, glong start_col,
 				  glong end_row, glong end_col,
Index: vteaccess.c
===================================================================
RCS file: /cvs/gnome/vte/src/vteaccess.c,v
retrieving revision 1.43
diff -u -p -r1.43 vteaccess.c
--- vteaccess.c	12 Aug 2003 13:17:33 -0000	1.43
+++ vteaccess.c	30 Apr 2004 08:42:24 -0000
@@ -345,7 +345,7 @@ vte_terminal_accessible_update_private_d
 		priv->snapshot_linebreaks = g_array_new(FALSE, TRUE, sizeof(int));
 
 		/* Get a new view of the uber-label. */
-		tmp = vte_terminal_get_text(terminal,
+		tmp = vte_terminal_get_text_include_trailing_spaces(terminal,
 					    all_selected,
 					    NULL,
 					    priv->snapshot_attributes);
