Additional Widget Option '-insertforeground'

Command-Line Name: -insertforeground
Database Name: insertForeground
Database Class: InsertForeground

Specifies the color to use as foreground for the characters in the area covered by the insertion cursor. This color will not be overridden with tagging options. Note that this color will not be used unless option -showinsertforeground is enabled.

Command-Line Name: -showinsertforeground
Database Name: showInsertForeground
Database Class: ShowInsertForeground

Use color option -insertforeground for the foreground of characters covered by the insert cursor if this option is enabled, otherwise the color of the characters will not change when coverd by the insertion cursor. Per default this option is disabled.

This option is required, otherwise in some cases the characters covered by the block cursor can be unreadable, see the following example (with options -blockcursor on -insertbackground yellow -insertforeground black):

-showinsertforeground no -showinsertforeground yes

Note that -showinsertforeground no (default) is the original behavior (wish8.6). The introduction of this new option is not affecting the behavior of existing applications.

About the implementation: the current (revised) implementation is using a hack for displaying the color defined with -insertforeground, because the Tk lib does not provide clipping functionality, and this is needed for a proper implementation (nevertheless the hack works properly). I suggest that the clipping functions (especially XSetClipRectangles) will be implemented, not only for replacing the hack, often this function is also required for self defined extensions inside the Canvas widget. Currently the implementation of self defined Canvas elements is not possible because of the missing clip functionality. Tk is intendend to be an open library, I think that the implementation of clipping is a must, even if the libary himself does not need clipping.