Hello people. I've made a small text editor, in which I want to insert markup. I used the GtkSourceView widget.
If there is a selection, I want to insert tags around the selection, and I'd like to remain the selection as it was. As I understand, this means I have to define right_gravity to the left tag, and left_gravity to the right one. This doesn't seem to make any difference... Left works, right tag always lands inside the selection. To be sure of the order of the tags, I even call gtk_text_iter_order. Can someone indicate my problem? John GtkTextIter start, end; GtkTextMark *start_mark, *end_mark; gboolean empty; char *p; empty = !gtk_text_buffer_get_selection_bounds(GTK_TEXT_BUFFER(src_bff), &start, &end); if (empty) { p = g_strdup_printf("%s%s", str1, str2); gtk_text_buffer_insert(GTK_TEXT_BUFFER(src_bff), &start, p, -1); g_free(p); } else { gtk_text_iter_order(&start, &end); start_mark = gtk_text_buffer_create_mark(GTK_TEXT_BUFFER(src_bff), NULL, &start, FALSE); end_mark = gtk_text_buffer_create_mark(GTK_TEXT_BUFFER(src_bff), NULL, &end, TRUE); gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(src_bff), &start, start_mark); gtk_text_buffer_insert(GTK_TEXT_BUFFER(src_bff), &start, str1, -1); gtk_text_buffer_get_iter_at_mark(GTK_TEXT_BUFFER(src_bff), &end, end_mark); gtk_text_buffer_insert(GTK_TEXT_BUFFER(src_bff), &end, str2, -1); } } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list