TIP #443: More Tag Configuration Options for the Text Widget


TIP:443
Title:More Tag Configuration Options for the Text Widget
Version:$Revision: 1.9 $
Author:François Vogel <fvogelnew1 at free dot fr>
State:Final
Type:Project
Tcl-Version:8.6.6
Vote:Done
Created:Tuesday, 09 February 2016
Keywords:Tk

Abstract

Despite the text widget already has numerous configuration options, some users need more refinements and have requested new tag configuration options. This TIP proposes to add these options, when deemed relevant.

Rationale

Several users have reported they miss different tag configuration options in the text widget, stating they cannot achieve the rendering they target. Such RFE include:

Proposed Change

It is proposed to add the following tag configuration options to the Tk text widget:

-selectbackground color:

Specifies the background color to use when displaying selected items. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -background tag option is used.

Note regarding the particular case of the "sel" tag: Currently, the "sel" tag -background tag option is mirrored with the -selectbackground text widget option. This makes sense. It does not make real sense to have -selectbackground applied to the "sel" tag (it is more intuitive to use -background for the "sel" tag). However, if the "sel" tag receives non-empty -selectbackground, then this tag option prevails on the -background tag option for mirroring, i.e. the -selectbackground tag option is mirrored with the -selectbackground widget option.

-selectforeground color:

Specifies the foreground color to use when displaying selected items. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -foreground tag option is used.

Note regarding the particular case of the "sel" tag: same principle as above for -selectbackground.

-underlinefg color:

Specifies the color to use when displaying the underline. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -foreground tag option is used (if there is one, otherwise the the color specified by the -foreground widget option is used).

-overstrikefg color:

Specifies the color to use when displaying the overstrike. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -foreground tag option is used (if there is one, otherwise the color specified by the -foreground widget option is used).

-lmargincolor color:

Color specifies the background color to use in regions that do not contain characters because they are indented by -lmargin1 or -lmargin2. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -background widget option is used.

-rmargincolor color:

Color specifies the background color to use in regions that do not contain characters because they are indented by -rmargin. It may have any of the forms accepted by Tk_GetColor. If color has not been specified, or if it is specified as an empty string, then the color specified by the -background widget option is used.

Rejected additional tag configuration options

RFE 1759972 [5] requested stippling (-selectbgstipple, -selectfgstipple) for selected text. Also RFE 1754048 [6] requested stippling in left and right margins of the text widget (-lmargin1stipple, -lmargin2stipple, rmarginstipple).

Any new stippling options was rejected during the discussion about this TIP. Reasons were as follows:

Reference Implementation

A reference implementation is available in branch tip-443 of the fossil repository.

Copyright

This document has been placed in the public domain.


Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows