All, I was implementing block comments in a Text/Sourceview Buffer in a function that is passed start and end iters representing the selection bounds, e.g.
void buffer_comment_lines (kwinst *app, GtkTextIter *start, GtkTextIter *end) { (full code at) https://github.com/drankinatty/gtkwrite/blob/master/gtk_filebuf.c#L518 Within the function I create a start_mark and end_mark to revalidate the text iterator throughout the function and before control is returned to the caller. The start_mark is created with LEFT-gravity so when the comment syntax is inserted at the beginning of the selection, the mark remains to the left of the inserted text expanding the selection bounds to contain the newly inserted opening comment string, e.g. /* preserve marks for start/end to revalidate iterators before return * using left gravity on start to mark stays left of inserted text. */ start_mark = gtk_text_buffer_create_mark (buffer, NULL, start, TRUE); end_mark = gtk_text_buffer_create_mark (buffer, NULL, end, FALSE); Prior to the end of the function, the start/end iterators are revalidated and the selection is remade between the start/end iterators to insure when the function returns the selection encompasses the block comment syntax as well as the commented text so if the user chooses, has a change of mind, whatever, they can 'uncomment' without having to touch the keyboard or mouse to adjust the selection, e.g. /* revalidate iters */ gtk_text_buffer_get_iter_at_mark (buffer, start, start_mark); gtk_text_buffer_get_iter_at_mark (buffer, end, end_mark); /* extend selection to cover new comment syntax (for uncomment) */ gtk_text_buffer_select_range (buffer, end, start); This works perfectly when compiled and run under Linux, but fails to include the opening syntax for the block comment when compiled/run under windoze. Instead the `start` iter behaves as if it has RIGHT-gravity and is outside of the selection when the function ends. I have even manually set the iter to the beginning of the line with: gtk_text_iter_set_line_offset (start, 0); But still the selection is not adjusted in windows as all. Is this a problem with gtk select_range under windows, or just the result of windows selection being something gtk cannot interface with given the different windows API? -- David C. Rankin, J.D.,P.E. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list