# HG changeset patch # User Sadrul Habib Chowdhury # Date 1258704130 0 # Node ID c31707e63726c4869f5bf0372cd9e0939b19625e # Parent 38dd50309ba4e59265a0a3876a82f72a52565ab0 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. diff -r 38dd50309ba4 -r c31707e63726 pidgin/gtkimhtml.c --- 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);