Mercurial > pidgin.yaz
changeset 12796:e8db8f94a2db
[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 <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 09 Jan 2006 16:04:04 +0000 |
parents | ca1144227826 |
children | eda1572c788b |
files | src/gtkimhtml.c |
diffstat | 1 files changed, 8 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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 */