Only in geany-0.12pre/doc: geany.1
Only in geany-0.12pre: geany.desktop.in
diff -U4 -r geany-0.12pre/geany.glade geany-0.12pre-mine/geany.glade
--- geany-0.12pre/geany.glade	2007-09-11 20:35:29.000000000 +0200
+++ geany-0.12pre-mine/geany.glade	2007-09-17 22:18:29.000000000 +0200
@@ -1163,8 +1163,19 @@
 		    </widget>
 		  </child>
 
 		  <child>
+		    <widget class="GtkMenuItem" id="menu_remove_trailing_spaces">
+		      <property name="visible">True</property>
+		      <property name="tooltip" translatable="yes">Remove all trailing spaces in document.</property>
+		      <property name="label" translatable="yes">_Remove Trailing Spaces</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="on_re�mve_trailing_spaces_activate" last_modification_time="Mon, 17 Sep 2007 20:43:22 GMT"/>
+		    </widget>
+		  </child>
+
+
+		  <child>
 		    <widget class="GtkSeparatorMenuItem" id="separator22">
 		      <property name="visible">True</property>
 		    </widget>
 		  </child>
Only in geany-0.12pre-mine: geany.gladep.bak
Only in geany-0.12pre: geany.spec
diff -U4 -r geany-0.12pre/src/callbacks.c geany-0.12pre-mine/src/callbacks.c
--- geany-0.12pre/src/callbacks.c	2007-09-11 20:30:29.000000000 +0200
+++ geany-0.12pre-mine/src/callbacks.c	2007-09-17 22:24:13.000000000 +0200
@@ -849,8 +849,19 @@
 
 	document_replace_tabs(idx);
 }
 
+void
+on_remove_trailing_spaces_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+	gint idx = document_get_cur_idx();
+
+	document_remove_trailing_spaces(idx);
+}
+
+
+
 
 gboolean
 toolbar_popup_menu                     (GtkWidget *widget,
                                         GdkEventButton *event,
diff -U4 -r geany-0.12pre/src/callbacks.h geany-0.12pre-mine/src/callbacks.h
--- geany-0.12pre/src/callbacks.h	2007-09-11 20:30:29.000000000 +0200
+++ geany-0.12pre-mine/src/callbacks.h	2007-09-17 22:23:28.000000000 +0200
@@ -122,8 +122,12 @@
 on_replace_tabs_activate               (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
 void
+on_remove_trailing_spaces_activate     (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);
+
+void
 on_toolbutton18_clicked                (GtkToolButton   *toolbutton,
                                         gpointer         user_data);
 
 void
diff -U4 -r geany-0.12pre/src/document.c geany-0.12pre-mine/src/document.c
--- geany-0.12pre/src/document.c	2007-09-11 20:30:29.000000000 +0200
+++ geany-0.12pre-mine/src/document.c	2007-09-18 01:00:09.000000000 +0200
@@ -1998,8 +1998,36 @@
 	}
 	sci_end_undo_action(doc_list[idx].sci);
 }
 
+void document_remove_trailing_spaces(gint idx)
+{
+	gint linecount, current_line, current_pos, start_pos ;
+	gchar *empty_str;
+	
+	if (! DOC_IDX_VALID(idx)) return;
+	
+	sci_start_undo_action(doc_list[idx].sci);
+	empty_str = g_strnfill(0, ' '); 
+	linecount = sci_get_line_count(doc_list[idx].sci);
+
+	for (current_line = 0; current_line <= linecount ; current_line++)
+	{
+		current_pos = sci_get_line_end_position(doc_list[idx].sci, current_line) ;
+		sci_target_end(doc_list[idx].sci, current_pos); // going backwards from this position to something else than spaces
+		start_pos = current_pos -1 ; 
+		while ( (sci_get_char_at(doc_list[idx].sci, start_pos) == ' ') 
+			&& (current_line == sci_get_line_from_position(doc_list[idx].sci, start_pos)) )
+		{
+			start_pos = start_pos - 1;
+		}
+		sci_target_start(doc_list[idx].sci, start_pos + 1 );
+		sci_target_replace(doc_list[idx].sci, empty_str, FALSE); 
+	}
+	g_free(empty_str);
+	sci_end_undo_action(doc_list[idx].sci);
+}
+
 
 void document_strip_trailing_spaces(gint idx)
 {
 	gint max_lines = sci_get_line_count(doc_list[idx].sci);
diff -U4 -r geany-0.12pre/src/interface.c geany-0.12pre-mine/src/interface.c
--- geany-0.12pre/src/interface.c	2007-09-11 20:30:29.000000000 +0200
+++ geany-0.12pre-mine/src/interface.c	2007-09-17 22:43:16.000000000 +0200
@@ -168,8 +168,9 @@
   GtkWidget *lf;
   GtkWidget *cr;
   GtkWidget *separator8;
   GtkWidget *menu_replace_tabs;
+  GtkWidget *menu_remove_trailing_spaces;
   GtkWidget *separator22;
   GtkWidget *menu_fold_all1;
   GtkWidget *menu_unfold_all1;
   GtkWidget *separator23;
@@ -851,8 +852,13 @@
   gtk_widget_show (menu_replace_tabs);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), menu_replace_tabs);
   gtk_tooltips_set_tip (tooltips, menu_replace_tabs, _("Replaces all tabs in document by spaces."), NULL);
 
