Fix for #4 (at the C code level) is now in the bugfix branch All tests I have added regarding <<Selection>> event do pass now with [6e14c473].

Keith, could you please have a look and test whether this is OK for you?

Two points to keep in mind while testing:

- I still need to refine the fix for <<Selection>> generation upon text insertion. The edge case is not yet dealt with.

- According to the man page, <<Selection>> should fire whenever the <b>text widget selection</b> is changed. This may or may not impact the <b>PRIMARY</b> (X) selection (this depends on -exportselection). The fix you originally proposed for #4 triggered <<Selection>> only if -exportselection is true. If I read the man page correctly this was incorrect.

Thanks for your help!