comparison src/gtkimhtml.c @ 9599:a1029432ae4a

[gaim-migrate @ 10442] Simguy writes: This makes the insert link behavior a little better: 1) If there is a selection in the IMHTML to which you are inserting a link, prefill the Description field in the dialog. 2) Delete the selected text and replace it with whatever the description field contains when inserting the link (this is why we do #1) The former behavior was to prepend the description entered to the selection and link the whole block, which seemed illogical to me. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Mon, 26 Jul 2004 06:09:11 +0000
parents fd32ae5ee373
children a11bc3f5c3e3
comparison
equal deleted inserted replaced
9598:0ad01d743f60 9599:a1029432ae4a
3767 3767
3768 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text) 3768 void gtk_imhtml_insert_link(GtkIMHtml *imhtml, GtkTextMark *mark, const char *url, const char *text)
3769 { 3769 {
3770 GtkTextIter iter; 3770 GtkTextIter iter;
3771 3771
3772 if (gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, NULL, NULL))
3773 gtk_text_buffer_delete_selection(imhtml->text_buffer, TRUE, TRUE);
3774
3772 gtk_imhtml_toggle_link(imhtml, url); 3775 gtk_imhtml_toggle_link(imhtml, url);
3773 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark); 3776 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark);
3774 gtk_text_buffer_insert(imhtml->text_buffer, &iter, text, -1); 3777 gtk_text_buffer_insert(imhtml->text_buffer, &iter, text, -1);
3775 gtk_imhtml_toggle_link(imhtml, NULL); 3778 gtk_imhtml_toggle_link(imhtml, NULL);
3776 } 3779 }