+  menu_remove_trailing_spaces = gtk_menu_item_new_with_mnemonic (_("_Remove Trailing Spaces"));
+  gtk_widget_show (menu_remove_trailing_spaces);
+  gtk_container_add (GTK_CONTAINER (menu_document1_menu), menu_remove_trailing_spaces);
+  gtk_tooltips_set_tip (tooltips, menu_remove_trailing_spaces, _("Removes all trailing spaces in document"), NULL);
+
   separator22 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator22);
   gtk_container_add (GTK_CONTAINER (menu_document1_menu), separator22);
   gtk_widget_set_sensitive (separator22, FALSE);
@@ -1463,8 +1469,11 @@
                     NULL);
   g_signal_connect ((gpointer) menu_replace_tabs, "activate",
                     G_CALLBACK (on_replace_tabs_activate),
                     NULL);
+  g_signal_connect ((gpointer) menu_remove_trailing_spaces, "activate",
+                    G_CALLBACK (on_remove_trailing_spaces_activate),
+                    NULL);
   g_signal_connect ((gpointer) menu_fold_all1, "activate",
                     G_CALLBACK (on_menu_fold_all1_activate),
                     NULL);
   g_signal_connect ((gpointer) menu_unfold_all1, "activate",
@@ -1730,8 +1739,9 @@
   GLADE_HOOKUP_OBJECT (window1, lf, "lf");
   GLADE_HOOKUP_OBJECT (window1, cr, "cr");
   GLADE_HOOKUP_OBJECT (window1, separator8, "separator8");
   GLADE_HOOKUP_OBJECT (window1, menu_replace_tabs, "menu_replace_tabs");
+  GLADE_HOOKUP_OBJECT (window1, menu_remove_trailing_spaces, "menu_remove_trailing_spaces");
   GLADE_HOOKUP_OBJECT (window1, separator22, "separator22");
   GLADE_HOOKUP_OBJECT (window1, menu_fold_all1, "menu_fold_all1");
   GLADE_HOOKUP_OBJECT (window1, menu_unfold_all1, "menu_unfold_all1");
   GLADE_HOOKUP_OBJECT (window1, separator23, "separator23");
diff -U4 -r geany-0.12pre/src/keybindings.c geany-0.12pre-mine/src/keybindings.c
--- geany-0.12pre/src/keybindings.c	2007-09-11 20:30:29.000000000 +0200
+++ geany-0.12pre-mine/src/keybindings.c	2007-09-17 21:11:18.000000000 +0200
@@ -1255,8 +1255,14 @@
 {
 	on_replace_tabs_activate(NULL, NULL);
 }
 
+static void cb_func_menu_removetrailingspaces(G_GNUC_UNUSED guint key_id)
+{
+	on_remove_trailing_spaces_activate(NULL, NULL);
+}
+
+
 static void cb_func_menu_insert_date(G_GNUC_UNUSED guint key_id)
 {
 	gtk_menu_item_activate(GTK_MENU_ITEM(lookup_widget(app->popup_menu, "insert_date_custom2")));
 }
