Selecting words in textbuffer



Because I'm just learning how to use textbuffer, I may be missing the
correct solution to my problem.  I want to be able to sweep a selection of
several words without having to hit the beginning and end of the words
exactly.  I found textiter.backward_word_start() and
textiter.forward_word_end() for adjusting the textiters that bound the
selection and select_range() for selecting the entire selection once the
textiters have been adjusted.  My problem is that I need a trigger that
invokes the code for making the adjustment.  My current solution hooks
button release.  It works, but it catches too much.  The next thing I do
after making the selection is to drag it to an entry.  When I release the
button at the end of the drag, the code for widening the selection is
invoked again.  I can suppress the second invocation by setting a flag when
I start dragging, but the correct solution would hook "text-selected"
rather than button-release, a signal that does not seem to exist.  Did I
miss it?  Is there a different better solution?
-- 
Jeffrey Barish




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