pidgin: 1699d9de: Fix reset-formatting for some cases.

sadrul at pidgin.im sadrul at pidgin.im
Fri Nov 20 03:01:16 EST 2009


-----------------------------------------------------------------
Revision: 1699d9de0276d31fa6c1d08622f4ee3720c8a34a
Ancestor: 15ba1c2b0820be77a0ce4020dfa081674817963d
Author: sadrul at pidgin.im
Date: 2009-11-20T08:02:10
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1699d9de0276d31fa6c1d08622f4ee3720c8a34a

Modified files:
        pidgin/gtkimhtml.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- pidgin/gtkimhtml.c	f9a8fb513256da8b7d3506a2d12aa5613786e693
+++ pidgin/gtkimhtml.c	cd8a58a6cf45aab382e8ad6c46d7cf86cdd24e0b
@@ -4306,9 +4306,11 @@ imhtml_clear_formatting(GtkIMHtml *imhtm
 
 	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);


More information about the Commits mailing list