changeset 28979:c31707e63726

Fix reset-formatting for some cases. When 'wbfo' (whole buffer formatting only) is set for an imhtml: - always reset formatting of all the text in the imhtml When 'wbfo' is not set: - if some text is selected, reset formatting for the selected text - if no text is selected, reset formatting for the current location (insert) only, and leave the rest of the text alone. We were doing this last thing wrong. Fixes #4499.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 20 Nov 2009 08:02:10 +0000
parents 38dd50309ba4
children 998c37689f7c
files pidgin/gtkimhtml.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Fri Nov 20 06:23:23 2009 +0000
+++ b/pidgin/gtkimhtml.c	Fri Nov 20 08:02:10 2009 +0000
@@ -4306,9 +4306,11 @@
 
 	if (imhtml->wbfo)
 		gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
-	else
-		if (!gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end))
-			gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end);
+	else if (!gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) {
+		GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer);
+		gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &start, mark);
+		end = start;
+	}
 
 	gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "BOLD", &start, &end);
 	gtk_text_buffer_remove_tag_by_name(imhtml->text_buffer, "ITALICS", &start, &end);