Issues With Enter/Leave Events

Try the following example:

When moving the mouse pointer slowly from "Alpha" to "Beta" (or vice versa) the word underneath the mouse pointer will be highlighted (with light blue). But when moving faster the highlighting does not work properly (tested with X11).

The reason is that the toolkit is collapsing mouse motion events per default. When moving the mouse pointer faster the intermediate motion events, when hovering the space between the words, are missing, and the event handling for tags does not work. In revised widget this has been fixed, the missing motion events for a proper Enter/Leave event handling will be computed.

Try next example:

Hover with mouse pointer the first "alpha", and then move to same word in second row. The highlighting does not work, because no Leave/Enter pair will be triggered, but this is required for a proper handling. The documentation (Tk text manual) about this point is not clear.

Shrink the width of the widget so that you will see three lines (instead of two), but the first and second line still contains the word "alpha". Now when hovering first "alpha", and then moving to next "alpha" in second line, the highlighting works. This means that in old implementation the tag event handling depends on contingencies of the layout (font, line wrapping, indentation), and this must not happen. With revised version the tag event handling is independend from layout, because an Leave/Enter pair will be triggered anyway when the display line is changing while moving the mouse pointer, provided it's not the same region (contiguous sequence of characters associated with this tag).