insert text in textview without moving selection

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

 



Hi,

Here is a scenario:
I have a textview with text in it. I select all the text with mouse.
Then, in my code, I insert text at the end of the text view.
What happens is that selection moves and includes the newly inserted
char. I understand that because after text is inserted, the iter of the
end of selection is updated to keep the end.

But I'd like the other behavior: selection doesn't move and doesn't
include the newly inserted char.

I did a workaround this way: before inserting, check if end of selection
== end_iter and set a flag.
After inserting, if flag is set, use gtk_text_buffer_select_range() with
a new iter that is end_iter-1.

I'd like to know if there is another way, less ugly, of doing such a thing.

Thanks for your help
-- 
Asterix
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux