# HG changeset patch # User Richard Laager # Date 1136822644 0 # Node ID e8db8f94a2dbaf4b3c4a071815769d4f9f8e75f4 # Parent ca114422782658838c6462dc944e92da32145033 [gaim-migrate @ 15143] (The Last) Part of SF Patch #1400162 from Sadrul "Do not change the format when the imhtml is not editable. Also, reset the formatting for the whole buffer when the imhtml has whole-buffer formatting on, or the selected text otherwise." Plus a change from me: If no text is selected, clear the formatting on the whole buffer. committer: Tailor Script diff -r ca1144227826 -r e8db8f94a2db src/gtkimhtml.c --- a/src/gtkimhtml.c Mon Jan 09 15:39:51 2006 +0000 +++ b/src/gtkimhtml.c Mon Jan 09 16:04:04 2006 +0000 @@ -3728,16 +3728,14 @@ { GtkTextIter start, end; - gtk_text_buffer_get_bounds(imhtml->text_buffer, &start, &end); - - /* Move the selection bounds (to select everything), so the format functions - * will know we want to manipulate the formatting on the entire buffer. */ -#if GTK_CHECK_VERSION(2,4,0) - gtk_text_buffer_select_range(imhtml->text_buffer, &end, &start); -#else - gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &end); - gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "selection_bound", &start); -#endif + if (!imhtml->editable) + return; + + 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); 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); @@ -3758,14 +3756,6 @@ imhtml->edit.forecolor = NULL; imhtml->edit.backcolor = NULL; imhtml->edit.background = NULL; - - /* Remove the selection, placing the cursor at the end. */ -#if GTK_CHECK_VERSION(2,4,0) - gtk_text_buffer_select_range(imhtml->text_buffer, &end, &end); -#else - gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &end); - gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "selection_bound", &end); -#endif } /* Editable stuff */