GtkTextMark right gravity



I am trying to mark a section of text within a GtkTextBuffer and then later retrieve the text along with any changes made within the section. I have done the following:

   /* mark the section */
   start_mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, TRUE);
   gtk_text_buffer_insert(buffer, &iter, "Hello, this is some text", -1);
   end_mark = gtk_text_buffer_create_mark(buffer, NULL, &iter, FALSE);
/* here is some more text */ gtk_text_buffer_insert(buffer, &iter, "some more text", -1);

   /* retrieve the section */
   gtk_text_buffer_get_iter_at_mark(buffer, &start, start_mark);
   gtk_text_buffer_get_iter_at_mark(buffer, &end, end_mark);
   text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);

When I get the text the "some more text" text is included if end_mark has left gravity set to false, but it is not included if end_mark has left gravity set to true. I want end_mark to be right gravity as I want insertions at the end of the section to remain within the marked section.

Is this a bug or am I doing something wrong?

I have a small working test case if that helps.

--
Darryl Ross
Principal Consultant, Dazco Technology ABN: 58 829 870 455
+61 3 9734 2466 http://www.dazco.com.au




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]