head	1.60;
access;
symbols
	core-8-5-9:1.53.2.1
	core-8-5-8:1.53
	macosx-cocoa-merge:1.58
	macosx-cocoa-premerge:1.58
	macosx-carbon-freeze:1.58
	core-8-5-7:1.53
	core-8-5-6:1.53
	core-8-6-b1:1.58
	core-8-6-a3:1.57
	core-8-5-5:1.53
	core-8-6-a2:1.56
	core-8-5-4:1.53
	core-8-5-3:1.53
	core-8-6-a1:1.55
	core-8-4-19:1.15.2.5
	core-8-5-branch:1.53.0.2
	core-8-5-2:1.53
	core-8-4-18:1.15.2.5
	core-8-5-1:1.53
	core-8-4-17:1.15.2.5
	core-8-5-0:1.53
	core-8-5-b3:1.52
	core-8-5-b2:1.47
	core-8-4-16:1.15.2.5
	core-8-5-b1:1.43
	core-stablilizer-merge:1.43
	core-stabilizer-branch:1.43.0.2
	core-stabilizer-merge:1.53
	core-8-4-15:1.15.2.5
	core-8-5-a6:1.43
	core-8-5-a5:1.42
	core-8-4-14:1.15.2.5
	core-8-5-a4:1.41
	core-8-4-13:1.15.2.5
	core-8-4-12:1.15.2.4
	core-8-4-11:1.15.2.3
	core-8-5-a3:1.37
	core-8-4-10:1.15.2.3
	core-8-4-9-branch:1.15.2.1.0.2
	core-8-5-a2:1.33
	core-8-4-9:1.15.2.1
	core-8-4-8:1.15.2.1
	core-8-4-7:1.15
	core-8-5-a1:1.25
	core-8-4-6:1.15
	core-8-4-5:1.15
	mistachkin-dev-branch:1.17.0.2
	core-8-4-4:1.15
	core-8-4-3:1.15
	core-8-4-branch:1.15.0.2
	core-8-4-2:1.15
	core-8-4-1:1.14
	core-8-3-5:1.6.2.1
	core-8-4-0:1.14
	macosx-8-4-merge-2002-08-31-trunk:1.14
	macosx-8-4-premerge-2002-08-31-branch:1.9.2.2
	macosx-8-4-premerge-2002-08-31-trunk:1.14
	macosx-8-4-merge-2002-08-30-branch:1.9.2.2
	macosx-8-4-merge-2002-08-30-trunk:1.14
	macosx-8-4-merge-2002-08-20-branch:1.9.2.2
	macosx-8-4-merge-2002-08-20-trunk:1.14
	core-8-4-b2:1.14
	core-8-4-b1:1.14
	macosx-premerge-6-9-02:1.9.2.1
	core-8-4-a4:1.11
	core-8-3-4:1.6.2.1
	macosx-8-4-branch:1.9.0.2
	macosx-8-4-branchpoint:1.9
	core-8-4-a3:1.9
	core-8-3-3:1.6.2.1
	dgp-privates-into-namespace:1.8.0.4
	tclpro-1-5-0:1.6
	core-8-4-win-speedup:1.8.0.2
	core-8-4-a2:1.8
	tclpro-1-4-1:1.6
	tclpro-1-4-0:1.6
	core-8-3-2:1.6
	ajuba-ajuba2-2-1-base:1.6
	ajuba-ajuba2-2-0:1.6
	core-8-4-a1:1.6
	core-8-3-1-branch:1.6.0.2
	core-8-3-1:1.6
	scriptics-sc-2-0-b5:1.6
	scriptics-sc-2-0-fixed:1.6
	scriptics-sc-2-0-b2:1.6
	scriptics-sc-2-0-b1:1.6
	core-8-3-0:1.6
	core-8-3-b2:1.4
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.2
	scriptics-sc-1-1-b1:1.2
	core-8-2-3:1.2
	scriptics-sc-1-1-branch:1.2.0.16
	scriptics-sc-1-1-base:1.2
	scriptics-sc-1-0:1.2
	scriptics-sc-1-0-branch:1.2.0.14
	scriptics-sc-1-0-base:1.2
	core-8-2-2:1.2
	core-8-2-1:1.2
	scriptics-bc-1-0-b1:1.2
	core-8-2-1-branch:1.2.0.12
	scriptics-tclpro-1-3-0:1.2
	core-8-2-0:1.2
	core-8-2-b3-branch:1.2.0.10
	core-8-2-b3-base:1.2
	scriptics-tclpro-1-3-b4:1.2
	core-8-2-b2:1.2
	scriptics-tclpro-1-3-b3:1.2
	core-8-2-b1:1.2
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.60
date	2010.07.06.17.15.04;	author andreas_kupries;	state Exp;
branches;
next	1.59;

1.59
date	2010.01.10.20.38.54;	author dkf;	state Exp;
branches;
next	1.58;

1.58
date	2008.12.06.10.48.29;	author dkf;	state Exp;
branches;
next	1.57;

1.57
date	2008.09.23.13.36.55;	author dkf;	state Exp;
branches;
next	1.56;

1.56
date	2008.06.30.22.57.03;	author dkf;	state Exp;
branches;
next	1.55;

1.55
date	2008.06.24.10.54.53;	author patthoyts;	state Exp;
branches;
next	1.54;

1.54
date	2008.04.17.15.27.12;	author dkf;	state Exp;
branches;
next	1.53;

1.53
date	2007.12.13.15.23.43;	author dgp;	state Exp;
branches
	1.53.2.1;
next	1.52;

1.52
date	2007.11.01.10.37.57;	author dkf;	state Exp;
branches;
next	1.51;

1.51
date	2007.10.30.21.29.59;	author dkf;	state Exp;
branches;
next	1.50;

1.50
date	2007.10.30.19.39.26;	author hobbs;	state Exp;
branches;
next	1.49;

1.49
date	2007.10.30.15.02.14;	author dkf;	state Exp;
branches;
next	1.48;

1.48
date	2007.10.29.16.04.14;	author dkf;	state Exp;
branches;
next	1.47;

1.47
date	2007.10.26.20.13.23;	author dgp;	state Exp;
branches;
next	1.46;

1.46
date	2007.10.24.14.32.59;	author dkf;	state Exp;
branches;
next	1.45;

1.45
date	2007.10.23.15.44.35;	author dkf;	state Exp;
branches;
next	1.44;

1.44
date	2007.10.16.15.13.18;	author dkf;	state Exp;
branches;
next	1.43;

1.43
date	2006.11.15.13.29.17;	author dkf;	state Exp;
branches
	1.43.2.1;
next	1.42;

1.42
date	2006.10.18.00.01.38;	author hobbs;	state Exp;
branches;
next	1.41;

1.41
date	2006.04.12.02.35.24;	author das;	state Exp;
branches;
next	1.40;

1.40
date	2005.11.16.09.48.44;	author vincentdarley;	state Exp;
branches;
next	1.39;

1.39
date	2005.10.10.10.36.34;	author vincentdarley;	state Exp;
branches;
next	1.38;

1.38
date	2005.08.09.09.46.02;	author vincentdarley;	state Exp;
branches;
next	1.37;

1.37
date	2005.05.12.22.51.03;	author dgp;	state Exp;
branches;
next	1.36;

1.36
date	2005.04.18.11.34.41;	author vincentdarley;	state Exp;
branches;
next	1.35;

1.35
date	2005.02.14.23.02.52;	author vincentdarley;	state Exp;
branches;
next	1.34;

1.34
date	2005.02.11.21.04.37;	author hobbs;	state Exp;
branches;
next	1.33;

1.33
date	2004.11.20.15.55.08;	author vincentdarley;	state Exp;
branches;
next	1.32;

1.32
date	2004.11.17.13.47.07;	author vincentdarley;	state Exp;
branches;
next	1.31;

1.31
date	2004.11.12.09.03.19;	author das;	state Exp;
branches;
next	1.30;

1.30
date	2004.10.28.12.25.53;	author dkf;	state Exp;
branches;
next	1.29;

1.29
date	2004.09.19.16.05.37;	author dkf;	state Exp;
branches;
next	1.28;

1.28
date	2004.09.10.12.13.40;	author vincentdarley;	state Exp;
branches;
next	1.27;

1.27
date	2004.08.17.22.37.24;	author dkf;	state Exp;
branches;
next	1.26;

1.26
date	2004.06.04.10.51.17;	author vincentdarley;	state Exp;
branches;
next	1.25;

1.25
date	2004.03.04.00.17.07;	author hobbs;	state Exp;
branches;
next	1.24;

1.24
date	2003.12.22.22.16.48;	author jenglish;	state Exp;
branches;
next	1.23;

1.23
date	2003.12.04.12.28.37;	author vincentdarley;	state Exp;
branches;
next	1.22;

1.22
date	2003.11.16.14.13.09;	author vincentdarley;	state Exp;
branches;
next	1.21;

1.21
date	2003.11.15.02.41.41;	author jenglish;	state Exp;
branches;
next	1.20;

1.20
date	2003.11.07.15.36.26;	author vincentdarley;	state Exp;
branches;
next	1.19;

1.19
date	2003.10.31.09.02.07;	author vincentdarley;	state Exp;
branches;
next	1.18;

1.18
date	2003.10.06.22.14.26;	author jenglish;	state Exp;
branches;
next	1.17;

1.17
date	2003.05.29.21.57.56;	author jenglish;	state Exp;
branches;
next	1.16;

1.16
date	2003.05.19.13.04.22;	author vincentdarley;	state Exp;
branches;
next	1.15;

1.15
date	2003.02.19.18.52.14;	author mdejong;	state Exp;
branches
	1.15.2.1;
next	1.14;

1.14
date	2002.06.22.08.21.51;	author hobbs;	state Exp;
branches;
next	1.13;

1.13
date	2002.06.21.23.22.24;	author hobbs;	state Exp;
branches;
next	1.12;

1.12
date	2002.06.21.23.09.55;	author hobbs;	state Exp;
branches;
next	1.11;

1.11
date	2001.11.15.11.55.26;	author dkf;	state Exp;
branches;
next	1.10;

1.10
date	2001.11.13.00.19.05;	author hobbs;	state Exp;
branches;
next	1.9;

1.9
date	2001.08.01.16.21.11;	author dgp;	state Exp;
branches
	1.9.2.1;
next	1.8;

1.8
date	2000.08.25.06.58.33;	author ericm;	state Exp;
branches
	1.8.2.1
	1.8.4.1;
next	1.7;

1.7
date	2000.07.25.21.14.35;	author jenglish;	state Exp;
branches;
next	1.6;

1.6
date	2000.02.01.11.40.58;	author hobbs;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2000.01.21.03.54.21;	author hobbs;	state Exp;
branches;
next	1.4;

1.4
date	2000.01.06.02.18.54;	author hobbs;	state Exp;
branches;
next	1.3;

1.3
date	99.12.14.06.51.44;	author hobbs;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.00;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.39.57;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.16.29;	author stanton;	state Exp;
branches;
next	;

1.6.2.1
date	2001.04.04.07.23.48;	author hobbs;	state Exp;
branches;
next	;

1.8.2.1
date	2002.04.02.20.57.53;	author hobbs;	state Exp;
branches;
next	;

1.8.4.1
date	2001.03.13.00.32.37;	author dgp;	state Exp;
branches;
next	;

1.9.2.1
date	2002.02.05.02.25.14;	author wolfsuit;	state Exp;
branches;
next	1.9.2.2;

1.9.2.2
date	2002.08.20.20.27.00;	author das;	state Exp;
branches;
next	;

1.15.2.1
date	2004.10.28.12.25.22;	author dkf;	state Exp;
branches;
next	1.15.2.2;

1.15.2.2
date	2005.02.11.21.05.04;	author hobbs;	state Exp;
branches;
next	1.15.2.3;

1.15.2.3
date	2005.05.12.22.50.59;	author dgp;	state Exp;
branches;
next	1.15.2.4;

1.15.2.4
date	2005.11.16.09.51.18;	author vincentdarley;	state Exp;
branches;
next	1.15.2.5;

1.15.2.5
date	2006.04.12.02.20.47;	author das;	state Exp;
branches;
next	;

1.43.2.1
date	2007.10.17.14.37.05;	author dgp;	state Exp;
branches;
next	1.43.2.2;

1.43.2.2
date	2007.10.24.12.59.31;	author dgp;	state Exp;
branches;
next	1.43.2.3;

1.43.2.3
date	2007.10.27.04.23.14;	author dgp;	state Exp;
branches;
next	1.43.2.4;

1.43.2.4
date	2007.11.01.16.37.16;	author dgp;	state Exp;
branches;
next	;

1.53.2.1
date	2010.07.06.17.15.15;	author andreas_kupries;	state Exp;
branches;
next	;


desc
@@


1.60
log
@
	* doc/text.n: Fixed minor typo in the description of 'text
	  delete', as reported by <eee@@users.sf.net> on the chat.
@
text
@'\"
'\" Copyright (c) 1992 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
'\" RCS: @@(#) $Id: text.n,v 1.59 2010/01/10 20:38:54 dkf Exp $
'\" 
.so man.macros
.TH text n 8.5 Tk "Tk Built-In Commands"
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate text widgets
.SH SYNOPSIS
.nf
\fBtext\fR \fIpathName \fR?\fIoptions\fR?
\fBtk_textCopy\fR \fIpathName\fR
\fBtk_textCut\fR \fIpathName\fR
\fBtk_textPaste\fR \fIpathName\fR
.SO
\-background	\-highlightthickness	\-relief
\-borderwidth	\-insertbackground	\-selectbackground
\-cursor	\-insertborderwidth	\-selectborderwidth
\-exportselection	\-insertofftime	\-selectforeground
\-font	\-insertontime	\-setgrid
\-foreground	\-insertwidth	\-takefocus
\-highlightbackground	\-padx	\-xscrollcommand
\-highlightcolor	\-pady	\-yscrollcommand
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-autoseparators autoSeparators AutoSeparators
Specifies a boolean that says whether separators are automatically inserted in
the undo stack. Only meaningful when the \fB\-undo\fR option is true.
.OP \-blockcursor blockCursor BlockCursor
Specifies a boolean that says whether the blinking insertion cursor should be
drawn as a character-sized rectangular block. If false (the default) a thin
vertical line is used for the insertion cursor.
.OP \-endline endLine EndLine
Specifies an integer line index representing the last line of the underlying
textual data store that should be contained in the widget. This allows a text
widget to reflect only a portion of a larger piece of text. Instead of an
integer, the empty string can be provided to this configuration option, which
will configure the widget to end at the very last line in the textual data
store.
.OP \-height height Height
Specifies the desired height for the window, in units of characters in the
font given by the \fB\-font\fR option. Must be at least one.
.OP \-inactiveselectbackground inactiveSelectBackground Foreground
Specifies the colour to use for the selection (the \fBsel\fR tag) when the
window does not have the input focus. If empty, \fB{}\fR, then no selection is
shown when the window does not have the focus.
.OP \-insertunfocussed insertUnfocussed InsertUnfocussed
.VS 8.6
Specifies how to display the insertion cursor when the widget does not have
the focus. Must be \fBnone\fR (the default) which means to not display the
cursor, \fBhollow\fR which means to display a hollow box, or \fBsolid\fR which
means to display a solid box. Note that \fBhollow\fR and \fBsolid\fR will
appear very similar when the \fB\-blockcursor\fR option is false.
.VE 8.6
.OP \-maxundo maxUndo MaxUndo
Specifies the maximum number of compound undo actions on the undo stack. A
zero or a negative value imply an unlimited undo stack.
.OP \-spacing1 spacing1 Spacing1
Requests additional space above each text line in the widget, using any of the
standard forms for screen distances. If a line wraps, this option only applies
to the first line on the display. This option may be overridden with
\fB\-spacing1\fR options in tags.
.OP \-spacing2 spacing2 Spacing2
For lines that wrap (so that they cover more than one line on the display)
this option specifies additional space to provide between the display lines
that represent a single line of text. The value may have any of the standard
forms for screen distances. This option may be overridden with
\fB\-spacing2\fR options in tags.
.OP \-spacing3 spacing3 Spacing3
Requests additional space below each text line in the widget, using any of the
standard forms for screen distances. If a line wraps, this option only applies
to the last line on the display. This option may be overridden with
\fB\-spacing3\fR options in tags.
.OP \-startline startLine StartLine
Specifies an integer line index representing the first line of the underlying
textual data store that should be contained in the widget. This allows a text
widget to reflect only a portion of a larger piece of text. Instead of an
integer, the empty string can be provided to this configuration option, which
will configure the widget to start at the very first line in the textual data
store.
.OP \-state state State
Specifies one of two states for the text: \fBnormal\fR or \fBdisabled\fR. If
the text is disabled then characters may not be inserted or deleted and no
insertion cursor will be displayed, even if the input focus is in the widget.
.OP \-tabs tabs Tabs
Specifies a set of tab stops for the window. The option's value consists of a
list of screen distances giving the positions of the tab stops, each of which
is a distance relative to the left edge of the widget (excluding borders,
padding, etc). Each position may optionally be followed in the next list
element by one of the keywords \fBleft\fR, \fBright\fR, \fBcenter\fR, or
\fBnumeric\fR, which specifies how to justify text relative to the tab stop.
\fBLeft\fR is the default; it causes the text following the tab character to
be positioned with its left edge at the tab position. \fBRight\fR means that
the right edge of the text following the tab character is positioned at the
tab position, and \fBcenter\fR means that the text is centered at the tab
position. \fBNumeric\fR means that the decimal point in the text is positioned
at the tab position; if there is no decimal point then the least significant
digit of the number is positioned just to the left of the tab position; if
there is no number in the text then the text is right-justified at the tab
position. For example,
.QW "\fB\-tabs {2c left 4c 6c center}\fR"
creates three tab stops at two-centimeter intervals; the first two use left
justification and the third uses center justification.
.RS
.PP
If the list of tab stops does not have enough elements to cover all of the
tabs in a text line, then Tk extrapolates new tab stops using the spacing and
alignment from the last tab stop in the list. Tab distances must be strictly
positive, and must always increase from one tab stop to the next (if not, an
error is thrown). The value of the \fBtabs\fR option may be overridden by
\fB\-tabs\fR options in tags.
.PP
If no \fB\-tabs\fR option is specified, or if it is specified as an empty
list, then Tk uses default tabs spaced every eight (average size) characters.
To achieve a different standard spacing, for example every 4 characters,
simply configure the widget with
.QW "\fB\-tabs \N'34'[expr {4 * [font measure $font 0]}] left\N'34' \-tabstyle wordprocessor\fR" .
.RE
.OP \-tabstyle tabStyle TabStyle
Specifies how to interpret the relationship between tab stops on a line and
tabs in the text of that line. The value must be \fBtabular\fR (the default)
or \fBwordprocessor\fR. Note that tabs are interpreted as they are encountered
in the text. If the tab style is \fBtabular\fR then the \fIn\fR'th tab
character in the line's text will be associated with the \fIn\fR'th tab stop
defined for that line. If the tab character's x coordinate falls to the right
of the \fIn\fR'th tab stop, then a gap of a single space will be inserted as a
fallback. If the tab style is \fBwordprocessor\fR then any tab character being
laid out will use (and be defined by) the first tab stop to the right of the
preceding characters already laid out on that line. The value of the
\fBtabstyle\fR option may be overridden by \fB\-tabstyle\fR options in tags.
.OP \-undo undo Undo
Specifies a boolean that says whether the undo mechanism is active or not.
.OP \-width width Width
Specifies the desired width for the window in units of characters in the font
given by the \fB\-font\fR option. If the font does not have a uniform width
then the width of the character
.QW 0
is used in translating from character units to screen units.
.OP \-wrap wrap Wrap
Specifies how to handle lines in the text that are too long to be displayed in
a single line of the text's window. The value must be \fBnone\fR or \fBchar\fR
or \fBword\fR. A wrap mode of \fBnone\fR means that each line of text appears
as exactly one line on the screen; extra characters that do not fit on the
screen are not displayed. In the other modes each line of text will be broken
up into several screen lines if necessary to keep all the characters visible.
In \fBchar\fR mode a screen line break may occur after any character; in
\fBword\fR mode a line break will only be made at word boundaries.
.BE
.SH DESCRIPTION
.PP
The \fBtext\fR command creates a new window (given by the \fIpathName\fR
argument) and makes it into a text widget. Additional options, described
above, may be specified on the command line or in the option database to
configure aspects of the text such as its default background color and relief.
The \fBtext\fR command returns the path name of the new window.
.PP
A text widget displays one or more lines of text and allows that text to be
edited. Text widgets support four different kinds of annotations on the text,
called tags, marks, embedded windows or embedded images. Tags allow different
portions of the text to be displayed with different fonts and colors. In
addition, Tcl commands can be associated with tags so that scripts are invoked
when particular actions such as keystrokes and mouse button presses occur in
particular ranges of the text. See \fBTAGS\fR below for more details.
.PP
The second form of annotation consists of floating markers in the text called
.QW marks .
Marks are used to keep track of various interesting positions in the text as
it is edited. See \fBMARKS\fR below for more details.
.PP
The third form of annotation allows arbitrary windows to be embedded in a text
widget. See \fBEMBEDDED WINDOWS\fR below for more details.
.PP
The fourth form of annotation allows Tk images to be embedded in a text
widget. See \fBEMBEDDED IMAGES\fR below for more details.
.PP
The text widget also has a built-in undo/redo mechanism. See
\fBTHE UNDO MECHANISM\fR below for more details.
.PP
The text widget allows for the creation of peer widgets. These are other text
widgets which share the same underlying data (text, marks, tags, images, etc).
See \fBPEER WIDGETS\fR below for more details.
.SH INDICES
.PP
Many of the widget commands for texts take one or more indices as arguments.
An index is a string used to indicate a particular place within a text, such
as a place to insert characters or one endpoint of a range of characters to
delete. Indices have the syntax
.CS
\fIbase modifier modifier modifier ...\fR
.CE
Where \fIbase\fR gives a starting point and the \fImodifier\fRs adjust the
index from the starting point (e.g. move forward or backward one character).
Every index must contain a \fIbase\fR, but the \fImodifier\fRs are optional.
Most modifiers (as documented below) allow an optional submodifier. Valid
submodifiers are \fBany\fR and \fBdisplay\fR. If the submodifier is
abbreviated, then it must be followed by whitespace, but otherwise there need
be no space between the submodifier and the following \fImodifier\fR.
Typically the \fBdisplay\fR submodifier adjusts the meaning of the following
\fImodifier\fR to make it refer to visual or non-elided units rather than
logical units, but this is explained for each relevant case below. Lastly,
where \fIcount\fR is used as part of a modifier, it can be positive or
negative, so
.QW "\fIbase\fR \- \-3 lines"
is perfectly valid (and equivalent to
.QW "\fIbase\fR +3lines" ).
.PP
The \fIbase\fR for an index must have one of the following forms:
.TP 12
\fIline\fB.\fIchar\fR
.
Indicates \fIchar\fR'th character on line \fIline\fR. Lines are numbered from
1 for consistency with other UNIX programs that use this numbering scheme.
Within a line, characters are numbered from 0. If \fIchar\fR is \fBend\fR then
it refers to the newline character that ends the line.
.TP 12
\fB@@\fIx\fB,\fIy\fR
.
Indicates the character that covers the pixel whose x and y coordinates within
the text's window are \fIx\fR and \fIy\fR.
.TP 12
\fBend\fR
.
Indicates the end of the text (the character just after the last newline).
.TP 12
\fImark\fR
.
Indicates the character just after the mark whose name is \fImark\fR.
.TP 12
\fItag\fB.first\fR
.
Indicates the first character in the text that has been tagged with \fItag\fR.
This form generates an error if no characters are currently tagged with
\fItag\fR.
.TP 12
\fItag\fB.last\fR
.
Indicates the character just after the last one in the text that has been
tagged with \fItag\fR. This form generates an error if no characters are
currently tagged with \fItag\fR.
.TP 12
\fIpathName\fR
.
Indicates the position of the embedded window whose name is \fIpathName\fR.
This form generates an error if there is no embedded window by the given name.
.TP 12
\fIimageName\fR
.
Indicates the position of the embedded image whose name is \fIimageName\fR.
This form generates an error if there is no embedded image by the given name.
.PP
If the \fIbase\fR could match more than one of the above forms, such as a
\fImark\fR and \fIimageName\fR both having the same value, then the form
earlier in the above list takes precedence. If modifiers follow the base
index, each one of them must have one of the forms listed below. Keywords such
as \fBchars\fR and \fBwordend\fR may be abbreviated as long as the
abbreviation is unambiguous.
.TP
\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBchars\fR
.
Adjust the index forward by \fIcount\fR characters, moving to later lines in
the text if necessary. If there are fewer than \fIcount\fR characters in the
text after the current index, then set the index to the last index in the
text. Spaces on either side of \fIcount\fR are optional. If the \fBdisplay\fR
submodifier is given, elided characters are skipped over without being
counted. If \fBany\fR is given, then all characters are counted. For
historical reasons, if neither modifier is given then the count actually takes
place in units of index positions (see \fBindices\fR for details). This
behaviour may be changed in a future major release, so if you need an index
count, you are encouraged to use \fBindices\fR instead wherever possible.
.TP
\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBchars\fR
.
Adjust the index backward by \fIcount\fR characters, moving to earlier lines
in the text if necessary. If there are fewer than \fIcount\fR characters in
the text before the current index, then set the index to the first index in
the text (1.0). Spaces on either side of \fIcount\fR are optional. If the
\fBdisplay\fR submodifier is given, elided characters are skipped over without
being counted. If \fBany\fR is given, then all characters are counted. For
historical reasons, if neither modifier is given then the count actually takes
place in units of index positions (see \fBindices\fR for details). This
behavior may be changed in a future major release, so if you need an index
count, you are encouraged to use \fBindices\fR instead wherever possible.
.TP
\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBindices\fR
.
Adjust the index forward by \fIcount\fR index positions, moving to later lines
in the text if necessary. If there are fewer than \fIcount\fR index positions
in the text after the current index, then set the index to the last index
position in the text. Spaces on either side of \fIcount\fR are optional. Note
that an index position is either a single character or a single embedded image
or embedded window. If the \fBdisplay\fR submodifier is given, elided indices
are skipped over without being counted. If \fBany\fR is given, then all
indices are counted; this is also the default behaviour if no modifier is
given.
.TP
\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBindices\fR
.
Adjust the index backward by \fIcount\fR index positions, moving to earlier
lines in the text if necessary. If there are fewer than \fIcount\fR index
positions in the text before the current index, then set the index to the
first index position (1.0) in the text. Spaces on either side of \fIcount\fR
are optional. If the \fBdisplay\fR submodifier is given, elided indices are
skipped over without being counted. If \fBany\fR is given, then all indices
are counted; this is also the default behaviour if no modifier is given.
.TP
\fB+ \fIcount\fR ?\fIsubmodifier\fR? \fBlines\fR
.
Adjust the index forward by \fIcount\fR lines, retaining the same character
position within the line. If there are fewer than \fIcount\fR lines after the
line containing the current index, then set the index to refer to the same
character position on the last line of the text. Then, if the line is not long
enough to contain a character at the indicated character position, adjust the
character position to refer to the last character of the line (the newline).
Spaces on either side of \fIcount\fR are optional. If the \fBdisplay\fR
submodifier is given, then each visual display line is counted separately.
Otherwise, if \fBany\fR (or no modifier) is given, then each logical line (no
matter how many times it is visually wrapped) counts just once. If the
relevant lines are not wrapped, then these two methods of counting are
equivalent.
.TP
\fB\- \fIcount\fR ?\fIsubmodifier\fR? \fBlines\fR
.
Adjust the index backward by \fIcount\fR logical lines, retaining the same
character position within the line. If there are fewer than \fIcount\fR lines
before the line containing the current index, then set the index to refer to
the same character position on the first line of the text. Then, if the line
is not long enough to contain a character at the indicated character position,
adjust the character position to refer to the last character of the line (the
newline). Spaces on either side of \fIcount\fR are optional. If the
\fBdisplay\fR submodifier is given, then each visual display line is counted
separately. Otherwise, if \fBany\fR (or no modifier) is given, then each
logical line (no matter how many times it is visually wrapped) counts just
once. If the relevant lines are not wrapped, then these two methods of
counting are equivalent.
.TP
?\fIsubmodifier\fR? \fBlinestart\fR
.
Adjust the index to refer to the first index on the line. If the \fBdisplay\fR
submodifier is given, this is the first index on the display line, otherwise
on the logical line.
.TP
?\fIsubmodifier\fR? \fBlineend\fR
.
Adjust the index to refer to the last index on the line (the newline). If the
\fBdisplay\fR submodifier is given, this is the last index on the display
line, otherwise on the logical line.
.TP
?\fIsubmodifier\fR? \fBwordstart\fR
.
Adjust the index to refer to the first character of the word containing the
current index. A word consists of any number of adjacent characters that are
letters, digits, or underscores, or a single character that is not one of
these. If the \fBdisplay\fR submodifier is given, this only examines
non-elided characters, otherwise all characters (elided or not) are examined.
.TP
?\fIsubmodifier\fR? \fBwordend\fR
.
Adjust the index to refer to the character just after the last one of the word
containing the current index. If the current index refers to the last
character of the text then it is not modified. If the \fBdisplay\fR
submodifier is given, this only examines non-elided characters, otherwise all
characters (elided or not) are examined.
.PP
If more than one modifier is present then they are applied in left-to-right
order. For example, the index
.QW "\fBend \- 1 chars\fR"
refers to the next-to-last character in the text and
.QW "\fBinsert wordstart \- 1 c\fR"
refers to the character just before the first one in the word containing the
insertion cursor. Modifiers are applied one by one in this left to right
order, and after each step the resulting index is constrained to be a valid
index in the text widget. So, for example, the index
.QW "\fB1.0 \-1c +1c\fR"
refers to the index
.QW \fB2.0\fR .
.PP
Where modifiers result in index changes by display lines, display chars or
display indices, and the \fIbase\fR refers to an index inside an elided tag,
that base index is considered to be equivalent to the first following
non-elided index.
.SH TAGS
.PP
The first form of annotation in text widgets is a tag. A tag is a textual
string that is associated with some of the characters in a text. Tags may
contain arbitrary characters, but it is probably best to avoid using the
characters
.QW " "
(space), \fB+\fR, or \fB\-\fR: these characters have special meaning in
indices, so tags containing them cannot be used as indices. There may be any
number of tags associated with characters in a text. Each tag may refer to a
single character, a range of characters, or several ranges of characters. An
individual character may have any number of tags associated with it.
.PP
A priority order is defined among tags, and this order is used in implementing
some of the tag-related functions described below. When a tag is defined (by
associating it with characters or setting its display options or binding
commands to it), it is given a priority higher than any existing tag. The
priority order of tags may be redefined using the
.QW "\fIpathName \fBtag raise\fR"
and
.QW "\fIpathName \fBtag lower\fR"
widget commands.
.PP
Tags serve three purposes in text widgets. First, they control the way
information is displayed on the screen. By default, characters are displayed
as determined by the \fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR
options for the text widget. However, display options may be associated with
individual tags using the
.QW "\fIpathName \fBtag configure\fR"
widget command. If a character has been tagged, then the display options
associated with the tag override the default display style. The following
options are currently supported for tags:
.TP
\fB\-background \fIcolor\fR
.
\fIColor\fR specifies the background color to use for characters associated
with the tag. It may have any of the forms accepted by \fBTk_GetColor\fR.
.TP
\fB\-bgstipple \fIbitmap\fR
.
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern for the
background. It may have any of the forms accepted by \fBTk_GetBitmap\fR. If
\fIbitmap\fR has not been specified, or if it is specified as an empty string,
then a solid fill will be used for the background.
.TP
\fB\-borderwidth \fIpixels\fR
.
\fIPixels\fR specifies the width of a border to draw around the tag using any
of the forms accepted by \fBTk_GetPixels\fR. This option should be used in
conjuction with the \fB\-relief\fR option to provide the desired border.
.TP
\fB\-elide \fIboolean\fR
.
\fIElide\fR specifies whether the data should be elided. Elided data
(characters, images, embedded windows, etc.) is not displayed and takes no
space on screen, but further on behaves just as normal data.
.TP
\fB\-fgstipple \fIbitmap\fR
.
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern when drawing
text and other foreground information such as underlines. It may have any of
the forms accepted by \fBTk_GetBitmap\fR. If \fIbitmap\fR has not been
specified, or if it is specified as an empty string, then a solid fill will be
used.
.TP
\fB\-font \fIfontName\fR
.
\fIFontName\fR is the name of a font to use for drawing characters. It may
have any of the forms accepted by \fBTk_GetFont\fR.
.TP
\fB\-foreground \fIcolor\fR
.
\fIColor\fR specifies the color to use when drawing text and other foreground
information such as underlines. It may have any of the forms accepted by
\fBTk_GetColor\fR.
.TP
\fB\-justify \fIjustify\fR
.
If the first non-elided character of a display line has a tag for which this
option has been specified, then \fIjustify\fR determines how to justify the
line. It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR. If a line
wraps, then the justification for each line on the display is determined by
the first non-elided character of that display line.
.TP
\fB\-lmargin1 \fIpixels\fR
.
If the first non-elided character of a text line has a tag for which this
option has been specified, then \fIpixels\fR specifies how much the line
should be indented from the left edge of the window. \fIPixels\fR may have any
of the standard forms for screen distances. If a line of text wraps, this
option only applies to the first line on the display; the \fB\-lmargin2\fR
option controls the indentation for subsequent lines.
.TP
\fB\-lmargin2 \fIpixels\fR
.
If the first non-elided character of a display line has a tag for which this
option has been specified, and if the display line is not the first for its
text line (i.e., the text line has wrapped), then \fIpixels\fR specifies how
much the line should be indented from the left edge of the window.
\fIPixels\fR may have any of the standard forms for screen distances. This
option is only used when wrapping is enabled, and it only applies to the
second and later display lines for a text line.
.TP
\fB\-offset \fIpixels\fR
.
\fIPixels\fR specifies an amount by which the text's baseline should be offset
vertically from the baseline of the overall line, in pixels. For example, a
positive offset can be used for superscripts and a negative offset can be used
for subscripts. \fIPixels\fR may have any of the standard forms for screen
distances.
.TP
\fB\-overstrike \fIboolean\fR
.
Specifies whether or not to draw a horizontal rule through the middle of
characters. \fIBoolean\fR may have any of the forms accepted by
\fBTcl_GetBoolean\fR.
.TP
\fB\-relief \fIrelief\fR
.
\fIRelief\fR specifies the relief style to use for drawing the border, in any
of the forms accepted by \fBTk_GetRelief\fR. This option is used in
conjunction with the \fB\-borderwidth\fR option to enable to the desired
border appearance.
.TP
\fB\-rmargin \fIpixels\fR
.
If the first non-elided character of a display line has a tag for which this
option has been specified, then \fIpixels\fR specifies how wide a margin to
leave between the end of the line and the right edge of the window.
\fIPixels\fR may have any of the standard forms for screen distances. This
option is only used when wrapping is enabled. If a text line wraps, the right
margin for each line on the display is determined by the first non-elided
character of that display line.
.TP
\fB\-spacing1 \fIpixels\fR
.
\fIPixels\fR specifies how much additional space should be left above each
text line, using any of the standard forms for screen distances. If a line
wraps, this option only applies to the first line on the display.
.TP
\fB\-spacing2 \fIpixels\fR
.
For lines that wrap, this option specifies how much additional space to leave
between the display lines for a single text line. \fIPixels\fR may have any of
the standard forms for screen distances.
.TP
\fB\-spacing3 \fIpixels\fR
.
\fIPixels\fR specifies how much additional space should be left below each
text line, using any of the standard forms for screen distances. If a line
wraps, this option only applies to the last line on the display.
.TP
\fB\-tabs \fItabList\fR
.
\fITabList\fR specifies a set of tab stops in the same form as for the
\fB\-tabs\fR option for the text widget. This option only applies to a display
line if it applies to the first non-elided character on that display line. If
this option is specified as an empty string, it cancels the option, leaving it
unspecified for the tag (the default). If the option is specified as a
non-empty string that is an empty list, such as \fB\-tags\0{\0}\fR, then it
requests default 8-character tabs as described for the \fB\-tags\fR widget
option.
.TP
\fB\-tabstyle \fIstyle\fR
.
\fIStyle\fR specifies either the \fItabular\fR or \fIwordprocessor\fR style of
tabbing to use for the text widget. This option only applies to a display line
if it applies to the first non-elided character on that display line. If this
option is specified as an empty string, it cancels the option, leaving it
unspecified for the tag (the default).
.TP
\fB\-underline \fIboolean\fR
.
\fIBoolean\fR specifies whether or not to draw an underline underneath
characters. It may have any of the forms accepted by \fBTcl_GetBoolean\fR.
.TP
\fB\-wrap \fImode\fR
.
\fIMode\fR specifies how to handle lines that are wider than the text's
window. It has the same legal values as the \fB\-wrap\fR option for the text
widget: \fBnone\fR, \fBchar\fR, or \fBword\fR. If this tag option is
specified, it overrides the \fB\-wrap\fR option for the text widget.
.PP
If a character has several tags associated with it, and if their display
options conflict, then the options of the highest priority tag are used. If a
particular display option has not been specified for a particular tag, or if
it is specified as an empty string, then that option will never be used; the
next-highest-priority tag's option will used instead. If no tag specifies a
particular display option, then the default style for the widget will be used.
.PP
The second purpose for tags is event bindings. You can associate bindings with
a tag in much the same way you can associate bindings with a widget class:
whenever particular X events occur on characters with the given tag, a given
Tcl command will be executed. Tag bindings can be used to give behaviors to
ranges of characters; among other things, this allows hypertext-like features
to be implemented. For details, see the description of the
.QW "\fIpathName \fBtag bind\fR"
widget command below. Tag bindings are shared between all peer widgets
(including any bindings for the special \fBsel\fR tag).
.PP
The third use for tags is in managing the selection. See \fBTHE SELECTION\fR
below. With the exception of the special \fBsel\fR tag, all tags are shared
between peer text widgets, and may be manipulated on an equal basis from any
such widget. The \fBsel\fR tag exists separately and independently in each
peer text widget (but any tag bindings to \fBsel\fR are shared).
.SH MARKS
.PP
The second form of annotation in text widgets is a mark. Marks are used for
remembering particular places in a text. They are something like tags, in that
they have names and they refer to places in the file, but a mark is not
associated with particular characters. Instead, a mark is associated with the
gap between two characters. Only a single position may be associated with a
mark at any given time. If the characters around a mark are deleted the mark
will still remain; it will just have new neighbor characters. In contrast, if
the characters containing a tag are deleted then the tag will no longer have
an association with characters in the file. Marks may be manipulated with the
.QW "\fIpathName \fBmark\fR"
widget command, and their current locations may be determined by using the
mark name as an index in widget commands.
.PP
Each mark also has a
.QW gravity ,
which is either \fBleft\fR or \fBright\fR. The gravity for a mark specifies
what happens to the mark when text is inserted at the point of the mark. If a
mark has left gravity, then the mark is treated as if it were attached to the
character on its left, so the mark will remain to the left of any text
inserted at the mark position. If the mark has right gravity, new text
inserted at the mark position will appear to the left of the mark (so that the
mark remains rightmost). The gravity for a mark defaults to \fBright\fR.
.PP
The name space for marks is different from that for tags: the same name may be
used for both a mark and a tag, but they will refer to different things.
.PP
Two marks have special significance. First, the mark \fBinsert\fR is
associated with the insertion cursor, as described under
\fBTHE INSERTION CURSOR\fR
below. Second, the mark \fBcurrent\fR is associated with the
character closest to the mouse and is adjusted automatically to track the
mouse position and any changes to the text in the widget (one exception:
\fBcurrent\fR is not updated in response to mouse motions if a mouse button is
down; the update will be deferred until all mouse buttons have been released).
Neither of these special marks may be deleted. With the exception of these two
special marks, all marks are shared between peer text widgets, and may be
manipulated on an equal basis from any peer.
.SH "EMBEDDED WINDOWS"
.PP
The third form of annotation in text widgets is an embedded window. Each
embedded window annotation causes a window to be displayed at a particular
point in the text. There may be any number of embedded windows in a text
widget, and any widget may be used as an embedded window (subject to the usual
rules for geometry management, which require the text window to be the parent
of the embedded window or a descendant of its parent). The embedded window's
position on the screen will be updated as the text is modified or scrolled,
and it will be mapped and unmapped as it moves into and out of the visible
area of the text widget. Each embedded window occupies one unit's worth of
index space in the text widget, and it may be referred to either by the name
of its embedded window or by its position in the widget's index space. If the
range of text containing the embedded window is deleted then the window is
destroyed. Similarly if the text widget as a whole is deleted, then the window
is destroyed.
.PP
When an embedded window is added to a text widget with the \fIpathName
\fBwindow create\fR widget command, several configuration options may be
associated with it. These options may be modified later with the \fIpathName
\fBwindow configure\fR widget command. The following options are currently
supported:
.TP
\fB\-align \fIwhere\fR
.
If the window is not as tall as the line in which it is displayed, this option
determines where the window is displayed in the line. \fIWhere\fR must have
one of the values \fBtop\fR (align the top of the window with the top of the
line), \fBcenter\fR (center the window within the range of the line),
\fBbottom\fR (align the bottom of the window with the bottom of the line's
area), or \fBbaseline\fR (align the bottom of the window with the baseline of
the line).
.TP
\fB\-create \fIscript\fR
.
Specifies a Tcl script that may be evaluated to create the window for the
annotation. If no \fB\-window\fR option has been specified for the annotation
this script will be evaluated when the annotation is about to be displayed on
the screen. \fIScript\fR must create a window for the annotation and return
the name of that window as its result. Two substitutions will be performed in
\fIscript\fR before evaluation. \fI%W\fR will be substituted by the name of
the parent text widget, and \fI%%\fR will be substituted by a single \fI%\fR.
If the annotation's window should ever be deleted, \fIscript\fR will be
evaluated again the next time the annotation is displayed.
.TP
\fB\-padx \fIpixels\fR
.
\fIPixels\fR specifies the amount of extra space to leave on each side of the
embedded window. It may have any of the usual forms defined for a screen
distance.
.TP
\fB\-pady \fIpixels\fR
.
\fIPixels\fR specifies the amount of extra space to leave on the top and on
the bottom of the embedded window. It may have any of the usual forms defined
for a screen distance.
.TP
\fB\-stretch \fIboolean\fR
.
If the requested height of the embedded window is less than the height of the
line in which it is displayed, this option can be used to specify whether the
window should be stretched vertically to fill its line. If the \fB\-pady\fR
option has been specified as well, then the requested padding will be retained
even if the window is stretched.
.TP
\fB\-window \fIpathName\fR
.
Specifies the name of a window to display in the annotation. Note that if a
\fIpathName\fR has been set, then later configuring a window to the empty
string will not delete the widget corresponding to the old \fIpathName\fR.
Rather it will remove the association between the old \fIpathName\fR and the
text widget. If multiple peer widgets are in use, it is usually simpler to use
the \fB\-create\fR option if embedded windows are desired in each peer.
.SH "EMBEDDED IMAGES"
.PP
The final form of annotation in text widgets is an embedded image. Each
embedded image annotation causes an image to be displayed at a particular
point in the text. There may be any number of embedded images in a text
widget, and a particular image may be embedded in multiple places in the same
text widget. The embedded image's position on the screen will be updated as
the text is modified or scrolled. Each embedded image occupies one unit's
worth of index space in the text widget, and it may be referred to either by
its position in the widget's index space, or the name it is assigned when the
image is inserted into the text widget with \fIpathName \fBimage create\fR. If
the range of text containing the embedded image is deleted then that copy of
the image is removed from the screen.
.PP
When an embedded image is added to a text widget with the \fIpathName \fBimage
create\fR widget command, a name unique to this instance of the image is
returned. This name may then be used to refer to this image instance. The name
is taken to be the value of the \fB\-name\fR option (described below). If the
\fB\-name\fR option is not provided, the \fB\-image\fR name is used instead.
If the \fIimageName\fR is already in use in the text widget, then \fB#\fInn\fR
is added to the end of the \fIimageName\fR, where \fInn\fR is an arbitrary
integer. This insures the \fIimageName\fR is unique. Once this name is
assigned to this instance of the image, it does not change, even though the
\fB\-image\fR or \fB\-name\fR values can be changed with \fIpathName \fBimage
configure\fR.
.PP
When an embedded image is added to a text widget with the \fIpathName \fBimage
create\fR widget command, several configuration options may be associated with
it. These options may be modified later with the \fIpathName \fBimage
configure\fR widget command. The following options are currently supported:
.TP
\fB\-align \fIwhere\fR
.
If the image is not as tall as the line in which it is displayed, this option
determines where the image is displayed in the line. \fIWhere\fR must have one
of the values \fBtop\fR (align the top of the image with the top of the line),
\fBcenter\fR (center the image within the range of the line), \fBbottom\fR
(align the bottom of the image with the bottom of the line's area), or
\fBbaseline\fR (align the bottom of the image with the baseline of the line).
.TP
\fB\-image \fIimage\fR
.
Specifies the name of the Tk image to display in the annotation. If
\fIimage\fR is not a valid Tk image, then an error is returned.
.TP
\fB\-name \fIImageName\fR
.
Specifies the name by which this image instance may be referenced in the text
widget. If \fIImageName\fR is not supplied, then the name of the Tk image is
used instead. If the \fIimageName\fR is already in use, \fI#nn\fR is appended
to the end of the name as described above.
.TP
\fB\-padx \fIpixels\fR
.
\fIPixels\fR specifies the amount of extra space to leave on each side of the
embedded image. It may have any of the usual forms defined for a screen
distance.
.TP
\fB\-pady \fIpixels\fR
.
\fIPixels\fR specifies the amount of extra space to leave on the top and on
the bottom of the embedded image. It may have any of the usual forms defined
for a screen distance.
.SH "THE SELECTION"
.PP
Selection support is implemented via tags. If the \fBexportSelection\fR option
for the text widget is true then the \fBsel\fR tag will be associated with the
selection:
.IP [1]
Whenever characters are tagged with \fBsel\fR the text widget will claim
ownership of the selection.
.IP [2]
Attempts to retrieve the selection will be serviced by the text widget,
returning all the characters with the \fBsel\fR tag.
.IP [3]
If the selection is claimed away by another application or by another window
within this application, then the \fBsel\fR tag will be removed from all
characters in the text.
.IP [4]
Whenever the \fBsel\fR tag range changes a virtual event \fB<<Selection>>\fR
is generated.
.PP
The \fBsel\fR tag is automatically defined when a text widget is created, and
it may not be deleted with the
.QW "\fIpathName \fBtag delete\fR"
widget command. Furthermore, the \fBselectBackground\fR,
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for the text
widget are tied to the \fB\-background\fR, \fB\-borderwidth\fR, and
\fB\-foreground\fR options for the \fBsel\fR tag: changes in either will
automatically be reflected in the other. Also the
\fB\-inactiveselectbackground\fR option for the text widget is used instead of
\fB\-selectbackground\fR when the text widget does not have the focus. This
allows programmatic control over the visualization of the \fBsel\fR tag for
foreground and background windows, or to have \fBsel\fR not shown at all (when
\fB\-inactiveselectbackground\fR is empty) for background windows. Each peer
text widget has its own \fBsel\fR tag which can be separately configured and
set.
.SH "THE INSERTION CURSOR"
.PP
The mark named \fBinsert\fR has special significance in text widgets. It is
defined automatically when a text widget is created and it may not be unset
with the
.QW "\fIpathName \fBmark unset\fR"
widget command. The \fBinsert\fR mark represents the position of the insertion
cursor, and the insertion cursor will automatically be drawn at this point
whenever the text widget has the input focus.
.SH "THE MODIFIED FLAG"
.PP
The text widget can keep track of changes to the content of the widget by
means of the modified flag. Inserting or deleting text will set this flag. The
flag can be queried, set and cleared programmatically as well. Whenever the
flag changes state a \fB<<Modified>>\fR virtual event is generated. See the
\fIpathName \fBedit modified\fR widget command for more details.
.SH "THE UNDO MECHANISM"
.PP
The text widget has an unlimited undo and redo mechanism (when the
\fB\-undo\fR widget option is true) which records every insert and delete
action on a stack.
.PP
Boundaries (called
.QW separators )
are inserted between edit actions. The purpose of these separators is to group
inserts, deletes and replaces into one compound edit action. When undoing a
change everything between two separators will be undone. The undone changes
are then moved to the redo stack, so that an undone edit can be redone again.
The redo stack is cleared whenever new edit actions are recorded on the undo
stack. The undo and redo stacks can be cleared to keep their depth under
control.
.PP
Separators are inserted automatically when the \fB\-autoseparators\fR widget
option is true. You can insert separators programmatically as well. If a
separator is already present at the top of the undo stack no other will be
inserted. That means that two separators on the undo stack are always
separated by at least one insert or delete action.
.PP
The undo mechanism is also linked to the modified flag. This means that
undoing or redoing changes can take a modified text widget back to the
unmodified state or vice versa. The modified flag will be set automatically to
the appropriate state. This automatic coupling does not work when the modified
flag has been set by the user, until the flag has been reset again.
.PP
See below for the \fIpathName \fBedit\fR widget command that controls the undo
mechanism.
.SH "PEER WIDGETS"
.PP
The text widget has a separate store of all its data concerning each line's
textual contents, marks, tags, images and windows, and the undo stack.
.PP
While this data store cannot be accessed directly (i.e. without a text widget
as an intermediary), multiple text widgets can be created, each of which
present different views on the same underlying data. Such text widgets are
known as peer text widgets.
.PP
As text is added, deleted, edited and coloured in any one widget, and as
images, marks, tags are adjusted, all such changes will be reflected in all
peers.
.PP
All data and markup is shared, except for a few small details. First, the
\fBsel\fR tag may be set and configured (in its display style) differently for
each peer. Second, each peer has its own \fBinsert\fR and \fBcurrent\fR mark
positions (but all other marks are shared). Third, embedded windows, which are
arbitrary other widgets, cannot be shared between peers. This means the
\fB\-window\fR option of embedded windows is independently set for each peer
(it is advisable to use the \fB\-create\fR script capabilities to allow each
peer to create its own embedded windows as needed). Fourth, all of the
configuration options of each peer (e.g. \fB\-font\fR, etc) can be set
independently, with the exception of \fB\-undo\fR, \fB\-maxUndo\fR,
\fB\-autoSeparators\fR (i.e. all undo, redo and modified state issues are
shared).
.PP
Finally any single peer need not contain all lines from the underlying data
store. When creating a peer, a contiguous range of lines (e.g. only lines 52
through 125) may be specified. This allows a peer to contain just a small
portion of the overall text. The range of lines will expand and contract as
text is inserted or deleted. The peer will only ever display complete lines of
text (one cannot share just part of a line). If the peer's contents contracts
to nothing (i.e. all complete lines in the peer widget have been deleted from
another widget), then it is impossible for new lines to be inserted. The peer
will simply become an empty shell on which the background can be configured,
but which will never show any content (without manual reconfiguration of the
start and end lines). Note that a peer which does not contain all of the
underlying data store still has indices numbered from
.QW 1.0
to
.QW end .
It is simply that those indices reflect a subset of the total data, and data
outside the contained range is not accessible to the peer. This means that the
command \fIpeerName \fBindex end\fR may return quite different values in
different peers. Similarly, commands like \fIpeerName \fBtag ranges\fR will
not return index ranges outside that which is meaningful to the peer. The
configuration options \fB\-startline\fR and \fB\-endline\fR may be used to
control how much of the underlying data is contained in any given text widget.
.PP
Note that peers are really peers. Deleting the
.QW original
text widget will not cause any other peers to be deleted, or otherwise
affected.
.PP
See below for the \fIpathName \fBpeer\fR widget command that controls the
creation of peer widgets.
.SH "WIDGET COMMAND"
.PP
The \fBtext\fR command creates a new Tcl command whose name is the same as the
path name of the text's window. This command may be used to invoke various
operations on the widget. It has the following general form:
.CS
\fIpathName option \fR?\fIarg arg ...\fR?
.CE
\fIPathName\fR is the name of the command, which is the same as the text
widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact
behavior of the command. The following commands are possible for text widgets:
.TP
\fIpathName \fBbbox \fIindex\fR
.
Returns a list of four elements describing the screen area of the character
given by \fIindex\fR. The first two elements of the list give the x and y
coordinates of the upper-left corner of the area occupied by the character,
and the last two elements give the width and height of the area. If the
character is only partially visible on the screen, then the return value
reflects just the visible part. If the character is not visible on the screen
then the return value is an empty list.
.TP
\fIpathName \fBcget\fR \fIoption\fR
.
Returns the current value of the configuration option given by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBtext\fR command.
.TP
\fIpathName \fBcompare\fR \fIindex1 op index2\fR
.
Compares the indices given by \fIindex1\fR and \fIindex2\fR according to the
relational operator given by \fIop\fR, and returns 1 if the relationship is
satisfied and 0 if it is not. \fIOp\fR must be one of the operators <, <=, ==,
>=, >, or !=. If \fIop\fR is == then 1 is returned if the two indices refer to
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR refers
to an earlier character in the text than \fIindex2\fR, and so on.
.TP
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
.
Query or modify the configuration options of the widget. If no \fIoption\fR is
specified, returns a list describing all of the available options for
\fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of
this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command
returns a list describing the one named option (this list will be identical to
the corresponding sublist of the value returned if no \fIoption\fR is
specified). If one or more \fIoption\-value\fR pairs are specified, then the
command modifies the given widget option(s) to have the given value(s); in
this case the command returns an empty string. \fIOption\fR may have any of
the values accepted by the \fBtext\fR command.
.TP
\fIpathName \fBcount\fR \fI?options\fR? \fIindex1 index2\fR
.
Counts the number of relevant things between the two indices. If \fIindex1\fR
is after \fIindex2\fR, the result will be a negative number (and this holds
for each of the possible options). The actual items which are counted depend
on the options given. The result is a list of integers, one for the result of
each counting option given. Valid counting options are \fB\-chars\fR,
\fB\-displaychars\fR, \fB\-displayindices\fR, \fB\-displaylines\fR,
\fB\-indices\fR, \fB\-lines\fR, \fB\-xpixels\fR and \fB\-ypixels\fR. The
default value, if no option is specified, is \fB\-indices\fR. There is an
additional possible option \fB\-update\fR which is a modifier. If given, then
all subsequent options ensure that any possible out of date information is
recalculated. This currently only has any effect for the \fI\-ypixels\fR count
(which, if \fB\-update\fR is not given, will use the text widget's current
cached value for each line). The count options are interpreted as follows:
.RS
.IP \fB\-chars\fR
count all characters, whether elided or not. Do not count embedded windows or
images.
.IP \fB\-displaychars\fR
count all non-elided characters.
.IP \fB\-displayindices\fR
count all non-elided characters, windows and images.
.IP \fB\-displaylines\fR
count all display lines (i.e. counting one for each time a line wraps) from
the line of the first index up to, but not including the display line of the
second index. Therefore if they are both on the same display line, zero will
be returned. By definition displaylines are visible and therefore this only
counts portions of actual visible lines.
.IP \fB\-indices\fR
count all characters and embedded windows or images (i.e. everything which
counts in text-widget index space), whether they are elided or not.
.IP \fB\-lines\fR
count all logical lines (irrespective of wrapping) from the line of the first
index up to, but not including the line of the second index. Therefore if they
are both on the same line, zero will be returned. Logical lines are counted
whether they are currently visible (non-elided) or not.
.IP \fB\-xpixels\fR
count the number of horizontal pixels from the first pixel of the first index
to (but not including) the first pixel of the second index. To count the total
desired width of the text widget (assuming wrapping is not enabled), first
find the longest line and then use
.QW ".text count \-xpixels \N'34'${line}.0\N'34' \N'34'${line}.0 lineend\N'34'" .
.IP \fB\-ypixels\fR
count the number of vertical pixels from the first pixel of the first index to
(but not including) the first pixel of the second index. If both indices are
on the same display line, zero will be returned. To count the total number of
vertical pixels in the text widget, use
.QW ".text count \-ypixels 1.0 end" ,
and to ensure this is up to date, use
.QW ".text count \-update \-ypixels 1.0 end" .
.PP
The command returns a positive or negative integer corresponding to the number
of items counted between the two indices. One such integer is returned for
each counting option given, so a list is returned if more than one option was
supplied. For example
.QW ".text count \-xpixels \-ypixels 1.3 4.5"
is perfectly valid and will return a list of two elements.
.RE
.TP
\fIpathName \fBdebug \fR?\fIboolean\fR?
.
If \fIboolean\fR is specified, then it must have one of the true or false
values accepted by Tcl_GetBoolean. If the value is a true one then internal
consistency checks will be turned on in the B-tree code associated with text
widgets. If \fIboolean\fR has a false value then the debugging checks will be
turned off. In either case the command returns an empty string. If
\fIboolean\fR is not specified then the command returns \fBon\fR or \fBoff\fR
to indicate whether or not debugging is turned on. There is a single debugging
switch shared by all text widgets: turning debugging on or off in any widget
turns it on or off for all widgets. For widgets with large amounts of text,
the consistency checks may cause a noticeable slow-down.
.RS
.PP
When debugging is turned on, the drawing routines of the text widget set the
global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR to the lists of
indices that are redrawn. The values of these variables are tested by Tk's
test suite.
.RE
.TP
\fIpathName \fBdelete \fIindex1 \fR?\fIindex2 ...\fR?
.
Delete a range of characters from the text. If both \fIindex1\fR and
\fIindex2\fR are specified, then delete all the characters starting with the
one given by \fIindex1\fR and stopping just before \fIindex2\fR (i.e. the
character at \fIindex2\fR is not deleted). If \fIindex2\fR does not specify a
position later in the text than \fIindex1\fR then no characters are deleted.
If \fIindex2\fR is not specified then the single character at \fIindex1\fR is
deleted. It is not allowable to delete characters in a way that would leave
the text without a newline as the last character. The command returns an empty
string. If more indices are given, multiple ranges of text will be deleted.
All indices are first checked for validity before any deletions are made. They
are sorted and the text is removed from the last range to the first range so
deleted text does not cause an undesired index shifting side-effects. If
multiple ranges with the same start index are given, then the longest range is
used. If overlapping ranges are given, then they will be merged into spans
that do not cause deletion of text outside the given ranges due to text
shifted during deletion.
.TP
\fIpathName \fBdlineinfo \fIindex\fR
.
Returns a list with five elements describing the area occupied by the display
line containing \fIindex\fR. The first two elements of the list give the x and
y coordinates of the upper-left corner of the area occupied by the line, the
third and fourth elements give the width and height of the area, and the fifth
element gives the position of the baseline for the line, measured down from
the top of the area. All of this information is measured in pixels. If the
current wrap mode is \fBnone\fR and the line extends beyond the boundaries of
the window, the area returned reflects the entire area of the line, including
the portions that are out of the window. If the line is shorter than the full
width of the window then the area returned reflects just the portion of the
line that is occupied by characters and embedded windows. If the display line
containing \fIindex\fR is not visible on the screen then the return value is
an empty list.
.TP
\fIpathName \fBdump \fR?\fIswitches\fR? \fIindex1 \fR?\fIindex2\fR?
.
Return the contents of the text widget from \fIindex1\fR up to, but not
including \fIindex2\fR, including the text and information about marks, tags,
and embedded windows. If \fIindex2\fR is not specified, then it defaults to
one character past \fIindex1\fR. The information is returned in the following
format:
.LP
.RS
\fIkey1 value1 index1 key2 value2 index2\fR ...
.LP
The possible \fIkey\fR values are \fBtext\fR, \fBmark\fR, \fBtagon\fR,
\fBtagoff\fR, \fBimage\fR, and \fBwindow\fR. The corresponding \fIvalue\fR is
the text, mark name, tag name, image name, or window name. The \fIindex\fR
information is the index of the start of the text, mark, tag transition, image
or window. One or more of the following switches (or abbreviations thereof)
may be specified to control the dump:
.TP
\fB\-all\fR
.
Return information about all elements: text, marks, tags, images and windows.
This is the default.
.TP
\fB\-command \fIcommand\fR
.
Instead of returning the information as the result of the dump operation,
invoke the \fIcommand\fR on each element of the text widget within the range.
The command has three arguments appended to it before it is evaluated: the
\fIkey\fR, \fIvalue\fR, and \fIindex\fR.
.TP
\fB\-image\fR
.
Include information about images in the dump results.
.TP
\fB\-mark\fR
.
Include information about marks in the dump results.
.TP
\fB\-tag\fR
.
Include information about tag transitions in the dump results. Tag information
is returned as \fBtagon\fR and \fBtagoff\fR elements that indicate the begin
and end of each range of each tag, respectively.
.TP
\fB\-text\fR
.
Include information about text in the dump results. The value is the text up
to the next element or the end of range indicated by \fIindex2\fR. A text
element does not span newlines. A multi-line block of text that contains no
marks or tag transitions will still be dumped as a set of text segments that
each end with a newline. The newline is part of the value.
.TP
\fB\-window\fR
.
Include information about embedded windows in the dump results. The value of a
window is its Tk pathname, unless the window has not been created yet. (It
must have a create script.) In this case an empty string is returned, and you
must query the window by its index position to get more information.
.RE
.TP
\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
.
This command controls the undo mechanism and the modified flag. The exact
behavior of the command depends on the \fIoption\fR argument that follows the
\fBedit\fR argument. The following forms of the command are currently
supported:
.RS
.TP
\fIpathName \fBedit modified ?\fIboolean\fR?
.
If \fIboolean\fR is not specified, returns the modified flag of the widget.
The insert, delete, edit undo and edit redo commands or the user can set or
clear the modified flag. If \fIboolean\fR is specified, sets the modified flag
of the widget to \fIboolean\fR.
.TP
\fIpathName \fBedit redo\fR
.
When the \fB\-undo\fR option is true, reapplies the last undone edits provided
no other edits were done since then. Generates an error when the redo stack is
empty. Does nothing when the \fB\-undo\fR option is false.
.TP
\fIpathName \fBedit reset\fR
.
Clears the undo and redo stacks.
.TP
\fIpathName \fBedit separator\fR
.
Inserts a separator (boundary) on the undo stack. Does nothing when the
\fB\-undo\fR option is false.
.TP
\fIpathName \fBedit undo\fR
.
Undoes the last edit action when the \fB\-undo\fR option is true. An edit
action is defined as all the insert and delete commands that are recorded on
the undo stack in between two separators. Generates an error when the undo
stack is empty. Does nothing when the \fB\-undo\fR option is false.
.RE
.TP
\fIpathName \fBget\fR \fI?\-displaychars?\fR \fI\-\- index1\fR ?\fIindex2 ...\fR?
.
Return a range of characters from the text. The return value will be all the
characters in the text starting with the one whose index is \fIindex1\fR and
ending just before the one whose index is \fIindex2\fR (the character at
\fIindex2\fR will not be returned). If \fIindex2\fR is omitted then the single
character at \fIindex1\fR is returned. If there are no characters in the
specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR
is less than or equal to \fIindex1\fR) then an empty string is returned. If
the specified range contains embedded windows, no information about them is
included in the returned string. If multiple index pairs are given, multiple
ranges of text will be returned in a list. Invalid ranges will not be
represented with empty strings in the list. The ranges are returned in the
order passed to \fIpathName \fBget\fR. If the \fB\-displaychars\fR option is
given, then, within each range, only those characters which are not elided
will be returned. This may have the effect that some of the returned ranges
are empty strings.
.TP
\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
.
This command is used to manipulate embedded images. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBtag\fR
argument. The following forms of the command are currently supported:
.RS
.TP
\fIpathName \fBimage cget\fR \fIindex option\fR
.
Returns the value of a configuration option for an embedded image. \fIIndex\fR
identifies the embedded image, and \fIoption\fR specifies a particular
configuration option, which must be one of the ones listed in the section
\fBEMBEDDED IMAGES\fR.
.TP
\fIpathName \fBimage configure \fIindex\fR ?\fIoption value ...\fR?
.
Query or modify the configuration options for an embedded image. If no
\fIoption\fR is specified, returns a list describing all of the available
options for the embedded image at \fIindex\fR (see \fBTk_ConfigureInfo\fR for
information on the format of this list). If \fIoption\fR is specified with no
\fIvalue\fR, then the command returns a list describing the one named option
(this list will be identical to the corresponding sublist of the value
returned if no \fIoption\fR is specified). If one or more \fIoption\-value\fR
pairs are specified, then the command modifies the given option(s) to have the
given value(s); in this case the command returns an empty string. See
\fBEMBEDDED IMAGES\fR for information on the options that are supported.
.TP
\fIpathName \fBimage create \fIindex\fR ?\fIoption value ...\fR?
.
This command creates a new image annotation, which will appear in the text at
the position given by \fIindex\fR. Any number of \fIoption\-value\fR pairs may
be specified to configure the annotation. Returns a unique identifier that may
be used as an index to refer to this image. See \fBEMBEDDED IMAGES\fR for
information on the options that are supported, and a description of the
identifier returned.
.TP
\fIpathName \fBimage names\fR
.
Returns a list whose elements are the names of all image instances currently
embedded in \fIwindow\fR.
.RE
.TP
\fIpathName \fBindex \fIindex\fR
.
Returns the position corresponding to \fIindex\fR in the form \fIline.char\fR
where \fIline\fR is the line number and \fIchar\fR is the character number.
\fIIndex\fR may have any of the forms described under \fBINDICES\fR above.
.TP
\fIpathName \fBinsert \fIindex chars \fR?\fItagList chars tagList ...\fR?
.
Inserts all of the \fIchars\fR arguments just before the character at
\fIindex\fR. If \fIindex\fR refers to the end of the text (the character after
the last newline) then the new text is inserted just before the last newline
instead. If there is a single \fIchars\fR argument and no \fItagList\fR, then
the new text will receive any tags that are present on both the character
before and the character after the insertion point; if a tag is present on
only one of these characters then it will not be applied to the new text. If
\fItagList\fR is specified then it consists of a list of tag names; the new
characters will receive all of the tags in this list and no others, regardless
of the tags present around the insertion point. If multiple
\fIchars\fR\-\fItagList\fR argument pairs are present, they produce the same
effect as if a separate \fIpathName \fBinsert\fR widget command had been
issued for each pair, in order. The last \fItagList\fR argument may be
omitted.
.TP
\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?
.
This command is used to manipulate marks. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBmark\fR argument. The
following forms of the command are currently supported:
.RS
.TP
\fIpathName \fBmark gravity \fImarkName\fR ?\fIdirection\fR?
.
If \fIdirection\fR is not specified, returns \fBleft\fR or \fBright\fR to
indicate which of its adjacent characters \fImarkName\fR is attached to. If
\fIdirection\fR is specified, it must be \fBleft\fR or \fBright\fR; the
gravity of \fImarkName\fR is set to the given value.
.TP
\fIpathName \fBmark names\fR
.
Returns a list whose elements are the names of all the marks that are
currently set.
.TP
\fIpathName \fBmark next \fIindex\fR
.
Returns the name of the next mark at or after \fIindex\fR. If \fIindex\fR is
specified in numerical form, then the search for the next mark begins at that
index. If \fIindex\fR is the name of a mark, then the search for the next mark
begins immediately after that mark. This can still return a mark at the same
position if there are multiple marks at the same index. These semantics mean
that the \fBmark next\fR operation can be used to step through all the marks
in a text widget in the same order as the mark information returned by the
\fIpathName \fBdump\fR operation. If a mark has been set to the special
\fBend\fR index, then it appears to be \fIafter\fR \fBend\fR with respect to
the \fIpathName \fBmark next\fR operation. An empty string is returned if
there are no marks after \fIindex\fR.
.TP
\fIpathName \fBmark previous \fIindex\fR
.
Returns the name of the mark at or before \fIindex\fR. If \fIindex\fR is
specified in numerical form, then the search for the previous mark begins with
the character just before that index. If \fIindex\fR is the name of a mark,
then the search for the next mark begins immediately before that mark. This
can still return a mark at the same position if there are multiple marks at
the same index. These semantics mean that the \fIpathName \fBmark previous\fR
operation can be used to step through all the marks in a text widget in the
reverse order as the mark information returned by the \fIpathName \fBdump\fR
operation. An empty string is returned if there are no marks before
\fIindex\fR.
.TP
\fIpathName \fBmark set \fImarkName index\fR
.
Sets the mark named \fImarkName\fR to a position just before the character at
\fIindex\fR. If \fImarkName\fR already exists, it is moved from its old
position; if it does not exist, a new mark is created. This command returns an
empty string.
.TP
\fIpathName \fBmark unset \fImarkName \fR?\fImarkName markName ...\fR?
.
Remove the mark corresponding to each of the \fImarkName\fR arguments. The
removed marks will not be usable in indices and will not be returned by future
calls to
.QW "\fIpathName \fBmark names\fR" .
This command returns an empty string.
.RE
.TP
\fIpathName \fBpeer\fR \fIoption args\fR
.
This command is used to create and query widget peers. It has two forms,
depending on \fIoption\fR:
.RS
.TP
\fIpathName \fBpeer create \fInewPathName\fR ?\fIoptions\fR?
.
Creates a peer text widget with the given \fInewPathName\fR, and any optional
standard configuration options (as for the \fItext\fR command). By default the
peer will have the same start and end line as the parent widget, but these can
be overridden with the standard configuration options.
.TP
\fIpathName \fBpeer names\fR
.
Returns a list of peers of this widget (this does not include the widget
itself). The order within this list is undefined.
.RE
.TP
\fIpathName \fBreplace\fR \fIindex1 index2 chars\fR ?\fItagList chars tagList ...\fR?
.
Replaces the range of characters between \fIindex1\fR and \fIindex2\fR with
the given characters and tags. See the section on \fIpathName \fBinsert\fR for
an explanation of the handling of the \fItagList...\fR arguments, and the
section on \fIpathName \fBdelete\fR for an explanation of the handling of the
indices. If \fIindex2\fR corresponds to an index earlier in the text than
\fIindex1\fR, an error will be generated.
.RS
.PP
The deletion and insertion are arranged so that no unnecessary scrolling of
the window or movement of insertion cursor occurs. In addition the undo/redo
stack are correctly modified, if undo operations are active in the text
widget. The command returns an empty string.
.RE
.TP
\fIpathName \fBscan\fR \fIoption args\fR
.
This command is used to implement scanning on texts. It has two forms,
depending on \fIoption\fR:
.RS
.TP
\fIpathName \fBscan mark \fIx y\fR
.
Records \fIx\fR and \fIy\fR and the current view in the text window, for use
in conjunction with later \fIpathName \fBscan dragto\fR commands. Typically
this command is associated with a mouse button press in the widget. It returns
an empty string.
.TP
\fIpathName \fBscan dragto \fIx y\fR
.
This command computes the difference between its \fIx\fR and \fIy\fR arguments
and the \fIx\fR and \fIy\fR arguments to the last \fIpathName \fBscan mark\fR
command for the widget. It then adjusts the view by 10 times the difference in
coordinates. This command is typically associated with mouse motion events in
the widget, to produce the effect of dragging the text at high speed through
the window. The return value is an empty string.
.RE
.TP
\fIpathName \fBsearch \fR?\fIswitches\fR? \fIpattern index \fR?\fIstopIndex\fR?
.
Searches the text in \fIpathName\fR starting at \fIindex\fR for a range of
characters that matches \fIpattern\fR. If a match is found, the index of the
first character in the match is returned as result; otherwise an empty string
is returned. One or more of the following switches (or abbreviations thereof)
may be specified to control the search:
.RS
.TP
\fB\-forwards\fR
.
The search will proceed forward through the text, finding the first matching
range starting at or after the position given by \fIindex\fR. This is the
default.
.TP
\fB\-backwards\fR
.
The search will proceed backward through the text, finding the matching range
closest to \fIindex\fR whose first character is before \fIindex\fR (it is not
allowed to be at \fIindex\fR). Note that, for a variety of reasons, backwards
searches can be substantially slower than forwards searches (particularly when
using \fB\-regexp\fR), so it is recommended that performance-critical code use
forward searches.
.TP
\fB\-exact\fR
.
Use exact matching: the characters in the matching range must be identical to
those in \fIpattern\fR. This is the default.
.TP
\fB\-regexp\fR
.
Treat \fIpattern\fR as a regular expression and match it against the text
using the rules for regular expressions (see the \fBregexp\fR command for
details). The default matching automatically passes both the
\fB\-lineanchor\fR and \fB\-linestop\fR options to the regexp engine (unless
\fB\-nolinestop\fR is used), so that \fI^$\fR match beginning and end of line,
and \fI.\fR, \fI[^\fR sequences will never match the newline character
\fI\en\fR.
.TP
\fB\-nolinestop\fR
.
This allows \fI.\fR and \fI[^\fR sequences to match the newline character
\fI\en\fR, which they will otherwise not do (see the \fBregexp\fR command for
details). This option is only meaningful if \fB\-regexp\fR is also given, and
an error will be thrown otherwise. For example, to match the entire text, use
.QW "\fIpathName \fBsearch \-nolinestop \-regexp\fR \N'34'.*\N'34' 1.0" .
.TP
\fB\-nocase\fR
.
Ignore case differences between the pattern and the text.
.TP
\fB\-count\fI varName\fR
.
The argument following \fB\-count\fR gives the name of a variable; if a match
is found, the number of index positions between beginning and end of the
matching range will be stored in the variable. If there are no embedded images
or windows in the matching range (and there are no elided characters if
\fB\-elide\fR is not given), this is equivalent to the number of characters
matched. In either case, the range \fImatchIdx\fR to \fImatchIdx + $count
chars\fR will return the entire matched text.
.TP
\fB\-all\fR
.
Find all matches in the given range and return a list of the indices of the
first character of each match. If a \fB\-count\fI varName\fR switch is given,
then \fIvarName\fR is also set to a list containing one element for each
successful match. Note that, even for exact searches, the elements of this
list may be different, if there are embedded images, windows or hidden text.
Searches with \fB\-all\fR behave very similarly to the Tcl command \fBregexp
\-all\fR, in that overlapping matches are not normally returned. For example,
applying an \fB\-all\fR search of the pattern
.QW \ew+
against
.QW "hello there"
will just match twice, once for each word, and matching
.QW "Z[a\-z]+Z"
against
.QW ZooZooZoo
will just match once.
.TP
\fB\-overlap\fR
.
When performing \fB\-all\fR searches, the normal behaviour is that matches
which overlap an already-found match will not be returned. This switch changes
that behaviour so that all matches which are not totally enclosed within
another match are returned. For example, applying an \fB\-overlap\fR search of
the pattern
.QW \ew+
against
.QW "hello there"
will just match twice (i.e. no different to just \fB\-all\fR), but matching
.QW Z[a\-z]+Z
against
.QW ZooZooZoo
will now match twice. An error will be thrown if this switch is used without
\fB\-all\fR.
.TP
\fB\-strictlimits\fR
.
When performing any search, the normal behaviour is that the start and stop
limits are checked with respect to the start of the matching text. With the
\fB\-strictlimits\fR flag, the entire matching range must lie inside the start
and stop limits specified for the match to be valid.
.TP
\fB\-elide\fR
.
Find elided (hidden) text as well. By default only displayed text is searched.
.TP
\fB\-\|\-\fR
.
This switch has no effect except to terminate the list of switches: the next
argument will be treated as \fIpattern\fR even if it starts with \fB\-\fR.
.PP
The matching range may be within a single line of text, or run across multiple
lines (if parts of the pattern can match a new-line). For regular expression
matching one can use the various newline-matching features such as \fB$\fR to
match the end of a line, \fB^\fR to match the beginning of a line, and to
control whether \fB.\fR is allowed to match a new-line. If \fIstopIndex\fR is
specified, the search stops at that index: for forward searches, no match at
or after \fIstopIndex\fR will be considered; for backward searches, no match
earlier in the text than \fIstopIndex\fR will be considered. If
\fIstopIndex\fR is omitted, the entire text will be searched: when the
beginning or end of the text is reached, the search continues at the other end
until the starting location is reached again; if \fIstopIndex\fR is specified,
no wrap-around will occur. This means that, for example, if the search is
\fB\-forwards\fR but \fIstopIndex\fR is earlier in the text than
\fIstartIndex\fR, nothing will ever be found. See \fBKNOWN BUGS\fR below for a
number of minor limitations of the \fIpathName \fBsearch\fR command.
.RE
.TP
\fIpathName \fBsee \fIindex\fR
.
Adjusts the view in the window so that the character given by \fIindex\fR is
completely visible. If \fIindex\fR is already visible then the command does
nothing. If \fIindex\fR is a short distance out of view, the command adjusts
the view just enough to make \fIindex\fR visible at the edge of the window.
If \fIindex\fR is far out of view, then the command centers \fIindex\fR in the
window.
.TP
\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?
.
This command is used to manipulate tags. The exact behavior of the command
depends on the \fIoption\fR argument that follows the \fBtag\fR argument. The
following forms of the command are currently supported:
.RS
.TP
\fIpathName \fBtag add \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
.
Associate the tag \fItagName\fR with all of the characters starting with
\fIindex1\fR and ending just before \fIindex2\fR (the character at
\fIindex2\fR is not tagged). A single command may contain any number of
\fIindex1\fR\-\fIindex2\fR pairs. If the last \fIindex2\fR is omitted then the
single character at \fIindex1\fR is tagged. If there are no characters in the
specified range (e.g. \fIindex1\fR is past the end of the file or \fIindex2\fR
is less than or equal to \fIindex1\fR) then the command has no effect.
.TP
\fIpathName \fBtag bind \fItagName\fR ?\fIsequence\fR? ?\fIscript\fR?
.
This command associates \fIscript\fR with the tag given by \fItagName\fR.
Whenever the event sequence given by \fIsequence\fR occurs for a character
that has been tagged with \fItagName\fR, the script will be invoked. This
widget command is similar to the \fBbind\fR command except that it operates on
characters in a text rather than entire widgets. See the \fBbind\fR manual
entry for complete details on the syntax of \fIsequence\fR and the
substitutions performed on \fIscript\fR before invoking it. If all arguments
are specified then a new binding is created, replacing any existing binding
for the same \fIsequence\fR and \fItagName\fR (if the first character of
\fIscript\fR is
.QW +
then \fIscript\fR augments an existing binding rather than replacing it). In
this case the return value is an empty string. If \fIscript\fR is omitted then
the command returns the \fIscript\fR associated with \fItagName\fR and
\fIsequence\fR (an error occurs if there is no such binding). If both
\fIscript\fR and \fIsequence\fR are omitted then the command returns a list of
all the sequences for which bindings have been defined for \fItagName\fR.
.RS
.PP
The only events for which bindings may be specified are those related to the
mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButtonPress\fR,
\fBMotion\fR, and \fBKeyPress\fR) or virtual events. Event bindings for a text
widget use the \fBcurrent\fR mark described under \fBMARKS\fR above. An
\fBEnter\fR event triggers for a tag when the tag first becomes present on the
current character, and a \fBLeave\fR event triggers for a tag when it ceases
to be present on the current character. \fBEnter\fR and \fBLeave\fR events can
happen either because the \fBcurrent\fR mark moved or because the character at
that position changed. Note that these events are different than \fBEnter\fR
and \fBLeave\fR events for windows. Mouse and keyboard events are directed to
the current character. If a virtual event is used in a binding, that binding
can trigger only if the virtual event is defined by an underlying
mouse-related or keyboard-related event.
.PP
It is possible for the current character to have multiple tags, and for each
of them to have a binding for a particular event sequence. When this occurs,
one binding is invoked for each tag, in order from lowest-priority to highest
priority. If there are multiple matching bindings for a single tag, then the
most specific binding is chosen (see the manual entry for the \fBbind\fR
command for details). \fBcontinue\fR and \fBbreak\fR commands within binding
scripts are processed in the same way as for bindings created with the
\fBbind\fR command.
.PP
If bindings are created for the widget as a whole using the \fBbind\fR
command, then those bindings will supplement the tag bindings. The tag
bindings will be invoked first, followed by bindings for the window as a
whole.
.RE
.TP
\fIpathName \fBtag cget\fR \fItagName option\fR
.
This command returns the current value of the option named \fIoption\fR
associated with the tag given by \fItagName\fR. \fIOption\fR may have any of
the values accepted by the \fIpathName \fBtag configure\fR widget command.
.TP
\fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
.
This command is similar to the \fIpathName \fBconfigure\fR widget command
except that it modifies options associated with the tag given by \fItagName\fR
instead of modifying options for the overall text widget. If no \fIoption\fR
is specified, the command returns a list describing all of the available
options for \fItagName\fR (see \fBTk_ConfigureInfo\fR for information on the
format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then
the command returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
\fIoption\fR is specified). If one or more \fIoption\-value\fR pairs are
specified, then the command modifies the given option(s) to have the given
value(s) in \fItagName\fR; in this case the command returns an empty string.
See \fBTAGS\fR above for details on the options available for tags.
.TP
\fIpathName \fBtag delete \fItagName \fR?\fItagName ...\fR?
.
Deletes all tag information for each of the \fItagName\fR arguments. The
command removes the tags from all characters in the file and also deletes any
other information associated with the tags, such as bindings and display
information. The command returns an empty string.
.TP
\fIpathName\fB tag lower \fItagName \fR?\fIbelowThis\fR?
.
Changes the priority of tag \fItagName\fR so that it is just lower in priority
than the tag whose name is \fIbelowThis\fR. If \fIbelowThis\fR is omitted,
then \fItagName\fR's priority is changed to make it lowest priority of all
tags.
.TP
\fIpathName \fBtag names \fR?\fIindex\fR?
.
Returns a list whose elements are the names of all the tags that are active at
the character position given by \fIindex\fR. If \fIindex\fR is omitted, then
the return value will describe all of the tags that exist for the text (this
includes all tags that have been named in a
.QW "\fIpathName \fBtag\fR"
widget command but have not been deleted by a
.QW "\fIpathName \fBtag delete\fR"
widget command, even if no characters are currently marked with the tag). The
list will be sorted in order from lowest priority to highest priority.
.TP
\fIpathName \fBtag nextrange \fItagName index1 \fR?\fIindex2\fR?
.
This command searches the text for a range of characters tagged with
\fItagName\fR where the first character of the range is no earlier than the
character at \fIindex1\fR and no later than the character just before
\fIindex2\fR (a range starting at \fIindex2\fR will not be considered). If
several matching ranges exist, the first one is chosen. The command's return
value is a list containing two elements, which are the index of the first
character of the range and the index of the character just after the last one
in the range. If no matching range is found then the return value is an empty
string. If \fIindex2\fR is not given then it defaults to the end of the text.
.TP
\fIpathName \fBtag prevrange \fItagName index1 \fR?\fIindex2\fR?
.
This command searches the text for a range of characters tagged with
\fItagName\fR where the first character of the range is before the character
at \fIindex1\fR and no earlier than the character at \fIindex2\fR (a range
starting at \fIindex2\fR will be considered). If several matching ranges
exist, the one closest to \fIindex1\fR is chosen. The command's return value
is a list containing two elements, which are the index of the first character
of the range and the index of the character just after the last one in the
range. If no matching range is found then the return value is an empty string.
If \fIindex2\fR is not given then it defaults to the beginning of the text.
.TP
\fIpathName\fB tag raise \fItagName \fR?\fIaboveThis\fR?
.
Changes the priority of tag \fItagName\fR so that it is just higher in
priority than the tag whose name is \fIaboveThis\fR. If \fIaboveThis\fR is
omitted, then \fItagName\fR's priority is changed to make it highest priority
of all tags.
.TP
\fIpathName \fBtag ranges \fItagName\fR
.
Returns a list describing all of the ranges of text that have been tagged with
\fItagName\fR. The first two elements of the list describe the first tagged
range in the text, the next two elements describe the second range, and so on.
The first element of each pair contains the index of the first character of
the range, and the second element of the pair contains the index of the
character just after the last one in the range. If there are no characters
tagged with \fItag\fR then an empty string is returned.
.TP
\fIpathName \fBtag remove \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
.
Remove the tag \fItagName\fR from all of the characters starting at
\fIindex1\fR and ending just before \fIindex2\fR (the character at
\fIindex2\fR is not affected). A single command may contain any number of
\fIindex1\fR\-\fIindex2\fR pairs. If the last \fIindex2\fR is omitted then the
tag is removed from the single character at \fIindex1\fR. If there are no
characters in the specified range (e.g. \fIindex1\fR is past the end of the
file or \fIindex2\fR is less than or equal to \fIindex1\fR) then the command
has no effect. This command returns an empty string.
.RE
.TP
\fIpathName \fBwindow \fIoption \fR?\fIarg arg ...\fR?
.
This command is used to manipulate embedded windows. The behavior of the
command depends on the \fIoption\fR argument that follows the \fBtag\fR
argument. The following forms of the command are currently supported:
.RS
.TP
\fIpathName \fBwindow cget\fR \fIindex option\fR
.
Returns the value of a configuration option for an embedded window.
\fIIndex\fR identifies the embedded window, and \fIoption\fR specifies a
particular configuration option, which must be one of the ones listed in the
section \fBEMBEDDED WINDOWS\fR.
.TP
\fIpathName \fBwindow configure \fIindex\fR ?\fIoption value ...\fR?
.
Query or modify the configuration options for an embedded window. If no
\fIoption\fR is specified, returns a list describing all of the available
options for the embedded window at \fIindex\fR (see \fBTk_ConfigureInfo\fR for
information on the format of this list). If \fIoption\fR is specified with no
\fIvalue\fR, then the command returns a list describing the one named option
(this list will be identical to the corresponding sublist of the value
returned if no \fIoption\fR is specified). If one or more \fIoption\-value\fR
pairs are specified, then the command modifies the given option(s) to have the
given value(s); in this case the command returns an empty string. See
\fBEMBEDDED WINDOWS\fR for information on the options that are supported.
.TP
\fIpathName \fBwindow create \fIindex\fR ?\fIoption value ...\fR?
.
This command creates a new window annotation, which will appear in the text at
the position given by \fIindex\fR. Any number of \fIoption\-value\fR pairs may
be specified to configure the annotation. See \fBEMBEDDED WINDOWS\fR for
information on the options that are supported. Returns an empty string.
.TP
\fIpathName \fBwindow names\fR
.
Returns a list whose elements are the names of all windows currently embedded
in \fIwindow\fR.
.RE
.TP
\fIpathName \fBxview \fIoption args\fR
.
This command is used to query and change the horizontal position of the text
in the widget's window. It can take any of the following forms:
.RS
.TP
\fIpathName \fBxview\fR
.
Returns a list containing two elements. Each element is a real fraction
between 0 and 1; together they describe the portion of the document's
horizontal span that is visible in the window. For example, if the first
element is .2 and the second element is .6, 20% of the text is off-screen to
the left, the middle 40% is visible in the window, and 40% of the text is
off-screen to the right. The fractions refer only to the lines that are
actually visible in the window: if the lines in the window are all very short,
so that they are entirely visible, the returned fractions will be 0 and 1,
even if there are other lines in the text that are much wider than the window.
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
option.
.TP
\fIpathName \fBxview moveto\fI fraction\fR
.
Adjusts the view in the window so that \fIfraction\fR of the horizontal span
of the text is off-screen to the left. \fIFraction\fR is a fraction between 0
and 1.
.TP
\fIpathName \fBxview scroll \fInumber what\fR
.
This command shifts the view in the window left or right according to
\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBunits\fR, \fBpages\fR or
\fBpixels\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR
must be an integer, otherwise number may be specified in any of the forms
acceptable to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded to the nearest integer value. If no units are given,
pixels are assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts left or
right by \fInumber\fR average-width characters on the display; if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is
\fBpixels\fR then the view adjusts by \fInumber\fR pixels. If \fInumber\fR is
negative then characters farther to the left become visible; if it is positive
then characters farther to the right become visible.
.RE
.TP
\fIpathName \fByview \fI?args\fR?
.
This command is used to query and change the vertical position of the text in
the widget's window. It can take any of the following forms:
.RS
.TP
\fIpathName \fByview\fR
.
Returns a list containing two elements, both of which are real fractions
between 0 and 1. The first element gives the position of the first visible
pixel of the first character (or image, etc) in the top line in the window,
relative to the text as a whole (0.5 means it is halfway through the text, for
example). The second element gives the position of the first pixel just after
the last visible one in the bottom line of the window, relative to the text as
a whole. These are the same values passed to scrollbars via the
\fB\-yscrollcommand\fR option.
.TP
\fIpathName \fByview moveto\fI fraction\fR
.
Adjusts the view in the window so that the pixel given by \fIfraction\fR
appears at the top of the top line of the window. \fIFraction\fR is a fraction
between 0 and 1; 0 indicates the first pixel of the first character in the
text, 0.33 indicates the pixel that is one-third the way through the text; and
so on. Values close to 1 will indicate values close to the last pixel in the
text (1 actually refers to one pixel beyond the last pixel), but in such cases
the widget will never scroll beyond the last pixel, and so a value of 1 will
effectively be rounded back to whatever fraction ensures the last pixel is at
the bottom of the window, and some other pixel is at the top.
.TP
\fIpathName \fByview scroll \fInumber what\fR
.
This command adjust the view in the window up or down according to
\fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBunits\fR, \fBpages\fR or
\fBpixels\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR
must be an integer, otherwise number may be specified in any of the forms
acceptable to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded to the nearest integer value. If no units are given,
pixels are assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts up or down
by \fInumber\fR lines on the display; if it is \fBpages\fR then the view
adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view
adjusts by \fInumber\fR pixels. If \fInumber\fR is negative then earlier
positions in the text become visible; if it is positive then later positions
in the text become visible.
.TP
\fIpathName \fByview \fR?\fB\-pickplace\fR? \fIindex\fR
.
Changes the view in the widget's window to make \fIindex\fR visible. If the
\fB\-pickplace\fR option is not specified then \fIindex\fR will appear at the
top of the window. If \fB\-pickplace\fR is specified then the widget chooses
where \fIindex\fR appears in the window:
.RS
.IP [1]
If \fIindex\fR is already visible somewhere in the window then the command
does nothing.
.IP [2]
If \fIindex\fR is only a few lines off-screen above the window then it will be
positioned at the top of the window.
.IP [3]
If \fIindex\fR is only a few lines off-screen below the window then it will be
positioned at the bottom of the window.
.IP [4]
Otherwise, \fIindex\fR will be centered in the window.
.LP
The \fB\-pickplace\fR option has been obsoleted by the \fIpathName \fBsee\fR
widget command (\fIpathName \fBsee\fR handles both x- and y-motion to make a
location visible, whereas the \fB\-pickplace\fR mode only handles motion in
y).
.RE
.TP
\fIpathName \fByview \fInumber\fR
.
This command makes the first character on the line after the one given by
\fInumber\fR visible at the top of the window. \fINumber\fR must be an
integer. This command used to be used for scrolling, but now it is obsolete.
.RE
.SH BINDINGS
.PP
Tk automatically creates class bindings for texts that give them the following
default behavior. In the descriptions below,
.QW word
is dependent on the value of the \fBtcl_wordchars\fR variable. See
\fBtclvars\fR(n).
.IP [1]
Clicking mouse button 1 positions the insertion cursor just before the
character underneath the mouse cursor, sets the input focus to this widget,
and clears any selection in the widget. Dragging with mouse button 1 strokes
out a selection between the insertion cursor and the character under the
mouse.
.IP [2]
Double-clicking with mouse button 1 selects the word under the mouse and
positions the insertion cursor at the start of the word. Dragging after a
double click will stroke out a selection consisting of whole words.
.IP [3]
Triple-clicking with mouse button 1 selects the line under the mouse and
positions the insertion cursor at the start of the line. Dragging after a
triple click will stroke out a selection consisting of whole lines.
.IP [4]
The ends of the selection can be adjusted by dragging with mouse button 1
while the Shift key is down; this will adjust the end of the selection that
was nearest to the mouse cursor when button 1 was pressed. If the button is
double-clicked before dragging then the selection will be adjusted in units of
whole words; if it is triple-clicked then the selection will be adjusted in
units of whole lines.
.IP [5]
Clicking mouse button 1 with the Control key down will reposition the
insertion cursor without affecting the selection.
.IP [6]
If any normal printing characters are typed, they are inserted at the point of
the insertion cursor.
.IP [7]
The view in the widget can be adjusted by dragging with mouse button 2. If
mouse button 2 is clicked without moving the mouse, the selection is copied
into the text at the position of the mouse cursor. The Insert key also inserts
the selection, but at the position of the insertion cursor.
.IP [8]
If the mouse is dragged out of the widget while button 1 is pressed, the entry
will automatically scroll to make more text visible (if there is more text
off-screen on the side where the mouse left the window).
.IP [9]
The Left and Right keys move the insertion cursor one character to the left or
right; they also clear any selection in the text. If Left or Right is typed
with the Shift key down, then the insertion cursor moves and the selection is
extended to include the new character. Control-Left and Control-Right move the
insertion cursor by words, and Control-Shift-Left and Control-Shift-Right move
the insertion cursor by words and also extend the selection. Control-b and
Control-f behave the same as Left and Right, respectively. Meta-b and Meta-f
behave the same as Control-Left and Control-Right, respectively.
.IP [10]
The Up and Down keys move the insertion cursor one line up or down and clear
any selection in the text. If Up or Right is typed with the Shift key down,
then the insertion cursor moves and the selection is extended to include the
new character. Control-Up and Control-Down move the insertion cursor by
paragraphs (groups of lines separated by blank lines), and Control-Shift-Up
and Control-Shift-Down move the insertion cursor by paragraphs and also extend
the selection. Control-p and Control-n behave the same as Up and Down,
respectively.
.IP [11]
The Next and Prior keys move the insertion cursor forward or backwards by one
screenful and clear any selection in the text. If the Shift key is held down
while Next or Prior is typed, then the selection is extended to include the
new character.
.IP [12]
Control-Next and Control-Prior scroll the view right or left by one page
without moving the insertion cursor or affecting the selection.
.IP [13]
Home and Control-a move the insertion cursor to the beginning of its display
line and clear any selection in the widget. Shift-Home moves the insertion
cursor to the beginning of the display line and also extends the selection to
that point.
.IP [14]
End and Control-e move the insertion cursor to the end of the display line and
clear any selection in the widget. Shift-End moves the cursor to the end of
the display line and extends the selection to that point.
.IP [15]
Control-Home and Meta-< move the insertion cursor to the beginning of the text
and clear any selection in the widget. Control-Shift-Home moves the insertion
cursor to the beginning of the text and also extends the selection to that
point.
.IP [16]
Control-End and Meta-> move the insertion cursor to the end of the text and
clear any selection in the widget. Control-Shift-End moves the cursor to the
end of the text and extends the selection to that point.
.IP [17]
The Select key and Control-Space set the selection anchor to the position of
the insertion cursor. They do not affect the current selection. Shift-Select
and Control-Shift-Space adjust the selection to the current position of the
insertion cursor, selecting from the anchor to the insertion cursor if there
was not any selection previously.
.IP [18]
Control-/ selects the entire contents of the widget.
.IP [19]
Control-\e clears any selection in the widget.
.IP [20]
The F16 key (labelled Copy on many Sun workstations) or Meta-w copies the
selection in the widget to the clipboard, if there is a selection. This
action is carried out by the command \fBtk_textCopy\fR.
.IP [21]
The F20 key (labelled Cut on many Sun workstations) or Control-w copies the
selection in the widget to the clipboard and deletes the selection. This
action is carried out by the command \fBtk_textCut\fR. If there is no
selection in the widget then these keys have no effect.
.IP [22]
The F18 key (labelled Paste on many Sun workstations) or Control-y inserts the
contents of the clipboard at the position of the insertion cursor. This action
is carried out by the command \fBtk_textPaste\fR.
.IP [23]
The Delete key deletes the selection, if there is one in the widget. If there
is no selection, it deletes the character to the right of the insertion
cursor.
.IP [24]
Backspace and Control-h delete the selection, if there is one in the widget.
If there is no selection, they delete the character to the left of the
insertion cursor.
.IP [25]
Control-d deletes the character to the right of the insertion cursor.
.IP [26]
Meta-d deletes the word to the right of the insertion cursor.
.IP [27]
Control-k deletes from the insertion cursor to the end of its line; if the
insertion cursor is already at the end of a line, then Control-k deletes the
newline character.
.IP [28]
Control-o opens a new line by inserting a newline character in front of the
insertion cursor without moving the insertion cursor.
.IP [29]
Meta-backspace and Meta-Delete delete the word to the left of the insertion
cursor.
.IP [30]
Control-x deletes whatever is selected in the text widget after copying it to
the clipboard.
.IP [31]
Control-t reverses the order of the two characters to the right of the
insertion cursor.
.IP [32]
Control-z (and Control-underscore on UNIX when \fBtk_strictMotif\fR is true)
undoes the last edit action if the \fB\-undo\fR option is true. Does nothing
otherwise.
.IP [33]
Control-Z (or Control-y on Windows) reapplies the last undone edit action if
the \fB\-undo\fR option is true. Does nothing otherwise.
.PP
If the widget is disabled using the \fB\-state\fR option, then its view can
still be adjusted and text can still be selected, but no insertion cursor will
be displayed and no text modifications will take place.
.PP
The behavior of texts can be changed by defining new bindings for individual
widgets or by redefining the class bindings.
.SH "KNOWN ISSUES"
.SS "ISSUES CONCERNING CHARS AND INDICES"
.PP
Before Tk 8.5, the widget used the string
.QW chars
to refer to index positions (which included characters, embedded windows and
embedded images). As of Tk 8.5 the text widget deals separately and correctly
with
.QW chars
and
.QW indices .
For backwards compatibility, however, the index modifiers
.QW "+N chars"
and
.QW "\-N chars"
continue to refer to indices. One must use any of the full forms
.QW "+N any chars"
or
.QW "\-N any chars"
etc. to refer to actual character indices. This confusion may be fixed in a
future release by making the widget correctly interpret
.QW "+N chars"
as a synonym for
.QW "+N any chars" .
.SS "PERFORMANCE ISSUES"
.PP
Text widgets should run efficiently under a variety of conditions. The text
widget uses about 2-3 bytes of main memory for each byte of text, so texts
containing a megabyte or more should be practical on most workstations. Text
is represented internally with a modified B-tree structure that makes
operations relatively efficient even with large texts. Tags are included in
the B-tree structure in a way that allows tags to span large ranges or have
many disjoint smaller ranges without loss of efficiency. Marks are also
implemented in a way that allows large numbers of marks. In most cases it is
fine to have large numbers of unique tags, or a tag that has many distinct
ranges.
.PP
One performance problem can arise if you have hundreds or thousands of
different tags that all have the following characteristics: the first and last
ranges of each tag are near the beginning and end of the text, respectively,
or a single tag range covers most of the text widget. The cost of adding and
deleting tags like this is proportional to the number of other tags with the
same properties. In contrast, there is no problem with having thousands of
distinct tags if their overall ranges are localized and spread uniformly
throughout the text.
.PP
Very long text lines can be expensive, especially if they have many marks and
tags within them.
.PP
The display line with the insert cursor is redrawn each time the cursor
blinks, which causes a steady stream of graphics traffic. Set the
\fBinsertOffTime\fR attribute to 0 avoid this.
.SS "KNOWN BUGS"
.PP
The \fIpathName \fBsearch \-regexp\fR sub-command attempts to perform
sophisticated regexp matching across multiple lines in an efficient fashion
(since Tk 8.5), examining each line individually, and then in small groups of
lines, whether searching forwards or backwards. Under certain conditions the
search result might differ from that obtained by applying the same regexp to
the entire text from the widget in one go. For example, when searching with a
greedy regexp, the widget will continue to attempt to add extra lines to the
match as long as one of two conditions are true: either Tcl's regexp library
returns a code to indicate a longer match is possible (but there are known
bugs in Tcl which mean this code is not always correctly returned); or if each
extra line added results in at least a partial match with the pattern. This
means in the case where the first extra line added results in no match and
Tcl's regexp system returns the incorrect code and adding a second extra line
would actually match, the text widget will return the wrong result. In
practice this is a rare problem, but it can occur, for example:
.CS
pack [text .t]
\.t insert 1.0 "aaaa\enbbbb\encccc\enbbbb\enaaaa\en"
\.t search \-regexp \-\- {(a+|b+\enc+\enb+)+\ena+} 1.0
.CE
will not find a match when one exists of 19 characters starting from the first
.QW b .
.PP
Whenever one possible match is fully enclosed in another, the search command
will attempt to ensure only the larger match is returned. When performing
backwards regexp searches it is possible that Tcl will not always achieve
this, in the case where a match is preceded by one or more short,
non-overlapping matches, all of which are preceded by a large match which
actually encompasses all of them. The search algorithm used by the widget does
not look back arbitrarily far for a possible match which might cover large
portions of the widget. For example:
.CS
pack [text .t]
\.t insert 1.0 "aaaa\enbbbb\enbbbb\enbbbb\enbbbb\\n"
\.t search \-regexp \-backward \-\- {b+\en|a+\en(b+\en)+} end
.CE
matches at
.QW 5.0
when a true greedy match would match at
.QW 1.0 .
Similarly if we add \fB\-all\fR to this case, it matches at all of
.QW 5.0 ,
.QW 4.0 ,
.QW 3.0
and
.QW 1.0 ,
when really it should only match at
.QW 1.0
since that match encloses all the others.
.SH "SEE ALSO"
entry(n), scrollbar(n)
.SH KEYWORDS
text, widget, tkvars
'\" Local Variables:
'\" mode: nroff
'\" End:
@


1.59
log
@Small cleanups to improve HTML generation.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.58 2008/12/06 10:48:29 dkf Exp $
d1046 1
a1046 1
are sorted and the text is removed from the last range to the first range to
@


1.58
log
@Implementation of TIP #197.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.57 2008/09/23 13:36:55 dkf Exp $
d183 2
a184 2
The text widget also has a built-in undo/redo mechanism. See \fBTHE UNDO
MECHANISM\fR below for more details.
d622 3
a624 2
associated with the insertion cursor, as described under \fBTHE INSERTION
CURSOR\fR below. Second, the mark \fBcurrent\fR is associated with the
@


1.57
log
@Fix [Bug 2118116]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.56 2008/06/30 22:57:03 dkf Exp $
d54 8
@


1.56
log
@Minor doc updates (removing out of date changebars, improving typedef formatting,
 etc.)
@
text
@a0 1
'\" -*- nroff -*-
d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.55 2008/06/24 10:54:53 patthoyts Exp $
d2089 3
@


1.55
log
@bug #1997293 - fix documentation of text tag options.
@
text
@d1 1
d9 1
a9 1
'\" RCS: @@(#) $Id: text.n,v 1.54 2008/04/17 15:27:12 dkf Exp $
d14 1
a14 1
'\" Note:  do not modify the .SH NAME line immediately below!
d35 2
a36 3
Specifies a boolean that says whether separators are automatically
inserted in the undo stack. Only meaningful when the \fB\-undo\fR
option is true.
d38 3
a40 5
.VS 8.5
Specifies a boolean that says whether the blinking insertion cursor
should be drawn as a character-sized rectangular block.  If false
(the default) a thin vertical line is used for the insertion cursor.
.VE 8.5
d42 6
a47 8
.VS 8.5
Specifies an integer line index representing the last line of the
underlying textual data store that should be contained in the widget.
This allows a text widget to reflect only a portion of a larger piece
of text.   Instead of an integer, the empty string can be provided to
this configuration option, which will configure the widget to end
at the very last line in the textual data store.
.VE 8.5
d49 2
a50 3
Specifies the desired height for the window, in units of characters
in the font given by the \fB\-font\fR option.
Must be at least one.
d52 3
a54 5
.VS 8.5
Specifies the colour to use for the selection (the \fBsel\fR tag) when
the window does not have the input focus.  If empty, \fB{}\fR, then no
selection is shown when the window does not have the focus.
.VE 8.5
d56 2
a57 2
Specifies the maximum number of compound undo actions on the undo
stack. A zero or a negative value imply an unlimited undo stack.
d59 4
a62 6
Requests additional space above each text line in the widget,
using any of the standard forms for screen distances.
If a line wraps, this option only applies to the first line
on the display.
This option may be overridden with \fB\-spacing1\fR options in
tags.
d64 5
a68 6
For lines that wrap (so that they cover more than one line on the
display) this option specifies additional space to provide between
the display lines that represent a single line of text.
The value may have any of the standard forms for screen distances.
This option may be overridden with \fB\-spacing2\fR options in
tags.
d70 4
a73 6
Requests additional space below each text line in the widget,
using any of the standard forms for screen distances.
If a line wraps, this option only applies to the last line
on the display.
This option may be overridden with \fB\-spacing3\fR options in
tags.
d75 6
a80 8
.VS 8.5
Specifies an integer line index representing the first line of the
underlying textual data store that should be contained in the widget.
This allows a text widget to reflect only a portion of a larger piece
of text.  Instead of an integer, the empty string can be provided to
this configuration option, which will configure the widget to start
at the very first line in the textual data store.
.VE 8.5
d82 3
a84 4
Specifies one of two states for the text:  \fBnormal\fR or \fBdisabled\fR.
If the text is disabled then characters may not be inserted or deleted
and no insertion cursor will be displayed, even if the input focus is
in the widget.
d86 15
a100 18
Specifies a set of tab stops for the window.  The option's value consists
of a list of screen distances giving the positions of the tab stops,
each of which is a distance relative to the left edge of the widget
(excluding borders, padding, etc).  Each
position may optionally be followed in the next list element
by one of the keywords \fBleft\fR, \fBright\fR, \fBcenter\fR,
or \fBnumeric\fR, which specifies how to justify
text relative to the tab stop.  \fBLeft\fR is the default; it causes
the text following the tab character to be positioned with its left edge
at the tab position.  \fBRight\fR means that the right edge of the text
following the tab character is positioned at the tab position, and
\fBcenter\fR means that the text is centered at the tab position.
\fBNumeric\fR means that the decimal point in the text is positioned
at the tab position;  if there is no decimal point then the least
significant digit of the number is positioned just to the left of the
tab position;  if there is no number in the text then the text is
right-justified at the tab position.
For example,
d102 1
a102 1
creates three tab stops at two-centimeter intervals;  the first two use left
d106 11
a116 12
If the list of tab stops does not have enough elements to cover all
of the tabs in a text line, then Tk extrapolates new tab stops using
the spacing and alignment from the last tab stop in the list.  Tab
distances must be strictly positive, and must always increase from one
tab stop to the next (if not, an error is thrown).
The value of the \fBtabs\fR option may be overridden by \fB\-tabs\fR
options in tags.
.PP
If no \fB\-tabs\fR option is specified, or if it is specified as
an empty list, then Tk uses default tabs spaced every eight
(average size) characters.  To achieve a different standard spacing,
for example every 4 characters, simply configure the widget with
d120 11
a130 13
Specifies how to interpret the relationship between tab stops on a line
and tabs in the text of that line.  The value must be \fBtabular\fR (the
default) or \fBwordprocessor\fR. Note that tabs are interpreted as they
are encountered in the text.  If the tab style is \fBtabular\fR then the
\fIn\fR'th tab character in the line's text will be associated with
the \fIn\fR'th
tab stop defined for that line.  If the tab character's x coordinate
falls to the right of the \fIn\fR'th tab stop, then a gap of a single space
will be inserted as a fallback.  If the tab style is \fBwordprocessor\fR
then any tab character being laid out will use (and be defined by) the
first tab stop to the right of the preceding characters already laid out
on that line.  The value of the \fBtabstyle\fR option may be overridden
by \fB\-tabstyle\fR options in tags.
d132 1
a132 2
Specifies a boolean that says whether the undo mechanism is active or
not.
d134 3
a136 3
Specifies the desired width for the window in units of characters
in the font given by the \fB\-font\fR option.
If the font does not have a uniform width then the width of the character
d140 8
a147 10
Specifies how to handle lines in the text that are too long to be
displayed in a single line of the text's window.
The value must be \fBnone\fR or \fBchar\fR or \fBword\fR.
A wrap mode of \fBnone\fR means that each line of text appears as
exactly one line on the screen;  extra characters that do not fit
on the screen are not displayed.
In the other modes each line of text will be broken up into several
screen lines if necessary to keep all the characters visible.
In \fBchar\fR mode a screen line break may occur after any character;
in \fBword\fR mode a line break will only be made at word boundaries.
a148 1

d151 13
a163 19
The \fBtext\fR command creates a new window (given by the
\fIpathName\fR argument) and makes it into a text widget.
Additional
options, described above, may be specified on the command line
or in the option database
to configure aspects of the text such as its default background color
and relief.  The \fBtext\fR command returns the
path name of the new window.
.PP
A text widget displays one or more lines of text and allows that
text to be edited.
Text widgets support four different kinds of annotations on the
text, called tags, marks, embedded windows or embedded images.
Tags allow different portions of the text
to be displayed with different fonts and colors.
In addition, Tcl commands can be associated with tags so
that scripts are invoked when particular actions such as keystrokes
and mouse button presses occur in particular ranges of the text.
See \fBTAGS\fR below for more details.
d165 1
a165 2
The second form of annotation consists of floating markers in the text
called
d167 5
a171 7
Marks are used to keep track of various interesting positions in the
text as it is edited.
See \fBMARKS\fR below for more details.
.PP
The third form of annotation allows arbitrary windows to be
embedded in a text widget.
See \fBEMBEDDED WINDOWS\fR below for more details.
d174 1
a174 2
widget.
See \fBEMBEDDED IMAGES\fR below for more details.
d176 2
a177 2
The text widget also has a built-in undo/redo mechanism.
See \fBTHE UNDO MECHANISM\fR below for more details.
d179 3
a181 5
.VS 8.5
The text widget allows for the creation of peer widgets.  These are
other text widgets which share the same underlying data (text, marks,
tags, images, etc).  See \fBPEER WIDGETS\fR below for more details.
.VE 8.5
d184 4
a187 6
Many of the widget commands for texts take one or more indices
as arguments.
An index is a string used to indicate a particular place within
a text, such as a place to insert characters or one endpoint of a
range of characters to delete.
Indices have the syntax
d191 12
a202 14
Where \fIbase\fR gives a starting point and the \fImodifier\fRs
adjust the index from the starting point (e.g. move forward or
backward one character).  Every index must contain a \fIbase\fR,
but the \fImodifier\fRs are optional.
.VS 8.5
Most modifiers (as documented below) allow
an optional submodifier.  Valid submodifiers are \fBany\fR
and \fBdisplay\fR. If the submodifier is abbreviated, then it must be
followed by whitespace, but otherwise there need be no space between the
submodifier and the following \fImodifier\fR.  Typically the \fBdisplay\fR
submodifier adjusts the meaning of the following \fImodifier\fR to make
it refer to visual or non-elided units rather than logical units, but
this is explained for each relevant case below.  Lastly, where \fIcount\fR
is used as part of a modifier, it can be positive or negative, so
a205 1
.VE 8.5
d210 5
a214 6
Indicates \fIchar\fR'th character on line \fIline\fR.
Lines are numbered from 1 for consistency with other UNIX programs
that use this numbering scheme.
Within a line, characters are numbered from 0.
If \fIchar\fR is \fBend\fR then it refers to the newline character
that ends the line.
d217 3
a219 2
Indicates the character that covers the pixel whose x and y coordinates
within the text's window are \fIx\fR and \fIy\fR.
d222 2
a223 2
Indicates the end of the text (the character just after the last
newline).
d226 1
d230 3
a232 1
Indicates the first character in the text that has been tagged with
a233 2
This form generates an error if no characters are currently tagged
with \fItag\fR.
d236 4
a239 4
Indicates the character just after the last one in the text that has
been tagged with \fItag\fR.
This form generates an error if no characters are currently tagged
with \fItag\fR.
d242 3
a244 4
Indicates the position of the embedded window whose name is
\fIpathName\fR.
This form generates an error if there is no embedded window
by the given name.
d247 10
a256 11
Indicates the position of the embedded image whose name is
\fIimageName\fR.
This form generates an error if there is no embedded image
by the given name.
.PP
If the \fIbase\fR could match more than one of the above forms, such
as a \fImark\fR and \fIimageName\fR both having the same value, then
the form earlier in the above list takes precedence.
If modifiers follow the base index, each one of them must have one
of the forms listed below.  Keywords such as \fBchars\fR and \fBwordend\fR
may be abbreviated as long as the abbreviation is unambiguous.
d259 11
a269 13
.VS 8.5
Adjust the index forward by \fIcount\fR characters, moving to later lines
in the text if necessary.  If there are fewer than \fIcount\fR characters
in the text after the current index, then set the index to the last index
in the text.  Spaces on either side of \fIcount\fR are optional.  If the
\fBdisplay\fR submodifier is given, elided characters are skipped over
without being counted.  If \fBany\fR is given, then all characters are
counted.  For historical reasons, if neither modifier is given then the
count actually takes place in units of index positions (see \fBindices\fR
for details).  This behaviour may be changed in a future major release,
so if you need an index count, you are encouraged to use \fBindices\fR
instead wherever possible.
.VE 8.5
d272 11
a282 13
Adjust the index backward by \fIcount\fR characters, moving to earlier
lines in the text if necessary.  If there are fewer than \fIcount\fR
characters in the text before the current index, then set the index to
.VS 8.5
the first index in the text (1.0).  Spaces on either side of \fIcount\fR
are optional.  If the \fBdisplay\fR submodifier is given, elided
characters are skipped over without being counted.  If \fBany\fR is
given, then all characters are counted.  For historical reasons, if
neither modifier is given then the count actually takes place in units of
index positions (see \fBindices\fR for details).  This behaviour may be
changed in a future major release, so if you need an index count, you are
encouraged to use \fBindices\fR instead wherever possible.
.VE 8.5
d285 10
a294 11
.VS 8.5
Adjust the index forward by \fIcount\fR index positions, moving to later
lines in the text if necessary.  If there are fewer than \fIcount\fR
index positions in the text after the current index, then set the index
to the last index position in the text.  Spaces on either side of
\fIcount\fR are optional.  Note that an index position is either a single
character or a single embedded image or embedded window.  If the
\fBdisplay\fR submodifier is given, elided indices are skipped over
without being counted.  If \fBany\fR is given, then all indices are
counted; this is also the default behaviour if no modifier is given.
.VE 8.5
d297 8
a304 10
.VS 8.5
Adjust the index backward by \fIcount\fR index positions, moving to
earlier lines in the text if necessary.  If there are fewer than
\fIcount\fR index positions in the text before the current index, then
set the index to the first index position (1.0) in the text.  Spaces on
either side of \fIcount\fR are optional.  If the \fBdisplay\fR
submodifier is given, elided indices are skipped over without being
counted.  If \fBany\fR is given, then all indices are counted; this is
also the default behaviour if no modifier is given.
.VE 8.5
d307 13
a319 14
.VS 8.5
Adjust the index forward by \fIcount\fR lines, retaining the same
character position within the line.  If there are fewer than \fIcount\fR
lines after the line containing the current index, then set the index to
refer to the same character position on the last line of the text.  Then,
if the line is not long enough to contain a character at the indicated
character position, adjust the character position to refer to the last
character of the line (the newline).  Spaces on either side of
\fIcount\fR are optional.  If the \fBdisplay\fR submodifier is given,
then each visual display line is counted separately.  Otherwise, if
\fBany\fR (or no modifier) is given, then each logical line (no matter
how many times it is visually wrapped) counts just once.  If the relevant
lines are not wrapped, then these two methods of counting are equivalent.
.VE 8.5
d322 13
a334 14
.VS 8.5
Adjust the index backward by \fIcount\fR logical lines, retaining the
same character position within the line.  If there are fewer than
\fIcount\fR lines before the line containing the current index, then set
the index to refer to the same character position on the first line of
the text.  Then, if the line is not long enough to contain a character at
the indicated character position, adjust the character position to refer
to the last character of the line (the newline).  Spaces on either side
of \fIcount\fR are optional.  If the \fBdisplay\fR submodifier is given,
then each visual display line is counted separately.  Otherwise, if
\fBany\fR (or no modifier) is given, then each logical line (no matter
how many times it is visually wrapped) counts just once.  If the relevant
lines are not wrapped, then these two methods of counting are equivalent.
.VE 8.5
d337 4
a340 5
.VS 8.5
Adjust the index to refer to the first index on the line.  If the
\fBdisplay\fR submodifier is given, this is the first index on the
display line, otherwise on the logical line.
.VE 8.5
d343 4
a346 5
.VS 8.5
Adjust the index to refer to the last index on the line (the
newline).  If the \fBdisplay\fR submodifier is given, this is the last
index on the display line, otherwise on the logical line.
.VE 8.5
d349 6
a354 8
.VS 8.5
Adjust the index to refer to the first character of the word containing
the current index.  A word consists of any number of adjacent characters
that are letters, digits, or underscores, or a single character that is
not one of these.  If the \fBdisplay\fR submodifier is given, this only
examines non-elided characters, otherwise all characters (elided or not)
are examined.
.VE 8.5
d357 6
a362 6
.VS 8.5
Adjust the index to refer to the character just after the last one of the
word containing the current index.  If the current index refers to the
last character of the text then it is not modified.  If the \fBdisplay\fR
submodifier is given, this only examines non-elided characters, otherwise
all characters (elided or not) are examined.
d364 2
a365 2
If more than one modifier is present then they are applied in
left-to-right order.  For example, the index
d369 4
a372 5
refers to the character just before
the first one in the word containing the insertion cursor.  Modifiers
are applied one by one in this left to right order, and after each step
the resulting index is constrained to be a valid index in the text
widget.  So, for example, the index
d377 2
a378 3
Where modifiers result in index changes by display lines, display chars
or display indices, and the \fIbase\fR refers to an index inside an
elided tag,
a380 1
.VE 8.5
d383 4
a386 5
The first form of annotation in text widgets is a tag.
A tag is a textual string that is associated with some of the characters
in a text.
Tags may contain arbitrary characters, but it is probably best to
avoid using the characters
d388 11
a398 15
(space), \fB+\fR, or \fB\-\fR:
these characters have special meaning in indices, so tags containing
them cannot be used as indices.
There may be any number of tags associated with characters in a
text.
Each tag may refer to a single character, a range of characters, or
several ranges of characters.
An individual character may have any number of tags associated with it.
.PP
A priority order is defined among tags, and this order is used in
implementing some of the tag-related functions described below.
When a tag is defined (by associating it with characters or setting
its display options or binding commands to it), it is given
a priority higher than any existing tag.
The priority order of tags may be redefined using the
d404 5
a408 7
Tags serve three purposes in text widgets.
First, they control the way information is displayed on the screen.
By default, characters are displayed as determined by the
\fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR options for the
text widget.
However, display options may be associated with individual tags
using the
d410 3
a412 4
widget command.
If a character has been tagged, then the display options associated
with the tag override the default display style.
The following options are currently supported for tags:
d415 3
a417 3
\fIColor\fR specifies the background color to use for characters
associated with the tag.
It may have any of the forms accepted by \fBTk_GetColor\fR.
d420 5
a424 6
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
for the background.
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
If \fIbitmap\fR has not been specified, or if it is specified
as an empty string, then a solid fill will be used for the
background.
d427 4
a430 4
\fIPixels\fR specifies the width of a border to draw around
the tag using any of the forms accepted by \fBTk_GetPixels\fR.
This option should be used in conjuction with the 
\fB\-relief\fR option to provide the desired border.
d433 4
a436 4
\fIElide\fR specifies whether the data should
be elided.  Elided data (characters, images, embedded windows, etc) is
not displayed and takes no space on screen, but further on behaves just
as normal data.
d439 6
a444 6
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
when drawing text and other foreground information such as
underlines.
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
If \fIbitmap\fR has not been specified, or if it is specified
as an empty string, then a solid fill will be used.
d447 3
a449 2
\fIFontName\fR is the name of a font to use for drawing characters.
It may have any of the forms accepted by \fBTk_GetFont\fR.
d452 4
a455 3
\fIColor\fR specifies the color to use when drawing text and other
foreground information such as underlines.
It may have any of the forms accepted by \fBTk_GetColor\fR.
d458 1
d460 4
a463 5
option has been specified, then \fIjustify\fR determines how to
justify the line.
It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR.
If a line wraps, then the justification for each line on the
display is determined by the first non-elided character of that display line.
d466 1
d468 5
a472 8
option has been specified, then \fIpixels\fR specifies how
much the line should be indented from the left edge of the
window.
\fIPixels\fR may have any of the standard forms for screen
distances.
If a line of text wraps, this option only applies to the
first line on the display;  the \fB\-lmargin2\fR option controls
the indentation for subsequent lines.
d475 1
d477 6
a482 8
option has been specified, and if the display line is not the
first for its text line (i.e., the text line has wrapped), then
\fIpixels\fR specifies how much the line should be indented from
the left edge of the window.
\fIPixels\fR may have any of the standard forms for screen
distances.
This option is only used when wrapping is enabled, and it only
applies to the second and later display lines for a text line.
d485 5
a489 6
\fIPixels\fR specifies an amount by which the text's baseline
should be offset vertically from the baseline of the overall
line, in pixels.
For example, a positive offset can be used for superscripts
and a negative offset can be used for subscripts.
\fIPixels\fR may have any of the standard forms for screen
d493 4
a496 3
Specifies whether or not to draw a horizontal rule through
the middle of characters.
\fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR.
d499 5
a503 4
\fIRelief\fR specifies the relief style to use for drawing the border,
in any of the forms accepted by \fBTk_GetRelief\fR.
This option is used in conjunction with the \fB\-borderwidth\fR
option to enable to the desired border appearance.
d506 1
d508 6
a513 9
option has been specified, then \fIpixels\fR specifies how wide
a margin to leave between the end of the line and the right
edge of the window.
\fIPixels\fR may have any of the standard forms for screen
distances.
This option is only used when wrapping is enabled.
If a text line wraps, the right margin for each line on the
display is determined by the first non-elided character of that display
line.
d516 4
a519 5
\fIPixels\fR specifies how much additional space should be
left above each text line, using any of the standard forms for
screen distances.
If a line wraps, this option only applies to the first
line on the display.
d522 4
a525 4
For lines that wrap, this option specifies how much additional
space to leave between the display lines for a single text line.
\fIPixels\fR may have any of the standard forms for screen
distances.
d528 4
a531 5
\fIPixels\fR specifies how much additional space should be
left below each text line, using any of the standard forms for
screen distances.
If a line wraps, this option only applies to the last
line on the display.
d534 9
a542 10
\fITabList\fR specifies a set of tab stops in the same form
as for the \fB\-tabs\fR option for the text widget.  This
option only applies to a display line if it applies to the
first non-elided character on that display line.
If this option is specified as an empty string, it cancels
the option, leaving it unspecified for the tag (the default).
If the option is specified as a non-empty string that is
an empty list, such as \fB\-tags\0{\0}\fR, then it requests
default 8-character tabs as described for the \fB\-tags\fR
widget option.
d545 6
a550 6
\fIStyle\fR specifies either the \fItabular\fR or
\fIwordprocessor\fR style of tabbing to use for the text widget.
This option only applies to a display line if it applies to the
first non-elided character on that display line.
If this option is specified as an empty string, it cancels
the option, leaving it unspecified for the tag (the default).
d553 1
d555 1
a555 2
characters.
It may have any of the forms accepted by \fBTcl_GetBoolean\fR.
d558 19
a576 26
\fIMode\fR specifies how to handle lines that are wider than the
text's window.
It has the same legal values as the \fB\-wrap\fR option
for the text widget:  \fBnone\fR, \fBchar\fR, or \fBword\fR.
If this tag option is specified, it overrides the \fB\-wrap\fR option
for the text widget.
.PP
If a character has several tags associated with it, and if their
display options conflict, then the options of the highest priority
tag are used.
If a particular display option has not been specified for a
particular tag, or if it is specified as an empty string, then
that option will never be used;  the next-highest-priority
tag's option will used instead.
If no tag specifies a particular display option, then the default
style for the widget will be used.
.PP
The second purpose for tags is event bindings.
You can associate bindings with a tag in much the same way you can
associate bindings with a widget class:  whenever particular X
events occur on characters with the given tag, a given
Tcl command will be executed.
Tag bindings can be used to give behaviors to ranges of characters;
among other things, this allows hypertext-like
features to be implemented.
For details, see the description of the
d578 1
a578 3
widget command below.
.VS 8.5
Tag bindings are shared between all peer widgets
a579 1
.VE 8.5
d581 5
a585 9
The third use for tags is in managing the selection.
See \fBTHE SELECTION\fR below.
.VS 8.5
With the exception of the special \fBsel\fR
tag, all tags are shared between peer text widgets, and may be
manipulated on an equal basis from any such widget.  The \fBsel\fR
tag exists separately and independently in each peer text widget (but
any tag bindings to \fBsel\fR are shared).
.VE 8.5
d588 9
a596 14
The second form of annotation in text widgets is a mark.
Marks are used for remembering particular places in a text.
They are something like tags, in that they have names and
they refer to places in the file, but a mark is not associated
with particular characters.
Instead, a mark is associated with the gap between two characters.
Only a single position may be associated with a mark at any given
time.
If the characters around a mark are deleted the mark will still
remain;  it will just have new neighbor characters.
In contrast, if the characters containing a tag are deleted then
the tag will no longer have an association with characters in
the file.
Marks may be manipulated with the
d598 1
a598 2
widget
command, and their current locations may be determined by using the
d603 21
a623 29
which is either \fBleft\fR or \fBright\fR.
The gravity for a mark specifies what happens to the mark when
text is inserted at the point of the mark.
If a mark has left gravity, then the mark is treated as if it
were attached to the character on its left, so the mark will
remain to the left of any text inserted at the mark position.
If the mark has right gravity, new text inserted at the mark
position will appear to the left of the mark (so that the mark
remains rightmost).  The gravity for a mark defaults to \fBright\fR.
.PP
The name space for marks is different from that for tags:  the
same name may be used for both a mark and a tag, but they will refer
to different things.
.PP
Two marks have special significance.
First, the mark \fBinsert\fR is associated with the insertion cursor,
as described under \fBTHE INSERTION CURSOR\fR below.
Second, the mark \fBcurrent\fR is associated with the character
closest to the mouse and is adjusted automatically to track the
mouse position and any changes to the text in the widget (one
exception:  \fBcurrent\fR is not updated in response to mouse
motions if a mouse button is down;  the update will be deferred
until all mouse buttons have been released).
Neither of these special marks may be deleted.
.VS 8.5
With the exception of
these two special marks, all marks are shared between peer text
widgets, and may be manipulated on an equal basis from any peer.
.VE 8.5
d626 20
a645 32
The third form of annotation in text widgets is an embedded window.
Each embedded window annotation causes a window to be displayed
at a particular point in  the text.
There may be any number of embedded windows in a text widget,
and any widget may be used as an embedded window (subject to the
usual rules for geometry management, which require the text window
to be the parent of the embedded window or a descendant of its
parent).
The embedded window's position on the screen will be updated as the
text is modified or scrolled, and it will be mapped and unmapped as
it moves into and out of the visible area of the text widget.
Each embedded window occupies one
.VS 8.5
unit's
.VE 8.5
worth of index space
in the text widget, and it may be referred to either by the name
of its embedded window or by its position in the widget's
index space.
If the range of text containing the embedded window is deleted then
the window is destroyed.
.VS 8.5
Similarly if the text widget as a whole is deleted, then the window is
destroyed.
.VE 8.5
.PP
When an embedded window is added to a text widget with the
\fIpathName \fBwindow create\fR widget command, several configuration
options may be associated with it.
These options may be  modified later with the \fIpathName \fBwindow configure\fR
widget command.
The following options are currently supported:
d648 8
a655 8
If the window is not as tall as the line in which it is displayed,
this option determines where the window is displayed in the line.
\fIWhere\fR must have one of the values \fBtop\fR (align the top of the window
with the top of the line), \fBcenter\fR (center the window
within the range of the line), \fBbottom\fR (align the bottom of the
window with the bottom of the line's area),
or \fBbaseline\fR (align the bottom of the window with the baseline
of the line).
d658 10
a667 14
Specifies a Tcl script that may be evaluated to create the window
for the annotation.
If no \fB\-window\fR option has been specified for the annotation
this script will be evaluated when the annotation is about to
be displayed on the screen.
\fIScript\fR must create a window for the annotation and return
the name of that window as its result.
.VS 8.5
Two substitutions will be performed in \fIscript\fR before evaluation.
\fI%W\fR will be substituted by the name of the parent text widget,
and \fI%%\fR will be substituted by a single \fI%\fR.
.VE 8.5
If the annotation's window should ever be deleted, \fIscript\fR
will be evaluated again the next time the annotation is displayed.
d670 4
a673 3
\fIPixels\fR specifies the amount of extra space to leave on
each side of the embedded window.
It may have any of the usual forms defined for a screen distance.
d676 4
a679 3
\fIPixels\fR specifies the amount of extra space to leave on
the top and on the bottom of the embedded window.
It may have any of the usual forms defined for a screen distance.
d682 6
a687 7
If the requested height of the embedded window is less than the
height of the line in which it is displayed, this option can be
used to specify whether the window should be stretched vertically
to fill its line.
If the \fB\-pady\fR option has been specified as well, then the
requested padding will be retained even if the window is
stretched.
d690 7
a696 9
Specifies the name of a window to display in the annotation.
.VS 8.5
Note that if a \fIpathName\fR has been set, then later configuring a
window to the empty string will not delete the widget corresponding to
the old \fIpathName\fR. Rather it will remove the association between
the old \fIpathName\fR and the text widget.  If multiple peer widgets
are in use, it is usually simpler to use the \fB\-create\fR option if
embedded windows are desired in each peer.
.VE 8.5
d699 23
a721 18
The final form of annotation in text widgets is an embedded image.
Each embedded image annotation causes an image to be displayed
at a particular point in  the text.
There may be any number of embedded images in a text widget,
and a particular image may be embedded in multiple places in the same
text widget.
The embedded image's position on the screen will be updated as the
text is modified or scrolled.
Each embedded image occupies one
.VS 8.5
unit's
.VE 8.5
worth of index space
in the text widget, and it may be referred to either by
its position in the widget's index space, or the name it is assigned
when the image is inserted into the text widget with \fIpathName \fBimage create\fR.
If the range of text containing the embedded image is deleted then
that copy of the image is removed from the screen.
d724 3
a726 18
create\fR widget command, a name unique to this instance of the image
is returned.  This name may then be used to refer to this image
instance.  The name is taken to be the value of the \fB\-name\fR option
(described below).  If the \fB\-name\fR option is not provided, the
\fB\-image\fR name is used instead.  If the \fIimageName\fR is already
in use in the text widget, then \fB#\fInn\fR is added to the end of the
\fIimageName\fR, where \fInn\fR is an arbitrary integer.  This insures
the \fIimageName\fR is unique.
Once this name is assigned to this instance of the image, it does not
change, even though the \fB\-image\fR or \fB\-name\fR values can be changed
with \fIpathName \fBimage configure\fR.
.PP
When an embedded image is added to a text widget with the
\fIpathName \fBimage create\fR widget command, several configuration
options may be associated with it.
These options may be modified later with the \fIpathName \fBimage configure\fR
widget command.
The following options are currently supported:
d729 7
a735 8
If the image is not as tall as the line in which it is displayed,
this option determines where the image is displayed in the line.
\fIWhere\fR must have one of the values \fBtop\fR (align the top of the image
with the top of the line), \fBcenter\fR (center the image
within the range of the line), \fBbottom\fR (align the bottom of the
image with the bottom of the line's area),
or \fBbaseline\fR (align the bottom of the image with the baseline
of the line).
d738 3
a740 2
Specifies the name of the Tk image to display in the annotation.
If \fIimage\fR is not a valid Tk image, then an error is returned.
d743 5
a747 5
Specifies the name by which this image instance may be referenced in
the text widget. If \fIImageName\fR is not supplied, then the
name of the Tk image is used instead.
If the \fIimageName\fR is already in use, \fI#nn\fR is appended to
the end of the name as described above.
d750 4
a753 3
\fIPixels\fR specifies the amount of extra space to leave on
each side of the embedded image.
It may have any of the usual forms defined for a screen distance.
d756 4
a759 3
\fIPixels\fR specifies the amount of extra space to leave on
the top and on the bottom of the embedded image.
It may have any of the usual forms defined for a screen distance.
d762 3
a764 3
Selection support is implemented via tags.
If the \fBexportSelection\fR option for the text widget is true
then the \fBsel\fR tag will be associated with the selection:
d766 2
a767 2
Whenever characters are tagged with \fBsel\fR the text widget
will claim ownership of the selection.
d769 2
a770 3
Attempts to retrieve the
selection will be serviced by the text widget, returning all the
characters with the \fBsel\fR tag.
d772 3
a774 3
If the selection is claimed away by another application or by another
window within this application, then the \fBsel\fR tag will be removed
from all characters in the text.
d776 2
a777 2
Whenever the \fBsel\fR tag range changes a virtual event
\fB<<Selection>>\fR is generated.
d779 2
a780 2
The \fBsel\fR tag is automatically defined when a text widget is
created, and it may not be deleted with the
d782 12
a793 16
widget command.  Furthermore, the \fBselectBackground\fR,
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for
the text widget are tied to the \fB\-background\fR,
\fB\-borderwidth\fR, and \fB\-foreground\fR options for the \fBsel\fR
tag:  changes in either will automatically be reflected in the
other.
.VS 8.5
Also the
\fB\-inactiveselectbackground\fR option for the text widget is used
instead of \fB\-selectbackground\fR when the text widget does not have
the focus.  This allows programmatic control over the visualization of
the \fBsel\fR tag for foreground and background windows, or to have
\fBsel\fR not shown at all (when \fB\-inactiveselectbackground\fR is
empty) for background windows.  Each peer text widget has its own
\fBsel\fR tag which can be separately configured and set.
.VE 8.5
d796 3
a798 3
The mark named \fBinsert\fR has special significance in text widgets.
It is defined automatically when a text widget is created and it
may not be unset with the
d800 3
a802 4
widget command.
The \fBinsert\fR mark represents the position of the insertion
cursor, and the insertion cursor will automatically be drawn at
this point whenever the text widget has the input focus.
d804 6
a809 6
The text widget can keep track of changes to the content of the widget
by means of the modified flag. Inserting or deleting text will set
this flag. The flag can be queried, set and cleared programmatically
as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual
event is generated. See the \fIpathName \fBedit modified\fR widget command for
more details.
d813 2
a814 2
\fB\-undo\fR widget option is true) which records every insert and
delete action on a stack.
d818 19
a836 20
are inserted between edit actions.  The
purpose of these separators is to group inserts, deletes and replaces
into one compound edit action.  When undoing a change everything between
two separators will be undone.  The undone changes are then moved to the
redo stack, so that an undone edit can be redone again.  The redo stack
is cleared whenever new edit actions are recorded on the undo stack.  The
undo and redo stacks can be cleared to keep their depth under control.
.PP
Separators are inserted automatically when the \fB\-autoseparators\fR
widget option is true.  You can insert separators programmatically as
well.  If a separator is already present at the top of the undo stack
no other will be inserted.  That means that two separators on the undo
stack are always separated by at least one insert or delete action.
.PP
The undo mechanism is also linked to the modified flag.  This means
that undoing or redoing changes can take a modified text widget back
to the unmodified state or vice versa.  The modified flag will be set
automatically to the appropriate state.  This automatic coupling
does not work when the modified flag has been set by the user, until
the flag has been reset again.
d842 7
a848 9
.VS 8.5
The text widget has a separate store of all its data concerning each
line's textual contents, marks, tags, images and windows, and the undo
stack.
.PP
While this data store cannot be accessed directly (i.e. without a text
widget as an intermediary), multiple text widgets can be created, each
of which present different views on the same underlying data.  Such
text widgets are known as peer text widgets.
d851 2
a852 2
images, marks, tags are adjusted, all such changes will be reflected in
all peers.
d854 24
a877 25
All data and markup is shared, except for a few small details.  First,
the \fBsel\fR tag may be set and configured (in its display style)
differently for each peer.  Second, each peer has its own \fBinsert\fR
and \fBcurrent\fR mark positions (but all other marks are shared).
Third, embedded windows, which are arbitrary other widgets, cannot be
shared between peers.  This means the \fB\-window\fR option of embedded
windows is independently set for each peer (it is advisable to use
the \fB\-create\fR script capabilities to allow each peer to create its
own embedded windows as needed).  Fourth, all of the configuration
options of each peer (e.g. \fB\-font\fR, etc) can be set independently,
with the exception of \fB\-undo\fR, \fB\-maxUndo\fR, \fB\-autoSeparators\fR
(i.e. all undo, redo and modified state issues are shared).
.PP
Finally any single peer need not contain all lines from the underlying
data store.  When creating a peer, a contiguous range of lines (e.g.
only lines 52 through 125) may be specified.  This allows a peer to
contain just a small portion of the overall text.  The range of lines
will expand and contract as text is inserted or deleted.  The peer will
only ever display complete lines of text (one cannot share just part of
a line).  If the peer's contents contracts to nothing (i.e. all complete
lines in the peer widget have been deleted from another widget), then it
is impossible for new lines to be inserted.  The peer will simply become
an empty shell on which the background can be configured, but which will
never show any content (without manual reconfiguration of the start and
end lines).  Note that a peer which does not contain all of the
d882 7
a888 8
It is simply that those indices reflect a subset of the total data, and
data outside the contained range is not accessible to the peer.  This
means that the command \fIpeerName \fBindex end\fR may return quite different
values in different peers.  Similarly, commands like \fIpeerName \fBtag
ranges\fR will not return index ranges outside that which is meaningful
to the peer.  The configuration options \fB\-startline\fR and
\fB\-endline\fR may be used to control how much of the underlying data is
contained in any given text widget.
d890 1
a890 1
Note that peers are really peers.  Deleting the
a896 1
.VE 8.5
d899 3
a901 4
The \fBtext\fR command creates a new Tcl command whose
name is the same as the path name of the text's window.  This
command may be used to invoke various
operations on the widget.  It has the following general form:
d905 3
a907 4
\fIPathName\fR is the name of the command, which is the same as
the text widget's path name.  \fIOption\fR and the \fIarg\fRs
determine the exact behavior of the command.  The following
commands are possible for text widgets:
d910 8
a917 10
Returns a list of four elements describing the screen area
of the character given by \fIindex\fR.
The first two elements of the list give the x and y coordinates
of the upper-left corner of the area occupied by the
character, and the last two elements give the width and height
of the area.
If the character is only partially visible on the screen, then
the return value reflects just the visible part.
If the character is not visible on the screen then the return
value is an empty list.
d920 3
a922 4
Returns the current value of the configuration option given
by \fIoption\fR.
\fIOption\fR may have any of the values accepted by the \fBtext\fR
command.
d925 7
a931 8
Compares the indices given by \fIindex1\fR and \fIindex2\fR according
to the relational operator given by \fIop\fR, and returns 1 if
the relationship is satisfied and 0 if it is not.
\fIOp\fR must be one of the operators <, <=, ==, >=, >, or !=.
If \fIop\fR is == then 1 is returned if the two indices refer to
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR
refers to an earlier character in the text than \fIindex2\fR, and
so on.
d934 11
a944 13
Query or modify the configuration options of the widget.
If no \fIoption\fR is specified, returns a list describing all of
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
information on the format of this list).  If \fIoption\fR is specified
with no \fIvalue\fR, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no \fIoption\fR is specified).  If
one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given widget option(s) to have the given value(s);  in
this case the command returns an empty string.
\fIOption\fR may have any of the values accepted by the \fBtext\fR
command.
.VS 8.5
d947 6
a952 6
Counts the number of relevant things between the two indices.
If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number
(and this holds for each of the possible options).
The actual items which are counted depend on the
options given.  The result is a list of integers, one for the result of
each counting option given.  Valid counting options are \fB\-chars\fR,
d956 5
a960 6
additional possible option \fB\-update\fR which is a modifier.  If given,
then all subsequent options ensure that any possible out of date
information is recalculated.  This currently only has any effect for the
\fI\-ypixels\fR count (which, if \fB\-update\fR is not given, will use the text
widget's current cached value for each line).  The count options are
interpreted as follows:
d963 2
a964 2
count all characters, whether elided or not.  Do not count
embedded windows or images.
d970 5
a974 6
count all display lines (i.e. counting one for each
time a line wraps) from the line of the first index up to, but not
including the display line of the second index.  Therefore if they are
both on the same display line, zero will be returned.  By definition
displaylines are visible and therefore this only counts portions of
actual visible lines.
d976 2
a977 3
count all characters and embedded windows or images (i.e.
everything which counts in text-widget index space), whether they are
elided or not.
d979 4
a982 5
count all logical lines (irrespective of wrapping) from
the line of the first index up to, but not including the line of the
second index.  Therefore if they are both on the same line, zero will be
returned.  Logical lines are counted whether they are currently visible
(non-elided) or not.
d984 4
a987 5
count the number of horizontal pixels from the first
pixel of the first index to (but not including) the first pixel of the
second index.  To count the total desired width of the text widget
(assuming wrapping is not enabled), first find the longest line and then
use
d990 4
a993 5
count the number of vertical pixels from the first pixel
of the first index to (but not including) the first pixel of the second
index.  If both indices are on the same display line, zero will be
returned.  To count the total number of vertical pixels in the text
widget, use
d998 4
a1001 4
The command returns a positive or negative integer corresponding to the
number of items counted between the two indices.  One such integer is
returned for each counting option given, so a list is returned if more
than one option was supplied.  For example
a1004 1
.VE 8.5
d1007 11
a1017 13
If \fIboolean\fR is specified, then it must have one of the true or
false values accepted by Tcl_GetBoolean.
If the value is a true one then internal consistency checks will be
turned on in the B-tree code associated with text widgets.
If \fIboolean\fR has a false value then the debugging checks will
be turned off.
In either case the command returns an empty string.
If \fIboolean\fR is not specified then the command returns \fBon\fR
or \fBoff\fR to indicate whether or not debugging is turned on.
There is a single debugging switch shared by all text widgets:  turning
debugging on or off in any widget turns it on or off for all widgets.
For widgets with large amounts of text, the consistency checks may
cause a noticeable slow-down.
d1020 4
a1023 4
When debugging is turned on, the drawing routines of the text widget
set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR
to the lists of indices that are redrawn.  The values of these variables
are tested by Tk's test suite.
d1027 17
a1043 20
Delete a range of characters from the text.
If both \fIindex1\fR and \fIindex2\fR are specified, then delete
all the characters starting with the one given by \fIindex1\fR
and stopping just before \fIindex2\fR (i.e. the character at
\fIindex2\fR is not deleted).
If \fIindex2\fR does not specify a position later in the text
than \fIindex1\fR then no characters are deleted.
If \fIindex2\fR is not specified then the single character at
\fIindex1\fR is deleted.
It is not allowable to delete characters in a way that would leave
the text without a newline as the last character.
The command returns an empty string.
If more indices are given, multiple ranges of text will be deleted.
All indices are first checked for validity before any deletions are made.
They are sorted and the text is removed from the last range to the
first range to deleted text does not cause an undesired index shifting
side-effects.  If multiple ranges with the same start index are given,
then the longest range is used.  If overlapping ranges are given, then
they will be merged into spans that do not cause deletion of text
outside the given ranges due to text shifted during deletion.
d1046 14
a1059 17
Returns a list with five elements describing the area occupied
by the display line containing \fIindex\fR.
The first two elements of the list give the x and y coordinates
of the upper-left corner of the area occupied by the
line, the third and fourth elements give the width and height
of the area, and the fifth element gives the position of the baseline
for the line, measured down from the top of the area.
All of this information is measured in pixels.
If the current wrap mode is \fBnone\fR and the line extends beyond
the boundaries of the window,
the area returned reflects the entire area of the line, including the
portions that are out of the window.
If the line is shorter than the full width of the window then the
area returned reflects just the portion of the line that is occupied
by characters and embedded windows.
If the display line containing \fIindex\fR is not visible on
the screen then the return value is an empty list.
d1062 6
a1067 7
Return the contents of the text widget from \fIindex1\fR up to,
but not including \fIindex2\fR,
including the text and
information about marks, tags, and embedded windows.
If \fIindex2\fR is not specified, then it defaults to
one character past \fIindex1\fR.  The information is returned
in the following format:
d1072 5
a1076 6
The possible \fIkey\fR values are \fBtext\fR, \fBmark\fR,
\fBtagon\fR, \fBtagoff\fR, \fBimage\fR, and \fBwindow\fR.  The corresponding
\fIvalue\fR is the text, mark name, tag name, image name, or window name.
The \fIindex\fR information is the index of the
start of the text, mark, tag transition, image or window.
One or more of the following switches (or abbreviations thereof)
d1080 1
d1085 1
d1088 2
a1089 2
The command has three arguments appended to it before it is evaluated:
the \fIkey\fR, \fIvalue\fR, and \fIindex\fR.
d1092 1
d1096 1
d1100 4
a1103 3
Include information about tag transitions in the dump results. Tag
information is returned as \fBtagon\fR and \fBtagoff\fR elements that
indicate the begin and end of each range of each tag, respectively.
d1106 6
a1111 6
Include information about text in the dump results.  The value is the
text up to the next element or the end of range indicated by \fIindex2\fR.
A text element does not span newlines.  A multi-line block of text that
contains no marks or tag transitions will still be dumped as a set
of text segments that each end with a newline.  The newline is part
of the value.
d1114 5
a1118 5
Include information about embedded windows in the dump results.
The value of a window is its Tk pathname, unless the window
has not been created yet.  (It must have a create script.)
In this case an empty string is returned, and you must query the
window by its index position to get more information.
d1122 5
a1126 4
This command controls the undo mechanism and the modified flag.  The
exact behavior of the command depends on the \fIoption\fR argument
that follows the \fBedit\fR argument.  The following forms of the
command are currently supported:
d1130 5
a1134 4
If \fIboolean\fR is not specified, returns the modified flag of the
widget. The insert, delete, edit undo and edit redo commands or the
user can set or clear the modified flag.  If \fIboolean\fR is
specified, sets the modified flag of the widget to \fIboolean\fR.
d1137 4
a1140 4
When the \fB\-undo\fR option is true, reapplies the last undone edits
provided no other edits were done since then. Generates an error when
the redo stack is empty.  Does nothing when the \fB\-undo\fR option is
false.
d1143 1
d1147 3
a1149 2
Inserts a separator (boundary) on the undo stack. Does nothing when
the \fB\-undo\fR option is false.
d1152 5
a1156 5
Undoes the last edit action when the \fB\-undo\fR option is true.  An
edit action is defined as all the insert and delete commands that are
recorded on the undo stack in between two separators. Generates an
error when the undo stack is empty.  Does nothing when the \fB\-undo\fR
option is false.
d1160 16
a1175 20
Return a range of characters from the text.
The return value will be all the characters in the text starting
with the one whose index is \fIindex1\fR and ending just before
the one whose index is \fIindex2\fR (the character at \fIindex2\fR
will not be returned).
If \fIindex2\fR is omitted then the single character at \fIindex1\fR
is returned.
If there are no characters in the specified range (e.g. \fIindex1\fR
is past the end of the file or \fIindex2\fR is less than or equal
to \fIindex1\fR) then an empty string is returned.
If the specified range contains embedded windows, no information
about them is included in the returned string.
If multiple index pairs are given, multiple ranges of text will be returned
in a list.  Invalid ranges will not be represented with empty strings in
the list.  The ranges are returned in the order passed to \fIpathName \fBget\fR.
.VS 8.5
If the \fB\-displaychars\fR option is given, then, within each range,
only those characters which are not elided will be returned.  This may
have the effect that some of the returned ranges are empty strings.
.VE 8.5
d1178 4
a1181 4
This command is used to manipulate embedded images.
The behavior of the command depends on the \fIoption\fR argument
that follows the \fBtag\fR argument.
The following forms of the command are currently supported:
d1185 5
a1189 4
Returns the value of a configuration option for an embedded image.
\fIIndex\fR identifies the embedded image, and \fIoption\fR
specifies a particular configuration option, which must be one of
the ones listed in the section \fBEMBEDDED IMAGES\fR.
d1192 11
a1202 13
Query or modify the configuration options for an embedded image.
If no \fIoption\fR is specified, returns a list describing all of
the available options for the embedded image at \fIindex\fR
(see \fBTk_ConfigureInfo\fR for information on the format of this list).
If \fIoption\fR is specified with no \fIvalue\fR, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
\fIoption\fR is specified).
If one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s);  in
this case the command returns an empty string.
See \fBEMBEDDED IMAGES\fR for information on the options that
are supported.
d1205 7
a1211 8
This command creates a new image annotation, which will appear
in the text at the position given by \fIindex\fR.
Any number of \fIoption\-value\fR pairs may be specified to
configure the annotation.
Returns a unique identifier that may be used as an index to refer to
this image.
See \fBEMBEDDED IMAGES\fR for information on the options that
are supported, and a description of the identifier returned.
d1214 1
d1220 3
a1222 3
Returns the position corresponding to \fIindex\fR in the form
\fIline.char\fR where \fIline\fR is the line number and \fIchar\fR
is the character number.
d1226 1
d1228 13
a1240 17
\fIindex\fR.
If \fIindex\fR refers to the end of the text (the character after
the last newline) then the new text is inserted just before the
last newline instead.
If there is a single \fIchars\fR argument and no \fItagList\fR, then
the new text will receive any tags that are present on both the
character before and the character after the insertion point; if a tag
is present on only one of these characters then it will not be
applied to the new text.
If \fItagList\fR is specified then it consists of a list of
tag names;  the new characters will receive all of the tags in
this list and no others, regardless of the tags present around
the insertion point.
If multiple \fIchars\fR\-\fItagList\fR argument pairs are present,
they produce the same effect as if a separate \fIpathName \fBinsert\fR widget
command had been issued for each pair, in order.
The last \fItagList\fR argument may be omitted.
d1243 4
a1246 4
This command is used to manipulate marks.  The exact behavior of
the command depends on the \fIoption\fR argument that follows
the \fBmark\fR argument.  The following forms of the command
are currently supported:
d1250 5
a1254 5
If \fIdirection\fR is not specified, returns \fBleft\fR or \fBright\fR
to indicate which of its adjacent characters \fImarkName\fR is attached
to.
If \fIdirection\fR is specified, it must be \fBleft\fR or \fBright\fR;
the gravity of \fImarkName\fR is set to the given value.
d1257 3
a1259 2
Returns a list whose elements are the names of all the marks that
are currently set.
d1262 12
a1273 13
Returns the name of the next mark at or after \fIindex\fR.
If \fIindex\fR is specified in numerical form, then the search for
the next mark begins at that index.
If \fIindex\fR is the name of a mark, then the search for
the next mark begins immediately after that mark.
This can still return a mark at the same position if
there are multiple marks at the same index.
These semantics mean that the \fBmark next\fR operation can be used to
step through all the marks in a text widget in the same order
as the mark information returned by the \fIpathName \fBdump\fR operation.
If a mark has been set to the special \fBend\fR index,
then it appears to be \fIafter\fR \fBend\fR with respect to the \fIpathName \fBmark next\fR operation.
An empty string is returned if there are no marks after \fIindex\fR.
d1276 11
a1286 11
Returns the name of the mark at or before \fIindex\fR.
If \fIindex\fR is specified in numerical form, then the search for
the previous mark begins with the character just before that index.
If \fIindex\fR is the name of a mark, then the search for
the next mark begins immediately before that mark.
This can still return a mark at the same position if
there are multiple marks at the same index.
These semantics mean that the \fIpathName \fBmark previous\fR operation can be used to
step through all the marks in a text widget in the reverse order
as the mark information returned by the \fIpathName \fBdump\fR operation.
An empty string is returned if there are no marks before \fIindex\fR.
d1289 5
a1293 5
Sets the mark named \fImarkName\fR to a position just before the
character at \fIindex\fR.
If \fImarkName\fR already exists, it is moved from its old position;
if it does not exist, a new mark is created.
This command returns an empty string.
d1296 4
a1299 3
Remove the mark corresponding to each of the \fImarkName\fR arguments.
The removed marks will not be usable in indices and will not be
returned by future calls to
d1305 3
a1307 3
.VS 8.5
This command is used to create and query widget peers.  It has
two forms, depending on \fIoption\fR:
d1311 5
a1315 5
Creates a peer text widget with the given \fInewPathName\fR, and any
optional standard configuration options (as for the \fItext\fR command).
By default the peer will have the same start and end line as the
parent widget, but these can be overridden with the standard
configuration options.
d1318 1
d1320 1
a1320 1
itself).  The order within this list is undefined.
d1324 6
a1329 6
Replaces the range of characters between \fIindex1\fR and \fIindex2\fR
with the given characters and tags.  See the section on \fIpathName
\fBinsert\fR for an explanation of the handling of the \fItagList...\fR
arguments, and the section on \fIpathName
\fBdelete\fR for an explanation of the handling of the indices.  If
\fIindex2\fR corresponds to an index earlier in the text than
d1333 4
a1336 4
The deletion and insertion are arranged so that no unnecessary
scrolling of the window or movement of insertion cursor occurs.  In
addition the undo/redo stack are correctly modified, if undo operations
are active in the text widget.  The command returns an empty string.
a1337 1
.VE 8.5
d1340 3
a1342 2
This command is used to implement scanning on texts.  It has
two forms, depending on \fIoption\fR:
d1346 5
a1350 4
Records \fIx\fR and \fIy\fR and the current view in the text window,
for use in conjunction with later \fIpathName \fBscan dragto\fR commands.
Typically this command is associated with a mouse button press in
the widget.  It returns an empty string.
d1353 7
a1359 8
This command computes the difference between its \fIx\fR and \fIy\fR
arguments and the \fIx\fR and \fIy\fR arguments to the last
\fIpathName \fBscan mark\fR command for the widget.
It then adjusts the view by 10 times the difference in coordinates.
This command is typically associated
with mouse motion events in the widget, to produce the effect of
dragging the text at high speed through the window.  The return
value is an empty string.
d1363 5
a1367 5
Searches the text in \fIpathName\fR starting at \fIindex\fR for a range
of characters that matches \fIpattern\fR.
If a match is found, the index of the first character in the match is
returned as result;  otherwise an empty string is returned.
One or more of the following switches (or abbreviations thereof)
d1372 4
a1375 3
The search will proceed forward through the text, finding the first
matching range starting at or after the position given by \fIindex\fR.
This is the default.
d1378 7
a1384 9
The search will proceed backward through the text, finding the
matching range closest to \fIindex\fR whose first character
is before \fIindex\fR
.VS 8.5
(it is not allowed to be at \fIindex\fR).  Note that, for a variety of
reasons, backwards searches can be substantially slower than forwards
searches (particularly when using \fB\-regexp\fR), so it is recommended
that performance-critical code use forward searches.
.VE 8.5
d1387 3
a1389 3
Use exact matching:  the characters in the matching range must be
identical to those in \fIpattern\fR.
This is the default.
d1392 8
a1399 10
Treat \fIpattern\fR as a regular expression and match it against
the text using the rules for regular expressions (see the \fBregexp\fR
command for details).
.VS 8.5
The default matching automatically passes
both the \fB\-lineanchor\fR and \fB\-linestop\fR options
to the regexp engine (unless \fB\-nolinestop\fR is used), so that
\fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR
sequences will never match the newline character \fI\en\fR.
.VE 8.5
d1402 5
a1406 6
.VS 8.5
This allows \fI.\fR and \fI[^\fR sequences to match the newline
character \fI\en\fR, which they will otherwise not do (see the \fBregexp\fR
command for details). This option is only meaningful if \fB\-regexp\fR
is also given, and an error will be thrown otherwise.  For example,
to match the entire text, use
a1407 1
.VE 8.5
d1410 1
d1414 8
a1421 7
The argument following \fB\-count\fR gives the name of a variable;
if a match is found, the number of index positions between beginning and
end of the matching range will be stored in the variable.  If there are no
embedded images or windows in the matching range (and there are no
elided characters if \fB\-elide\fR is not given), this is equivalent to the
number of characters matched.  In either case, the range \fImatchIdx\fR to
\fImatchIdx + $count chars\fR will return the entire matched text.
d1424 9
a1432 10
.VS 8.5
Find all matches in the given range and return a list of the indices of
the first character of each match.  If a \fB\-count\fI varName\fR switch is
given, then \fIvarName\fR is also set to a list containing one element
for each successful match.  Note that, even for exact searches, the
elements of this list may be different, if there are embedded images,
windows or hidden text.  Searches with \fB\-all\fR behave very
similarly to the Tcl command \fBregexp \-all\fR, in that overlapping
matches are not normally returned.  For example, applying an
\fB\-all\fR search of the pattern
a1440 1
.VE 8.5
d1443 6
a1448 6
.VS 8.5
When performing \fB\-all\fR searches, the normal behaviour is that
matches which overlap an already-found match will not be returned.  This
switch changes that behaviour so that all matches which are not totally
enclosed within another match are returned.  For example, applying an
\fB\-overlap\fR search of the pattern
d1452 1
a1452 2
will just match twice (i.e. no different to just \fB\-all\fR),
but matching
d1456 2
a1457 3
will now match twice.
An error will be thrown if this switch is used without \fB\-all\fR.
.VE 8.5
d1460 5
a1464 7
.VS 8.5
When performing any search, the normal behaviour is that
the start and stop limits are checked with respect to the
start of the matching text.  With the \fB\-strictlimits\fR flag,
the entire matching range must lie inside the start and stop
limits specified for the match to be valid.
.VE 8.5
d1467 2
a1468 2
Find elided (hidden) text as well. By default only displayed text is
searched.
d1471 19
a1489 24
This switch has no effect except to terminate the list of switches:
the next argument will be treated as \fIpattern\fR even if it starts
with \fB\-\fR.
.PP
.VS 8.5
The matching range may be within a single line of text, or run across
multiple lines (if parts of the pattern can match a new-line).  For
regular expression matching one can use the various newline-matching
features such as \fB$\fR to match the end of a line, \fB^\fR to match
the beginning of a line, and to control
whether \fB.\fR is allowed to match a new-line.
.VE 8.5
If \fIstopIndex\fR is specified, the search stops at that index:
for forward searches, no match at or after \fIstopIndex\fR will
be considered;  for backward searches, no match earlier in the
text than \fIstopIndex\fR will be considered.
If \fIstopIndex\fR is omitted, the entire text will be searched:
when the beginning or end of the text is reached, the search
continues at the other end until the starting location is reached
again;  if \fIstopIndex\fR is specified, no wrap-around will occur.
This means that, for example, if the search is \fB\-forwards\fR
but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR,
nothing will ever be found.  See \fBKNOWN BUGS\fR below for a number of
minor limitations of the \fIpathName \fBsearch\fR command.
d1493 7
a1499 8
Adjusts the view in the window so that the character given by \fIindex\fR
is completely visible.
If \fIindex\fR is already visible then the command does nothing.
If \fIindex\fR is a short distance out of view, the command
adjusts the view just enough to make \fIindex\fR visible at the
edge of the window.
If \fIindex\fR is far out of view, then the command centers
\fIindex\fR in the window.
d1502 4
a1505 4
This command is used to manipulate tags.  The exact behavior of the
command depends on the \fIoption\fR argument that follows the
\fBtag\fR argument.  The following forms of the command are currently
supported:
d1509 8
a1516 10
Associate the tag \fItagName\fR with all of the characters starting
with \fIindex1\fR and ending just before
\fIindex2\fR (the character at \fIindex2\fR is not tagged).
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
pairs.
If the last \fIindex2\fR is omitted then the single character at
\fIindex1\fR is tagged.
If there are no characters in the specified range (e.g. \fIindex1\fR
is past the end of the file or \fIindex2\fR is less than or equal
to \fIindex1\fR) then the command has no effect.
d1519 11
a1529 13
This command associates \fIscript\fR with the tag given by
\fItagName\fR.
Whenever the event sequence given by \fIsequence\fR occurs for a
character that has been tagged with \fItagName\fR,
the script will be invoked.
This widget command is similar to the \fBbind\fR command except that
it operates on characters in a text rather than entire widgets.
See the \fBbind\fR manual entry for complete details
on the syntax of \fIsequence\fR and the substitutions performed
on \fIscript\fR before invoking it.
If all arguments are specified then a new binding is created, replacing
any existing binding for the same \fIsequence\fR and \fItagName\fR
(if the first character of \fIscript\fR is
d1531 6
a1536 8
then \fIscript\fR augments an existing binding rather than replacing it).
In this case the return value is an empty string.
If \fIscript\fR is omitted then the command returns the \fIscript\fR
associated with \fItagName\fR and \fIsequence\fR (an error occurs
if there is no such binding).
If both \fIscript\fR and \fIsequence\fR are omitted then the command
returns a list of all the sequences for which bindings have been
defined for \fItagName\fR.
d1539 12
a1550 13
The only events for which bindings may be specified are those related
to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
Event bindings for a text widget use the \fBcurrent\fR mark described
under \fBMARKS\fR above.  An \fBEnter\fR event triggers for a tag when the tag
first becomes present on the current character, and a \fBLeave\fR event
triggers for a tag when it ceases to be present on the current character.
\fBEnter\fR and \fBLeave\fR events can happen either because the
\fBcurrent\fR mark moved or because the character at that position
changed.  Note that these events are different than \fBEnter\fR and
\fBLeave\fR events for windows.  Mouse and keyboard events are directed
to the current character.  If a virtual event is used in a binding, that
binding can trigger only if the virtual event is defined by an underlying
d1553 13
a1565 17
It is possible for the current character to have multiple tags,
and for each of them to have a binding for a particular event
sequence.
When this occurs, one binding is invoked for each tag, in order
from lowest-priority to highest priority.
If there are multiple matching bindings for a single tag, then
the most specific binding is chosen (see the manual entry for
the \fBbind\fR command for details).
\fBcontinue\fR and \fBbreak\fR commands within binding scripts
are processed in the same way as for bindings created with
the \fBbind\fR command.
.PP
If bindings are created for the widget as a whole using the
\fBbind\fR command, then those bindings will supplement the
tag bindings.
The tag bindings will be invoked first, followed by bindings
for the window as a whole.
d1569 1
d1571 2
a1572 3
associated with the tag given by \fItagName\fR.
\fIOption\fR may have any of the values accepted by the \fIpathName \fBtag
configure\fR widget command.
d1575 12
a1586 13
This command is similar to the \fIpathName \fBconfigure\fR widget command except
that it modifies options associated with the tag given by \fItagName\fR
instead of modifying options for the overall text widget.
If no \fIoption\fR is specified, the command returns a list describing
all of the available options for \fItagName\fR (see \fBTk_ConfigureInfo\fR
for information on the format of this list).
If \fIoption\fR is specified with no \fIvalue\fR, then the command returns
a list describing the one named option (this list will be identical to
the corresponding sublist of the value returned if no \fIoption\fR
is specified).
If one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s) in \fItagName\fR;
in this case the command returns an empty string.
d1590 5
a1594 6
Deletes all tag information for each of the \fItagName\fR
arguments.
The command removes the tags from all characters in the file
and also deletes any other information associated with the tags,
such as bindings and display information.
The command returns an empty string.
d1597 5
a1601 4
Changes the priority of tag \fItagName\fR so that it is just lower
in priority than the tag whose name is \fIbelowThis\fR.
If \fIbelowThis\fR is omitted, then \fItagName\fR's priority
is changed to make it lowest priority of all tags.
d1604 5
a1608 5
Returns a list whose elements are the names of all the tags that
are active at the character position given by \fIindex\fR.
If \fIindex\fR is omitted, then the return value will describe
all of the tags that exist for the text (this includes all tags
that have been named in a
d1612 2
a1613 3
widget command, even if no characters are currently marked with the tag).
The list will be sorted in order from lowest priority to highest
priority.
d1616 10
a1625 13
This command searches the text for a range of characters tagged
with \fItagName\fR where the first character of the range is
no earlier than the character at \fIindex1\fR and no later than
the character just before \fIindex2\fR (a range starting at
\fIindex2\fR will not be considered).
If several matching ranges exist, the first one is chosen.
The command's return value is a list containing
two elements, which are the index of the first character of the
range and the index of the character just after the last one in
the range.
If no matching range is found then the return value is an
empty string.
If \fIindex2\fR is not given then it defaults to the end of the text.
d1628 9
a1636 12
This command searches the text for a range of characters tagged
with \fItagName\fR where the first character of the range is
before the character at \fIindex1\fR and no earlier than
the character at \fIindex2\fR (a range starting at
\fIindex2\fR will be considered).
If several matching ranges exist, the one closest to \fIindex1\fR is chosen.
The command's return value is a list containing
two elements, which are the index of the first character of the
range and the index of the character just after the last one in
the range.
If no matching range is found then the return value is an
empty string.
d1640 5
a1644 4
Changes the priority of tag \fItagName\fR so that it is just higher
in priority than the tag whose name is \fIaboveThis\fR.
If \fIaboveThis\fR is omitted, then \fItagName\fR's priority
is changed to make it highest priority of all tags.
d1647 8
a1654 11
Returns a list describing all of the ranges of text that have been
tagged with \fItagName\fR.
The first two elements of the list describe the first tagged range
in the text, the next two elements describe the second range, and
so on.
The first element of each pair contains the index of the first
character of the range, and the second element of the pair contains
the index of the character just after the last one in the
range.
If there are no characters tagged with \fItag\fR then an
empty string is returned.
d1657 9
a1665 11
Remove the tag \fItagName\fR from all of the characters starting
at \fIindex1\fR and ending just before
\fIindex2\fR (the character at \fIindex2\fR is not affected).
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
pairs.
If the last \fIindex2\fR is omitted then the tag is removed from the
single character at \fIindex1\fR.
If there are no characters in the specified range (e.g. \fIindex1\fR
is past the end of the file or \fIindex2\fR is less than or equal
to \fIindex1\fR) then the command has no effect.
This command returns an empty string.
d1669 4
a1672 4
This command is used to manipulate embedded windows.
The behavior of the command depends on the \fIoption\fR argument
that follows the \fBtag\fR argument.
The following forms of the command are currently supported:
d1676 1
d1678 3
a1680 3
\fIIndex\fR identifies the embedded window, and \fIoption\fR
specifies a particular configuration option, which must be one of
the ones listed in the section \fBEMBEDDED WINDOWS\fR.
d1683 11
a1693 13
Query or modify the configuration options for an embedded window.
If no \fIoption\fR is specified, returns a list describing all of
the available options for the embedded window at \fIindex\fR
(see \fBTk_ConfigureInfo\fR for information on the format of this list).
If \fIoption\fR is specified with no \fIvalue\fR, then the command
returns a list describing the one named option (this list will be
identical to the corresponding sublist of the value returned if no
\fIoption\fR is specified).
If one or more \fIoption\-value\fR pairs are specified, then the command
modifies the given option(s) to have the given value(s);  in
this case the command returns an empty string.
See \fBEMBEDDED WINDOWS\fR for information on the options that
are supported.
d1696 5
a1700 7
This command creates a new window annotation, which will appear
in the text at the position given by \fIindex\fR.
Any number of \fIoption\-value\fR pairs may be specified to
configure the annotation.
See \fBEMBEDDED WINDOWS\fR for information on the options that
are supported.
Returns an empty string.
d1703 3
a1705 2
Returns a list whose elements are the names of all windows currently
embedded in \fIwindow\fR.
d1709 3
a1711 3
This command is used to query and change the horizontal position of the
text in the widget's window.  It can take any of the following
forms:
d1715 10
a1724 12
Returns a list containing two elements.
Each element is a real fraction between 0 and 1;  together they describe
the portion of the document's horizontal span that is visible in
the window.
For example, if the first element is .2 and the second element is .6,
20% of the text is off-screen to the left, the middle 40% is visible
in the window, and 40% of the text is off-screen to the right.
The fractions refer only to the lines that are actually visible in the
window:  if the lines in the window are all very short, so that they
are entirely visible, the returned fractions will be 0 and 1,
even if there are other lines in the text that are
much wider than the window.
d1729 4
a1732 3
Adjusts the view in the window so that \fIfraction\fR of the horizontal
span of the text is off-screen to the left.
\fIFraction\fR is a fraction between 0 and 1.
d1735 1
d1737 4
a1740 6
\fInumber\fR and \fIwhat\fR.
\fIWhat\fR must be \fBunits\fR, \fBpages\fR or \fBpixels\fR.
.VS 8.5
If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR must be an
integer, otherwise number may be specified in any of the forms acceptable
to \fBTk_GetPixels\fR, such as
d1744 3
a1746 4
(the result is rounded
to the nearest integer value.  If no units are given, pixels are
assumed).  If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display; if it is
d1748 3
a1750 5
\fBpixels\fR then the view adjusts by \fInumber\fR pixels.  If
.VE 8.5
\fInumber\fR is negative then characters farther to the left become
visible; if it is positive then characters farther to the right become
visible.
d1754 3
a1756 3
This command is used to query and change the vertical position of the
text in the widget's window.
It can take any of the following forms:
d1760 1
d1762 7
a1768 10
between 0 and 1.
The first element gives the position of the first visible pixel of the
first character (or image, etc) in the
top line in the window, relative to the text as a whole (0.5 means
it is halfway through the text, for example).
The second element gives the position of the first pixel just after the
last visible one in the bottom line of the window,
relative to the text as a whole.
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
option.
d1771 1
d1773 8
a1780 12
appears at the top of the top line of the window.
\fIFraction\fR is a fraction between 0 and 1;  0 indicates the first
pixel of the first character in the text, 0.33 indicates the pixel that is
one-third the way through the text; and so on.
.VS 8.5
Values close to 1 will
indicate values close to the last pixel in the text (1 actually refers
to one pixel beyond the last pixel), but in such cases the widget will
never scroll beyond the last pixel, and so a value of 1 will effectively
be rounded back to whatever fraction ensures the last pixel is at the
bottom of the window, and some other pixel is at the top.
.VE 8.5
d1783 1
d1785 4
a1788 6
\fInumber\fR and \fIwhat\fR.
\fIWhat\fR must be \fBunits\fR, \fBpages\fR or \fBpixels\fR.
.VS 8.5
If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR must be an
integer, otherwise number may be specified in any of the forms acceptable
to \fBTk_GetPixels\fR, such as
d1792 3
a1794 4
(the result is rounded
to the nearest integer value.  If no units are given, pixels are
assumed).  If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
\fInumber\fR lines on the display; if it is \fBpages\fR then the view
d1796 3
a1798 5
adjusts by \fInumber\fR pixels.
.VE 8.5
If \fInumber\fR is negative then earlier positions in the text
become visible;  if it is positive then later positions in the text
become visible.
d1801 5
a1805 5
Changes the view in the widget's window to make \fIindex\fR visible.
If the \fB\-pickplace\fR option is not specified then \fIindex\fR will
appear at the top of the window.
If \fB\-pickplace\fR is specified then the widget chooses where
\fIindex\fR appears in the window:
d1808 2
a1809 2
If \fIindex\fR is already visible somewhere in the window then the
command does nothing.
d1811 2
a1812 2
If \fIindex\fR is only a few lines off-screen above the window then
it will be positioned at the top of the window.
d1814 2
a1815 2
If \fIindex\fR is only a few lines off-screen below the window then
it will be positioned at the bottom of the window.
d1819 4
a1822 3
The \fB\-pickplace\fR option has been obsoleted by the \fIpathName \fBsee\fR widget
command (\fIpathName \fBsee\fR handles both x- and y-motion to make a location
visible, whereas the \fB\-pickplace\fR mode only handles motion in y).
d1826 4
a1829 4
This command makes the first character on the line after
the one given by \fInumber\fR visible at the top of the window.
\fINumber\fR must be an integer.
This command used to be used for scrolling, but now it is obsolete.
d1833 2
a1834 3
Tk automatically creates class bindings for texts that give them
the following default behavior.
In the descriptions below,
d1836 2
a1837 2
is dependent on the value of
the \fBtcl_wordchars\fR variable.  See \fBtclvars\fR(n).
d1839 5
a1843 5
Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
input focus to this widget, and clears any selection in the widget.
Dragging with mouse button 1 strokes out a selection between
the insertion cursor and the character under the mouse.
d1845 3
a1847 4
Double-clicking with mouse button 1 selects the word under the mouse
and positions the insertion cursor at the start of the word.
Dragging after a double click will stroke out a selection consisting
of whole words.
d1849 3
a1851 4
Triple-clicking with mouse button 1 selects the line under the mouse
and positions the insertion cursor at the start of the line.
Dragging after a triple click will stroke out a selection consisting
of whole lines.
d1853 6
a1858 7
The ends of the selection can be adjusted by dragging with mouse
button 1 while the Shift key is down;  this will adjust the end
of the selection that was nearest to the mouse cursor when button
1 was pressed.
If the button is double-clicked before dragging then the selection
will be adjusted in units of whole words;  if it is triple-clicked
then the selection will be adjusted in units of whole lines.
d1863 2
a1864 2
If any normal printing characters are typed, they are
inserted at the point of the insertion cursor.
d1866 4
a1869 5
The view in the widget can be adjusted by dragging with mouse button 2.
If mouse button 2 is clicked without moving the mouse, the selection
is copied into the text at the position of the mouse cursor.
The Insert key also inserts the selection, but at the position of
the insertion cursor.
d1871 3
a1873 4
If the mouse is dragged out of the widget
while button 1 is pressed, the entry will automatically scroll to
make more text visible (if there is more text off-screen on the side
where the mouse left the window).
d1875 16
a1890 9
The Left and Right keys move the insertion cursor one character to the
left or right;  they also clear any selection in the text.
If Left or Right is typed with the Shift key down, then the insertion
cursor moves and the selection is extended to include the new character.
Control-Left and Control-Right move the insertion cursor by words, and
Control-Shift-Left and Control-Shift-Right move the insertion cursor
by words and also extend the selection.
Control-b and Control-f behave the same as Left and Right, respectively.
Meta-b and Meta-f behave the same as Control-Left and Control-Right,
a1891 10
.IP [10]
The Up and Down keys move the insertion cursor one line up or
down and clear any selection in the text.
If Up or Right is typed with the Shift key down, then the insertion
cursor moves and the selection is extended to include the new character.
Control-Up and Control-Down move the insertion cursor by paragraphs (groups
of lines separated by blank lines), and
Control-Shift-Up and Control-Shift-Down move the insertion cursor
by paragraphs and also extend the selection.
Control-p and Control-n behave the same as Up and Down, respectively.
d1893 4
a1896 4
The Next and Prior keys move the insertion cursor forward or backwards
by one screenful and clear any selection in the text.
If the Shift key is held down while Next or Prior is typed, then
the selection is extended to include the new character.
d1901 4
a1904 4
Home and Control-a move the insertion cursor to the
beginning of its display line and clear any selection in the widget.
Shift-Home moves the insertion cursor to the beginning of the display line
and also extends the selection to that point.
d1906 3
a1908 4
End and Control-e move the insertion cursor to the
end of the display line and clear any selection in the widget.
Shift-End moves the cursor to the end of the display line and extends
the selection to that point.
d1910 4
a1913 4
Control-Home and Meta-< move the insertion cursor to the beginning of
the text and clear any selection in the widget.
Control-Shift-Home moves the insertion cursor to the beginning of the text
and also extends the selection to that point.
d1915 3
a1917 4
Control-End and Meta-> move the insertion cursor to the end of the
text and clear any selection in the widget.
Control-Shift-End moves the cursor to the end of the text and extends
the selection to that point.
d1919 5
a1923 5
The Select key and Control-Space set the selection anchor to the position
of the insertion cursor.  They do not affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
d1929 3
a1931 3
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is a selection.
This action is carried out by the command \fBtk_textCopy\fR.
d1933 4
a1936 5
The F20 key (labelled Cut on many Sun workstations) or Control-w
copies the selection in the widget to the clipboard and deletes
the selection.
This action is carried out by the command \fBtk_textCut\fR.
If there is no selection in the widget then these keys have no effect.
d1938 3
a1940 4
The F18 key (labelled Paste on many Sun workstations) or Control-y
inserts the contents of the clipboard at the position of the
insertion cursor.
This action is carried out by the command \fBtk_textPaste\fR.
d1942 3
a1944 3
The Delete key deletes the selection, if there is one in the widget.
If there is no selection, it deletes the character to the right of
the insertion cursor.
d1946 3
a1948 4
Backspace and Control-h delete the selection, if there is one
in the widget.
If there is no selection, they delete the character to the left of
the insertion cursor.
d1954 3
a1956 3
Control-k deletes from the insertion cursor to the end of its line;
if the insertion cursor is already at the end of a line, then
Control-k deletes the newline character.
d1958 2
a1959 2
Control-o opens a new line by inserting a newline character in
front of the insertion cursor without moving the insertion cursor.
d1961 2
a1962 2
Meta-backspace and Meta-Delete delete the word to the left of the
insertion cursor.
d1964 2
a1965 2
Control-x deletes whatever is selected in the text widget
after copying it to the clipboard.
d1967 2
a1968 2
Control-t reverses the order of the two characters to the right of
the insertion cursor.
d1970 3
a1972 3
Control-z (and Control-underscore on UNIX when \fBtk_strictMotif\fR is
true) undoes the last edit action if the \fB\-undo\fR option is true.
Does nothing otherwise.
d1974 2
a1975 2
Control-Z (or Control-y on Windows) reapplies the last undone edit
action if the \fB\-undo\fR option is true. Does nothing otherwise.
d1977 3
a1979 4
If the widget is disabled using the \fB\-state\fR option, then its
view can still be adjusted and text can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place.
d1981 2
a1982 2
The behavior of texts can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
a1984 1
.VS 8.5
d1988 3
a1990 3
to refer to index positions (which included characters, embedded
windows and embedded images).  As of Tk 8.5 the text widget deals
separately and correctly with
d1998 1
a1998 2
continue to refer to indices.
One must use any of the full forms
d2002 1
a2002 1
etc. to refer to actual character indices.  This confusion may be fixed in a
a2006 1
.VE 8.5
d2009 26
a2034 31
Text widgets should run efficiently under a variety
of conditions.  The text widget uses about 2-3 bytes of
main memory for each byte of text, so texts containing a megabyte
or more should be practical on most workstations.
Text is represented internally with a modified B-tree structure
that makes operations relatively efficient even with large texts.
Tags are included in the B-tree structure in a way that allows
tags to span large ranges or have many disjoint smaller ranges
without loss of efficiency.
Marks are also implemented in a way that allows large numbers of
marks.
In most cases it is fine to have large numbers of unique tags,
or a tag that has many distinct ranges.
.PP
One performance problem can arise if you have hundreds or thousands
of different tags that all have the following characteristics:
the first and last ranges of each tag are near the beginning and
end of the text, respectively,
or a single tag range covers most of the text widget.
The cost of adding and deleting tags like this is proportional
to the number of other tags with the same properties.
In contrast, there is no problem with having thousands of distinct
tags if their overall ranges are localized and spread uniformly throughout
the text.
.PP
Very long text lines can be expensive,
especially if they have many marks and tags within them.
.PP
The display line with the insert cursor is redrawn each time the
cursor blinks, which causes a steady stream of graphics traffic.
Set the \fBinsertOffTime\fR attribute to 0 avoid this.
a2035 1
.VS 8.5
d2037 15
a2051 16
The \fIpathName \fBsearch \-regexp\fR sub-command attempts to perform sophisticated
regexp matching across multiple lines in an efficient fashion (since Tk
8.5), examining each line individually, and then in small groups of lines,
whether searching forwards or backwards.  Under certain conditions the
search result might differ from that obtained by applying the same regexp
to the entire text from the widget in one go.  For example, when
searching with a greedy regexp, the widget will continue to attempt to
add extra lines to the match as long as one of two conditions are true:
either Tcl's regexp library returns a code to indicate a longer match is
possible (but there are known bugs in Tcl which mean this code is not
always correctly returned); or if each extra line added results in at
least a partial match with the pattern.  This means in the case where the
first extra line added results in no match and Tcl's regexp system
returns the incorrect code and adding a second extra line would actually
match, the text widget will return the wrong result.  In practice this is
a rare problem, but it can occur, for example:
d2057 1
a2057 2
will not find a match when one exists of 19
characters starting from the first
d2060 8
a2067 9
Whenever one possible match is fully enclosed in another, the search
command will attempt to ensure only the larger match is returned.
When performing backwards regexp searches it is possible that Tcl
will not always achieve this, in the case where a match is preceded by
one or more short, non-overlapping matches, all of which are preceded
by a large match which actually encompasses all of them.  The search
algorithm used by the widget does not look back arbitrarily far for a
possible match which might cover large portions of the widget.
For example:
a2085 1
.VE 8.5
@


1.54
log
@Corrected description of when tag -relief is ignored.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.53 2007/12/13 15:23:43 dgp Exp $
d495 4
a498 7
\fIPixels\fR specifies the width of a 3-D border to draw around
the background.
It may have any of the forms accepted by \fBTk_GetPixels\fR.
This option is used in conjunction with the \fB\-relief\fR
option to give a 3-D appearance to the background for characters;
it is ignored unless the \fB\-background\fR option
has been set for the tag.
d568 1
a568 1
\fIRelief\fR specifies the 3-D relief to use for drawing backgrounds,
d571 1
a571 3
option to give a 3-D appearance to the background for characters;
it is ignored unless the \fB\-borderwidth\fR option
has been set for the tag.
@


1.53
log
@merge stable branch onto HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.43.2.4 2007/11/01 16:37:16 dgp Exp $
d575 1
a575 1
it is ignored unless the \fB\-background\fR option
@


1.53.2.1
log
@
	* doc/text.n: Fixed minor typo in the description of 'text
	  delete', as reported by <eee@@users.sf.net> on the chat.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.53 2007/12/13 15:23:43 dgp Exp $
d1202 1
a1202 1
first range so deleted text does not cause an undesired index shifting
@


1.52
log
@Fixed mistake in [$t tag remove] docs. [Bug 1792191]
@
text
@d7 3
a9 3
'\"
'\" RCS: @@(#) $Id: text.n,v 1.51 2007/10/30 21:29:59 dkf Exp $
'\"
@


1.51
log
@More documentation improvements
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.50 2007/10/30 19:39:26 hobbs Exp $
d1863 2
a1864 2
If the last \fIindex2\fR is omitted then the single character at
\fIindex1\fR is tagged.
@


1.50
log
@fix spelling of -inactiveselectbackground [Bug 1626415]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.49 2007/10/30 15:02:14 dkf Exp $
d118 3
a120 2
For example, \fB\-tabs {2c left 4c 6c center}\fR creates three
tab stops at two-centimeter intervals;  the first two use left
d122 2
d131 1
d137 1
d1496 2
a1497 1
.br
d1502 1
@


1.49
log
@Clarify search subcommand docs. [Bug 1622919]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.48 2007/10/29 16:04:14 dkf Exp $
d56 1
a56 1
.OP \-inactiveselectionbackground inactiveSelectionBackground Foreground
d917 1
a917 1
\fB\-inactiveselectionbackground\fR option for the text widget is used
d921 1
a921 1
\fBsel\fR not shown at all (when \fB\-inactiveselectionbackground\fR is
@


1.48
log
@Lots more GOOBE stuff. Now works with 'make html'!
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.47 2007/10/26 20:13:23 dgp Exp $
d1646 2
a1647 1
features such as \fB$\fR to match the end of a line, and to control
@


1.47
log
@        * doc/*.1:              Revert doc changes that broke
        * doc/*.3:              `make html` so we can get the release
        * doc/*.n:              out the door.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.44 2007/10/16 15:13:18 dkf Exp $
d132 1
a132 1
\fB\-tabs "[expr {4 * [font measure $font 0]}] left" -tabstyle wordprocessor\fR.
d138 2
a139 1
n'th tab character in the line's text will be associated with the n'th
d141 1
a141 1
falls to the right of the n'th tab stop, then a gap of a single space
d153 3
a155 3
If the font doesn't have a uniform width then the width of the
character ``0'' is used in translating from character units to
screen units.
d161 1
a161 1
exactly one line on the screen;  extra characters that don't fit
d192 2
a193 1
called "marks".
d238 4
a241 3
is used as part of a modifier, it can be positive or negative, so '\fIbase\fR
\- \-3 lines' is perfectly valid (and equivalent to '\fIbase\fR
+3lines').
d416 2
a417 1
left-to-right order.  For example, the index ``\fBend \- 1 chars\fR''
d419 2
a420 1
``\fBinsert wordstart \- 1 c\fR'' refers to the character just before
d424 4
a427 2
widget.  So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the
index ``\fB2.0\fR''.
d441 3
a443 1
avoid using the characters `` '' (space), \fB+\fR, or \fB\-\fR:
d445 1
a445 1
them can't be used as indices.
d458 3
a460 1
``\fIpathName \fBtag raise\fR'' and ``\fIpathName \fBtag lower\fR''
d469 3
a471 1
using the ``\fIpathName \fBtag configure\fR'' widget command.
d485 1
a485 1
If \fIbitmap\fR hasn't been specified, or if it is specified
d509 1
a509 1
If \fIbitmap\fR hasn't been specified, or if it is specified
d641 1
a641 1
If a particular display option hasn't been specified for a
d656 3
a658 2
For details, see the description of the ``\fIpathName \fBtag bind\fR'' widget
command below.
d678 1
a678 1
they refer to places in the file, but a mark isn't associated
d688 3
a690 1
Marks may be manipulated with the ``\fIpathName \fBmark\fR'' widget
d694 3
a696 2
Each mark also has a "gravity", which is either \fBleft\fR or
\fBright\fR.
d907 2
a908 1
created, and it may not be deleted with the ``\fIpathName \fBtag delete\fR''
d929 3
a931 2
may not be unset with the ``\fIpathName \fBmark unset\fR'' widget
command.
d948 3
a950 1
Boundaries (called "separators") are inserted between edit actions.  The
d1014 4
a1017 1
underlying data store still has indices numbered from "1.0" to "end".
d1027 4
a1030 2
Note that peers are really peers.  Deleting the 'original' text widget
will not cause any other peers to be deleted, or otherwise affected.
d1070 1
a1070 1
the relationship is satisfied and 0 if it isn't.
d1138 2
a1139 1
use '.text count \-xpixels "${line}.0" "${line}.0 lineend"'.
d1145 4
a1148 2
widget, use '.text count \-ypixels 1.0 end', and to ensure this is up to
date, use '.text count \-update \-ypixels 1.0 end'.
d1153 3
a1155 3
than one option was supplied.  For example '.text count \-xpixels
\-ypixels 1.3 4.5' is perfectly valid and will return a list of two
elements.
d1187 1
a1187 1
If \fIindex2\fR doesn't specify a position later in the text
d1189 1
a1189 1
If \fIindex2\fR isn't specified then the single character at
d1454 1
a1454 1
if it doesn't exist, a new mark is created.
d1460 2
a1461 1
returned by future calls to ``\fIpathName \fBmark names\fR''.
d1568 2
a1569 1
to match the entire text, use 'search \-nolinestop \-regexp ".*" 1.0'.
d1594 9
a1602 4
\fB\-all\fR search
of the pattern '\\w+' against 'hello there' will just match twice, once
for each word, and matching 'Z[a\-z]+Z' against 'ZooZooZoo' will just
match once.
d1611 10
a1620 3
\fB\-overlap\fR search of the pattern '\\w+' against 'hello there' will
just match twice (i.e. no different to just \fB\-all\fR),
but matching 'Z[a\-z]+Z' against 'ZooZooZoo' will now match twice.
d1683 1
a1683 1
\fIindex2\fR (the character at \fIindex2\fR isn't tagged).
d1705 3
a1707 2
(if the first character of \fIscript\fR is ``+'' then \fIscript\fR
augments an existing binding rather than replacing it).
d1792 5
a1796 4
that have been named in a ``\fIpathName \fBtag\fR'' widget
command but haven't been deleted by a ``\fIpathName \fBtag delete\fR''
widget command, even if no characters are currently marked with
the tag).
d1852 1
a1852 1
\fIindex2\fR (the character at \fIindex2\fR isn't affected).
d1939 5
a1943 1
to \fBTk_GetPixels\fR, such as ``2.0c'' or ``1i'' (the result is rounded
d1996 5
a2000 1
to \fBTk_GetPixels\fR, such as ``2.0c'' or ``1i'' (the result is rounded
d2013 1
a2013 1
If the \fB\-pickplace\fR option isn't specified then \fIindex\fR will
d2045 4
a2048 2
In the descriptions below, ``word'' is dependent on the value of
the \fBtcl_wordchars\fR variable.  See tclvars(n).
d2141 1
a2141 1
of the insertion cursor.  They don't affect the current selection.
d2212 22
a2233 9
Before Tk 8.5, the widget used the string "chars" to refer to index
positions (which included characters, embedded windows and embedded
images).  As of Tk 8.5 the text widget deals separately and correctly
with "chars" and "indices".  For backwards compatibility, however, the
index modifiers "+N chars" and "\-N chars" continue to refer to indices.
One must use any of the full forms "+N any chars" or "\-N any chars" etc
to refer to actual character indices.  This confusion may be fixed in a
future release by making the widget correctly interpret "+N chars" as a
synonym for "+N any chars".
d2289 2
a2290 2
\.t insert 1.0 "aaaa\\nbbbb\\ncccc\\nbbbb\\naaaa\\n"
\.t search \-regexp \-\- {(a+|b+\\nc+\\nb+)+\\na+} 1.0
d2293 2
a2294 1
characters starting from the first 'b'.
d2307 2
a2308 2
\.t insert 1.0 "aaaa\\nbbbb\\nbbbb\\nbbbb\\nbbbb\\n"
\.t search \-regexp \-backward \-\- {b+\\n|a+\\n(b+\\n)+} end
d2310 13
a2322 5
matches at '5.0' when a true greedy match would match at '1.0'.
Similarly if we add \fB\-all\fR to this case, it matches at
all of '5.0', '4.0', '3.0' and '1.0',
when really it should only match at '1.0' since that match
encloses all the others.
a2323 1

a2325 1

@


1.46
log
@Lots of improvements to look and feel of manual pages
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.45 2007/10/23 15:44:35 dkf Exp $
d153 2
a154 3
character
.QW 0
is used in translating from character units to screen units.
d413 1
a413 2
left-to-right order.  For example, the index
.QW "\fBend \- 1 chars\fR"
d415 1
a415 2
.QW "\fBinsert wordstart \- 1 c\fR"
refers to the character just before
d419 2
a420 4
widget.  So, for example, the index
.QW "\fB1.0 -1c +1c\fR"
refers to the index
.QW "\fB2.0\fR".
d434 1
a434 3
avoid using the characters
.QW " "
(space), \fB+\fR, or \fB\-\fR:
d449 1
a449 3
.QW "\fIpathName \fBtag raise\fR"
and
.QW "\fIpathName \fBtag lower\fR"
d458 1
a458 3
using the
.QW "\fIpathName \fBtag configure\fR"
widget command.
d643 2
a644 3
For details, see the description of the
.QW "\fIpathName \fBtag bind\fR"
widget command below.
d674 1
a674 3
Marks may be manipulated with the
.QW "\fIpathName \fBmark\fR"
widget
d890 1
a890 2
created, and it may not be deleted with the
.QW "\fIpathName \fBtag delete\fR"
d911 2
a912 3
may not be unset with the
.QW "\fIpathName \fBmark unset\fR"
widget command.
d1431 1
a1431 2
returned by future calls to
.QW "\fIpathName \fBmark names\fR" .
d1461 1
a1461 2
.RS
.PP
a1465 1
.RE
d1662 2
a1663 3
(if the first character of \fIscript\fR is
.QW +
then \fIscript\fR augments an existing binding rather than replacing it).
d1748 2
a1749 4
that have been named in a
.QW "\fIpathName \fBtag\fR"
widget command but haven't been deleted by a
.QW "\fIpathName \fBtag delete\fR"
d1894 1
a1894 5
to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded
d1947 1
a1947 5
to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded
d1992 2
a1993 3
In the descriptions below,
.QW word
is dependent on the value of the \fBtcl_wordchars\fR variable. See tclvars(n).
@


1.45
log
@Rendering-with-groff GOOBE.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.44 2007/10/16 15:13:18 dkf Exp $
d153 3
a155 2
character ``0'' is used in translating from character units to
screen units.
d414 2
a415 1
left-to-right order.  For example, the index ``\fBend \- 1 chars\fR''
d417 2
a418 1
``\fBinsert wordstart \- 1 c\fR'' refers to the character just before
d422 4
a425 2
widget.  So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the
index ``\fB2.0\fR''.
d439 3
a441 1
avoid using the characters `` '' (space), \fB+\fR, or \fB\-\fR:
d456 3
a458 1
``\fIpathName \fBtag raise\fR'' and ``\fIpathName \fBtag lower\fR''
d467 3
a469 1
using the ``\fIpathName \fBtag configure\fR'' widget command.
d654 3
a656 2
For details, see the description of the ``\fIpathName \fBtag bind\fR'' widget
command below.
d686 3
a688 1
Marks may be manipulated with the ``\fIpathName \fBmark\fR'' widget
d904 2
a905 1
created, and it may not be deleted with the ``\fIpathName \fBtag delete\fR''
d926 3
a928 2
may not be unset with the ``\fIpathName \fBmark unset\fR'' widget
command.
d1447 2
a1448 1
returned by future calls to ``\fIpathName \fBmark names\fR''.
d1681 3
a1683 2
(if the first character of \fIscript\fR is ``+'' then \fIscript\fR
augments an existing binding rather than replacing it).
d1768 4
a1771 2
that have been named in a ``\fIpathName \fBtag\fR'' widget
command but haven't been deleted by a ``\fIpathName \fBtag delete\fR''
d1916 5
a1920 1
to \fBTk_GetPixels\fR, such as ``2.0c'' or ``1i'' (the result is rounded
d1973 5
a1977 1
to \fBTk_GetPixels\fR, such as ``2.0c'' or ``1i'' (the result is rounded
d2022 3
a2024 2
In the descriptions below, ``word'' is dependent on the value of
the \fBtcl_wordchars\fR variable.  See tclvars(n).
@


1.44
log
@Text widget documentation improvements
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.43 2006/11/15 13:29:17 dkf Exp $
d1461 2
a1462 1
.br
d1467 1
@


1.43
log
@Convert \fP to \fR so that man-page scrapers have an easier time.
@
text
@d7 3
a9 3
'\" 
'\" RCS: @@(#) $Id: text.n,v 1.42 2006/10/18 00:01:38 hobbs Exp $
'\" 
d39 2
a40 2
Specifies a boolean that says whether the blinking insertion cursor 
should be drawn as a character-sized rectangular block.  If false 
d117 1
a117 1
right-justified at the tab position. 
d120 1
a120 1
justification and the third uses center justification.  
d124 1
a124 1
distances must be strictly positive, and must always increase from one 
d131 1
a131 1
for example every 4 characters, simply configure the widget with 
d382 2
a383 2
Adjust the index to refer to the first index on the line.  If the 
\fBdisplay\fR submodifier is given, this is the first index on the 
d418 2
a419 2
the resulting index is constrained to be a valid index in the text 
widget.  So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the 
d455 1
a455 1
\fBbackground\fR, \fBfont\fR, and \fBforeground\fR options for the
d485 1
a485 1
\fB\-elide \fIboolean\fR 
d601 1
a601 1
default 8-character tabs as described for the \fBtags\fR
d605 1
a605 1
\fIStyle\fR specifies either the \fItabular\fR or 
d643 1
a643 1
For details, see the description of the \fBtag bind\fR widget
d705 1
a705 1
these two special marks, all marks are shared between peer text 
d737 1
a737 1
\fBwindow create\fR widget command, several configuration
d739 1
a739 1
These options may be  modified later with the \fBwindow configure\fR
d815 1
a815 1
when the image is inserted into the text widget with \fBimage create\fR.
d819 1
a819 1
When an embedded image is added to a text widget with the \fBimage
d828 1
a828 1
Once this name is assigned to this instance of the image, it does not 
d830 1
a830 1
with \fBimage configure\fR.
d833 1
a833 1
\fBimage create\fR widget command, several configuration
d835 1
a835 1
These options may be modified later with the \fBimage configure\fR
d886 1
a886 1
Whenever the \fBsel\fR tag range changes a virtual event 
d900 1
a900 1
instead of \fB-selectbackground\fR when the text widget does not have
d920 2
a921 2
as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual 
event is generated. See the \fBedit modified\fR widget command for 
d950 1
a950 1
See below for the \fBedit\fR widget command that controls the undo
d973 1
a973 1
shared between peers.  This means the \fB-window\fR option of embedded
d975 1
a975 1
the \fB-create\fR script capabilities to allow each peer to create its
d977 2
a978 2
options of each peer (e.g. \fB-font\fR, etc) can be set independently,
with the exception of \fB-undo\fR, \fB-maxUndo\fR, \fB-autoSeparators\fR
d996 2
a997 2
means that the command \fB$peer index end\fR may return quite different
values in different peers.  Similarly, commands like \fB$peer tag
d999 2
a1000 2
to the peer.  The configuration options \fB-startline\fR and
\fB-endline\fR may be used to control how much of the underlying data is
d1006 2
a1007 2
See below for the \fBpeer\fR widget command that controls the creation
of peer widgets.
d1068 1
a1068 1
If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number 
d1083 1
a1083 1
.IP \fB\-chars\fR 
d1086 1
a1086 1
.IP \fB\-displaychars\fR 
d1088 1
a1088 1
.IP \fB\-displayindices\fR 
d1090 1
a1090 1
.IP \fB\-displaylines\fR 
d1097 1
a1097 1
.IP \fB\-indices\fR 
d1101 1
a1101 1
.IP \fB\-lines\fR 
d1107 1
a1107 1
.IP \fB\-xpixels\fR 
d1113 1
a1113 1
.IP \fB\-ypixels\fR 
d1121 1
a1121 1
The command returns a positive or negative integer corresponding to the 
d1123 1
a1123 1
returned for each counting option given, so a list is returned if more 
d1144 1
d1150 1
d1299 1
a1299 1
the list.  The ranges are returned in the order passed to \fBget\fR.
d1302 1
a1302 1
only those characters which are not elided will be returned.  This may 
d1371 1
a1371 1
they produce the same effect as if a separate \fBinsert\fR widget
d1403 1
a1403 1
as the mark information returned by the \fBdump\fR operation.
d1405 1
a1405 1
then it appears to be \fIafter\fR \fBend\fR with respect to the \fBmark next\fR operation.
d1416 1
a1416 1
These semantics mean that the \fBmark previous\fR operation can be used to
d1418 1
a1418 1
as the mark information returned by the \fBdump\fR operation.
d1454 1
a1454 1
Replaces the range of characters between \fIindex1\fR and \fIindex2\fR 
d1475 1
a1475 1
for use in conjunction with later \fBscan dragto\fR commands.
d1482 1
a1482 1
\fBscan mark\fR command for the widget.
d1526 1
a1526 1
both the \fB\-lineanchor\fR and \fB\-linestop\fR options 
d1528 1
a1528 1
\fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR 
d1534 1
a1534 1
This allows \fI.\fR and \fI[^\fR sequences to match the newline 
d1536 1
a1536 1
command for details). This option is only meaningful if \fB\-regexp\fR 
d1556 2
a1557 2
the first character of each match.  If a \fB\-count\fI varName\fR switch is 
given, then \fBvarName\fR is also set to a list containing one element 
d1563 1
a1563 1
\fB\-all\fR search 
d1569 1
a1569 1
\fB\-overlap\fR 
d1577 1
a1577 1
but matching 'Z[a\-z]+Z' against 'ZooZooZoo' will now match twice.  
d1581 1
a1581 1
\fB\-strictlimits\fR 
d1598 1
a1598 1
.LP
d1614 2
a1615 2
This means that, for example, if the search is \fB\-forwards\fR 
but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR, 
d1617 1
a1617 1
minor limitations of the \fBsearch\fR command.
d1674 1
a1674 1
to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, 
d1710 2
a1711 2
\fIOption\fR may have any of the values accepted by the \fBtag configure\fR
widget command.
d1714 1
a1714 1
This command is similar to the \fBconfigure\fR widget command except
d1932 1
a1932 1
Values close to 1 will 
d1977 3
a1979 3
The \fB\-pickplace\fR option has been obsoleted by the \fBsee\fR widget
command (\fBsee\fR handles both x- and y-motion to make a location
visible, whereas \fB\-pickplace\fR only handles motion in y).
d2072 1
a2072 1
Shift-End moves the cursor to the end of the display line and extends 
d2137 1
a2137 1
the insertion cursor. 
d2153 2
a2154 1
.SH "ISSUES CONCERNING CHARS AND INDICES"
d2165 1
a2165 1
synonym for "+N any chars".  
d2167 1
a2167 1
.SH "PERFORMANCE ISSUES"
d2200 1
a2200 1
.SH "KNOWN BUGS"
d2203 1
a2203 1
The \fBsearch \-regexp\fR sub-command attempts to perform sophisticated
d2220 3
a2222 3
 pack [text .t]
 .t insert 1.0 "aaaa\\nbbbb\\ncccc\\nbbbb\\naaaa\\n" 
 .t search \-regexp \-\- {(a+|b+\\nc+\\nb+)+\\na+} 1.0
d2230 1
a2230 1
will not always achieve this, in the case where a match is preceded by 
d2237 3
a2239 3
 pack [text .t] 
 .t insert 1.0 "aaaa\\nbbbb\\nbbbb\\nbbbb\\nbbbb\\n"
 .t search \-regexp \-backward \-\- {b+\\n|a+\\n(b+\\n)+} end 
d2241 3
a2243 3
matches at '5.0' when a true greedy match would match at '1.0'.  
Similarly if we add \fB\-all\fR to this case, it matches at 
all of '5.0', '4.0', '3.0' and '1.0', 
@


1.43.2.1
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.43 2006/11/15 13:29:17 dkf Exp $
d39 2
a40 2
Specifies a boolean that says whether the blinking insertion cursor
should be drawn as a character-sized rectangular block.  If false
d117 1
a117 1
right-justified at the tab position.
d120 1
a120 1
justification and the third uses center justification.
d124 1
a124 1
distances must be strictly positive, and must always increase from one
d131 1
a131 1
for example every 4 characters, simply configure the widget with
d382 2
a383 2
Adjust the index to refer to the first index on the line.  If the
\fBdisplay\fR submodifier is given, this is the first index on the
d418 2
a419 2
the resulting index is constrained to be a valid index in the text
widget.  So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the
d455 1
a455 1
\fB\-background\fR, \fB\-font\fR, and \fB\-foreground\fR options for the
d485 1
a485 1
\fB\-elide \fIboolean\fR
d601 1
a601 1
default 8-character tabs as described for the \fB\-tags\fR
d605 1
a605 1
\fIStyle\fR specifies either the \fItabular\fR or
d643 1
a643 1
For details, see the description of the ``\fIpathName \fBtag bind\fR'' widget
d705 1
a705 1
these two special marks, all marks are shared between peer text
d737 1
a737 1
\fIpathName \fBwindow create\fR widget command, several configuration
d739 1
a739 1
These options may be  modified later with the \fIpathName \fBwindow configure\fR
d815 1
a815 1
when the image is inserted into the text widget with \fIpathName \fBimage create\fR.
d819 1
a819 1
When an embedded image is added to a text widget with the \fIpathName \fBimage
d828 1
a828 1
Once this name is assigned to this instance of the image, it does not
d830 1
a830 1
with \fIpathName \fBimage configure\fR.
d833 1
a833 1
\fIpathName \fBimage create\fR widget command, several configuration
d835 1
a835 1
These options may be modified later with the \fIpathName \fBimage configure\fR
d886 1
a886 1
Whenever the \fBsel\fR tag range changes a virtual event
d900 1
a900 1
instead of \fB\-selectbackground\fR when the text widget does not have
d920 2
a921 2
as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual
event is generated. See the \fIpathName \fBedit modified\fR widget command for
d950 1
a950 1
See below for the \fIpathName \fBedit\fR widget command that controls the undo
d973 1
a973 1
shared between peers.  This means the \fB\-window\fR option of embedded
d975 1
a975 1
the \fB\-create\fR script capabilities to allow each peer to create its
d977 2
a978 2
options of each peer (e.g. \fB\-font\fR, etc) can be set independently,
with the exception of \fB\-undo\fR, \fB\-maxUndo\fR, \fB\-autoSeparators\fR
d996 2
a997 2
means that the command \fIpeerName \fBindex end\fR may return quite different
values in different peers.  Similarly, commands like \fIpeerName \fBtag
d999 2
a1000 2
to the peer.  The configuration options \fB\-startline\fR and
\fB\-endline\fR may be used to control how much of the underlying data is
d1006 2
a1007 2
See below for the \fIpathName \fBpeer\fR widget command that controls the
creation of peer widgets.
d1068 1
a1068 1
If \fIindex1\fR is after \fIindex2\fR, the result will be a negative number
d1083 1
a1083 1
.IP \fB\-chars\fR
d1086 1
a1086 1
.IP \fB\-displaychars\fR
d1088 1
a1088 1
.IP \fB\-displayindices\fR
d1090 1
a1090 1
.IP \fB\-displaylines\fR
d1097 1
a1097 1
.IP \fB\-indices\fR
d1101 1
a1101 1
.IP \fB\-lines\fR
d1107 1
a1107 1
.IP \fB\-xpixels\fR
d1113 1
a1113 1
.IP \fB\-ypixels\fR
d1121 1
a1121 1
The command returns a positive or negative integer corresponding to the
d1123 1
a1123 1
returned for each counting option given, so a list is returned if more
a1143 1
.RS
a1148 1
.RE
d1297 1
a1297 1
the list.  The ranges are returned in the order passed to \fIpathName \fBget\fR.
d1300 1
a1300 1
only those characters which are not elided will be returned.  This may
d1369 1
a1369 1
they produce the same effect as if a separate \fIpathName \fBinsert\fR widget
d1401 1
a1401 1
as the mark information returned by the \fIpathName \fBdump\fR operation.
d1403 1
a1403 1
then it appears to be \fIafter\fR \fBend\fR with respect to the \fIpathName \fBmark next\fR operation.
d1414 1
a1414 1
These semantics mean that the \fIpathName \fBmark previous\fR operation can be used to
d1416 1
a1416 1
as the mark information returned by the \fIpathName \fBdump\fR operation.
d1452 1
a1452 1
Replaces the range of characters between \fIindex1\fR and \fIindex2\fR
d1473 1
a1473 1
for use in conjunction with later \fIpathName \fBscan dragto\fR commands.
d1480 1
a1480 1
\fIpathName \fBscan mark\fR command for the widget.
d1524 1
a1524 1
both the \fB\-lineanchor\fR and \fB\-linestop\fR options
d1526 1
a1526 1
\fI^$\fR match beginning and end of line, and \fI.\fR, \fI[^\fR
d1532 1
a1532 1
This allows \fI.\fR and \fI[^\fR sequences to match the newline
d1534 1
a1534 1
command for details). This option is only meaningful if \fB\-regexp\fR
d1554 2
a1555 2
the first character of each match.  If a \fB\-count\fI varName\fR switch is
given, then \fIvarName\fR is also set to a list containing one element
d1561 1
a1561 1
\fB\-all\fR search
d1567 1
a1567 1
\fB\-overlap\fR
d1575 1
a1575 1
but matching 'Z[a\-z]+Z' against 'ZooZooZoo' will now match twice.
d1579 1
a1579 1
\fB\-strictlimits\fR
d1596 1
a1596 1
.PP
d1612 2
a1613 2
This means that, for example, if the search is \fB\-forwards\fR
but \fIstopIndex\fR is earlier in the text than \fIstartIndex\fR,
d1615 1
a1615 1
minor limitations of the \fIpathName \fBsearch\fR command.
d1672 1
a1672 1
to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
d1708 2
a1709 2
\fIOption\fR may have any of the values accepted by the \fIpathName \fBtag
configure\fR widget command.
d1712 1
a1712 1
This command is similar to the \fIpathName \fBconfigure\fR widget command except
d1930 1
a1930 1
Values close to 1 will
d1975 3
a1977 3
The \fB\-pickplace\fR option has been obsoleted by the \fIpathName \fBsee\fR widget
command (\fIpathName \fBsee\fR handles both x- and y-motion to make a location
visible, whereas the \fB\-pickplace\fR mode only handles motion in y).
d2070 1
a2070 1
Shift-End moves the cursor to the end of the display line and extends
d2135 1
a2135 1
the insertion cursor.
d2151 1
a2151 2
.SH "KNOWN ISSUES"
.SS "ISSUES CONCERNING CHARS AND INDICES"
d2162 1
a2162 1
synonym for "+N any chars".
d2164 1
a2164 1
.SS "PERFORMANCE ISSUES"
d2197 1
a2197 1
.SS "KNOWN BUGS"
d2200 1
a2200 1
The \fIpathName \fBsearch \-regexp\fR sub-command attempts to perform sophisticated
d2217 3
a2219 3
pack [text .t]
\.t insert 1.0 "aaaa\\nbbbb\\ncccc\\nbbbb\\naaaa\\n"
\.t search \-regexp \-\- {(a+|b+\\nc+\\nb+)+\\na+} 1.0
d2227 1
a2227 1
will not always achieve this, in the case where a match is preceded by
d2234 3
a2236 3
pack [text .t]
\.t insert 1.0 "aaaa\\nbbbb\\nbbbb\\nbbbb\\nbbbb\\n"
\.t search \-regexp \-backward \-\- {b+\\n|a+\\n(b+\\n)+} end
d2238 3
a2240 3
matches at '5.0' when a true greedy match would match at '1.0'.
Similarly if we add \fB\-all\fR to this case, it matches at
all of '5.0', '4.0', '3.0' and '1.0',
@


1.43.2.2
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.43.2.1 2007/10/17 14:37:05 dgp Exp $
d1461 1
a1461 2
.RS
.PP
a1465 1
.RE
@


1.43.2.3
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.43.2.2 2007/10/24 12:59:31 dgp Exp $
d1461 2
a1462 1
.br
d1467 1
@


1.43.2.4
log
@merge updates from HEAD
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id$
d56 1
a56 1
.OP \-inactiveselectbackground inactiveSelectBackground Foreground
d118 2
a119 3
For example,
.QW "\fB\-tabs {2c left 4c 6c center}\fR"
creates three tab stops at two-centimeter intervals;  the first two use left
a120 2
.RS
.PP
a127 1
.PP
d132 1
a132 2
.QW "\fB\-tabs \N'34'[expr {4 * [font measure $font 0]}] left\N'34' \-tabstyle wordprocessor\fR" .
.RE
d138 1
a138 2
\fIn\fR'th tab character in the line's text will be associated with
the \fIn\fR'th
d140 1
a140 1
falls to the right of the \fIn\fR'th tab stop, then a gap of a single space
d152 3
a154 3
If the font does not have a uniform width then the width of the character
.QW 0
is used in translating from character units to screen units.
d160 1
a160 1
exactly one line on the screen;  extra characters that do not fit
d191 1
a191 2
called
.QW marks .
d236 3
a238 4
is used as part of a modifier, it can be positive or negative, so
.QW "\fIbase\fR \- \-3 lines"
is perfectly valid (and equivalent to
.QW "\fIbase\fR +3lines" ).
d413 1
a413 2
left-to-right order.  For example, the index
.QW "\fBend \- 1 chars\fR"
d415 1
a415 2
.QW "\fBinsert wordstart \- 1 c\fR"
refers to the character just before
d419 2
a420 4
widget.  So, for example, the index
.QW "\fB1.0 \-1c +1c\fR"
refers to the index
.QW \fB2.0\fR .
d434 1
a434 3
avoid using the characters
.QW " "
(space), \fB+\fR, or \fB\-\fR:
d436 1
a436 1
them cannot be used as indices.
d449 1
a449 3
.QW "\fIpathName \fBtag raise\fR"
and
.QW "\fIpathName \fBtag lower\fR"
d458 1
a458 3
using the
.QW "\fIpathName \fBtag configure\fR"
widget command.
d472 1
a472 1
If \fIbitmap\fR has not been specified, or if it is specified
d496 1
a496 1
If \fIbitmap\fR has not been specified, or if it is specified
d628 1
a628 1
If a particular display option has not been specified for a
d643 2
a644 3
For details, see the description of the
.QW "\fIpathName \fBtag bind\fR"
widget command below.
d664 1
a664 1
they refer to places in the file, but a mark is not associated
d674 1
a674 3
Marks may be manipulated with the
.QW "\fIpathName \fBmark\fR"
widget
d678 2
a679 3
Each mark also has a
.QW gravity ,
which is either \fBleft\fR or \fBright\fR.
d890 1
a890 2
created, and it may not be deleted with the
.QW "\fIpathName \fBtag delete\fR"
d899 1
a899 1
\fB\-inactiveselectbackground\fR option for the text widget is used
d903 1
a903 1
\fBsel\fR not shown at all (when \fB\-inactiveselectbackground\fR is
d911 2
a912 3
may not be unset with the
.QW "\fIpathName \fBmark unset\fR"
widget command.
d929 1
a929 3
Boundaries (called
.QW separators )
are inserted between edit actions.  The
d993 1
a993 4
underlying data store still has indices numbered from
.QW 1.0
to
.QW end .
d1003 2
a1004 4
Note that peers are really peers.  Deleting the
.QW original
text widget will not cause any other peers to be deleted, or otherwise
affected.
d1044 1
a1044 1
the relationship is satisfied and 0 if it is not.
d1112 1
a1112 2
use
.QW ".text count \-xpixels \N'34'${line}.0\N'34' \N'34'${line}.0 lineend\N'34'" .
d1118 2
a1119 4
widget, use
.QW ".text count \-ypixels 1.0 end" ,
and to ensure this is up to date, use
.QW ".text count \-update \-ypixels 1.0 end" .
d1124 3
a1126 3
than one option was supplied.  For example
.QW ".text count \-xpixels \-ypixels 1.3 4.5"
is perfectly valid and will return a list of two elements.
d1158 1
a1158 1
If \fIindex2\fR does not specify a position later in the text
d1160 1
a1160 1
If \fIindex2\fR is not specified then the single character at
d1425 1
a1425 1
if it does not exist, a new mark is created.
d1431 1
a1431 2
returned by future calls to
.QW "\fIpathName \fBmark names\fR" .
d1461 1
a1461 2
.RS
.PP
a1465 1
.RE
d1538 1
a1538 2
to match the entire text, use
.QW "\fIpathName \fBsearch \-nolinestop \-regexp\fR \N'34'.*\N'34' 1.0" .
d1563 4
a1566 9
\fB\-all\fR search of the pattern
.QW \ew+
against
.QW "hello there"
will just match twice, once for each word, and matching
.QW "Z[a\-z]+Z"
against
.QW ZooZooZoo
will just match once.
d1575 3
a1577 10
\fB\-overlap\fR search of the pattern
.QW \ew+
against
.QW "hello there"
will just match twice (i.e. no different to just \fB\-all\fR),
but matching
.QW Z[a\-z]+Z
against
.QW ZooZooZoo
will now match twice.
d1603 1
a1603 2
features such as \fB$\fR to match the end of a line, \fB^\fR to match
the beginning of a line, and to control
d1640 1
a1640 1
\fIindex2\fR (the character at \fIindex2\fR is not tagged).
d1662 2
a1663 3
(if the first character of \fIscript\fR is
.QW +
then \fIscript\fR augments an existing binding rather than replacing it).
d1748 4
a1751 5
that have been named in a
.QW "\fIpathName \fBtag\fR"
widget command but have not been deleted by a
.QW "\fIpathName \fBtag delete\fR"
widget command, even if no characters are currently marked with the tag).
d1807 1
a1807 1
\fIindex2\fR (the character at \fIindex2\fR is not affected).
d1810 2
a1811 2
If the last \fIindex2\fR is omitted then the tag is removed from the
single character at \fIindex1\fR.
d1894 1
a1894 5
to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded
d1947 1
a1947 5
to \fBTk_GetPixels\fR, such as
.QW 2.0c
or
.QW 1i
(the result is rounded
d1960 1
a1960 1
If the \fB\-pickplace\fR option is not specified then \fIindex\fR will
d1992 2
a1993 4
In the descriptions below,
.QW word
is dependent on the value of
the \fBtcl_wordchars\fR variable.  See \fBtclvars\fR(n).
d2086 1
a2086 1
of the insertion cursor.  They do not affect the current selection.
d2157 9
a2165 22
Before Tk 8.5, the widget used the string
.QW chars
to refer to index positions (which included characters, embedded
windows and embedded images).  As of Tk 8.5 the text widget deals
separately and correctly with
.QW chars
and
.QW indices .
For backwards compatibility, however, the index modifiers
.QW "+N chars"
and
.QW "\-N chars"
continue to refer to indices.
One must use any of the full forms
.QW "+N any chars"
or
.QW "\-N any chars"
etc. to refer to actual character indices.  This confusion may be fixed in a
future release by making the widget correctly interpret
.QW "+N chars"
as a synonym for
.QW "+N any chars" .
d2221 2
a2222 2
\.t insert 1.0 "aaaa\enbbbb\encccc\enbbbb\enaaaa\en"
\.t search \-regexp \-\- {(a+|b+\enc+\enb+)+\ena+} 1.0
d2225 1
a2225 2
characters starting from the first
.QW b .
d2238 2
a2239 2
\.t insert 1.0 "aaaa\enbbbb\enbbbb\enbbbb\enbbbb\\n"
\.t search \-regexp \-backward \-\- {b+\en|a+\en(b+\en)+} end
d2241 5
a2245 13
matches at
.QW 5.0
when a true greedy match would match at
.QW 1.0 .
Similarly if we add \fB\-all\fR to this case, it matches at all of
.QW 5.0 ,
.QW 4.0 ,
.QW 3.0
and
.QW 1.0 ,
when really it should only match at
.QW 1.0
since that match encloses all the others.
d2247 1
d2250 1
@


1.42
log
@	* doc/text.n: fix docs to not correct -tabs usage case.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.41 2006/04/12 02:35:24 das Exp $
d286 2
a287 2
If the \fIbase\fP could match more than one of the above forms, such
as a \fImark\fP and \fIimageName\fP both having the same value, then
d423 1
a423 1
or display indices, and the \fIbase\fP refers to an index inside an
d815 1
a815 1
when the image is inserted into the text widget with \fBimage create\fP.
d822 3
a824 3
instance.  The name is taken to be the value of the \fB\-name\fP option
(described below).  If the \fB\-name\fP option is not provided, the
\fB\-image\fP name is used instead.  If the \fIimageName\fP is already
d826 2
a827 2
\fIimageName\fP, where \fInn\fP is an arbitrary integer.  This insures
the \fIimageName\fP is unique.
d829 2
a830 2
change, even though the \fB\-image\fP or \fB\-name\fP values can be changed
with \fBimage configure\fP.
d851 1
a851 1
If \fIimage\fP is not a valid Tk image, then an error is returned.
d855 1
a855 1
the text widget. If \fIImageName\fP is not supplied, then the
d857 1
a857 1
If the \fIimageName\fP is already in use, \fI#nn\fP is appended to
d1203 4
a1206 4
The possible \fIkey\fP values are \fBtext\fP, \fBmark\fP,
\fBtagon\fP, \fBtagoff\fP, \fBimage\fP, and \fBwindow\fP.  The corresponding
\fIvalue\fP is the text, mark name, tag name, image name, or window name.
The \fIindex\fP information is the index of the
d1219 1
a1219 1
the \fIkey\fP, \fIvalue\fP, and \fIindex\fP.
d1229 1
a1229 1
information is returned as \fBtagon\fP and \fBtagoff\fP elements that
d1399 1
a1399 1
These semantics mean that the \fBmark next\fP operation can be used to
d1401 3
a1403 3
as the mark information returned by the \fBdump\fP operation.
If a mark has been set to the special \fBend\fP index,
then it appears to be \fIafter\fP \fBend\fP with respect to the \fBmark next\fP operation.
d1414 1
a1414 1
These semantics mean that the \fBmark previous\fP operation can be used to
d1416 1
a1416 1
as the mark information returned by the \fBdump\fP operation.
d2196 1
a2196 1
Set the \fBinsertOffTime\fP attribute to 0 avoid this.
@


1.41
log
@fix make html error
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.40 2005/11/16 09:48:44 vincentdarley Exp $
d132 1
a132 1
\fB\-tabs "[expr {4 * [font measure $font 0]}] left"\fR.
@


1.40
log
@clarify text index documentation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.39 2005/10/10 10:36:34 vincentdarley Exp $
d419 2
a420 2
widget.  So, for example, the index ''\fB1.0 -1c +1c\fR'' refers to the 
index ''\fB2.0\fR''.
@


1.39
log
@tip256 implementation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.38 2005/08/09 09:46:02 vincentdarley Exp $
d416 5
a420 1
the first one in the word containing the insertion cursor.
@


1.38
log
@clarify tab stop behaviour
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.37 2005/05/12 22:51:03 dgp Exp $
d117 1
a117 1
right-justified at the tab position.
d120 1
a120 4
justification and the third uses center justification.  Note that
tabs are interpreted as they are encountered in the text.  Any tab
character being laid out will use (and be defined by) the first tab stop 
to the right of the preceding characters already laid out on that line.
d133 13
d382 2
a383 2
Adjust the index to refer to the first character on the line.  If the 
\fBdisplay\fR submodifier is given, this is the first character on the 
d389 1
a389 1
Adjust the index to refer to the last character on the line (the
d391 1
a391 1
character on the display line, otherwise on the logical line.
d481 5
a485 4
\fB\-elide \fIboolean\fR
\fIElide\fR specifies whether the data should be elided.
Elided data is not displayed and takes no space on screen, but further
on behaves just as normal data.
d505 1
a505 1
If the first character of a display line has a tag for which this
d510 1
a510 1
display is determined by the first character of that display line.
d513 1
a513 1
If the first character of a text line has a tag for which this
d524 1
a524 1
If the first character of a display line has a tag for which this
d557 1
a557 1
If the first character of a display line has a tag for which this
d565 1
a565 1
display is determined by the first character of that display
d592 1
a592 1
first character on that display line.
d600 8
d1575 9
@


1.37
log
@Updated out-of-date references to "Tk_GetBoolean"
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.36 2005/04/18 11:34:41 vincentdarley Exp $
d120 4
a123 1
justification and the third uses center justification.
@


1.36
log
@fix to Home/End and display lines
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.35 2005/02/14 23:02:52 vincentdarley Exp $
d532 1
a532 1
\fIBoolean\fR may have any of the forms accepted by \fBTk_GetBoolean\fR.
d589 1
a589 1
It may have any of the forms accepted by \fBTk_GetBoolean\fR.
@


1.35
log
@fix to newline eliding in text widget
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.34 2005/02/11 21:04:37 hobbs Exp $
d2029 2
a2030 2
beginning of its line and clear any selection in the widget.
Shift-Home moves the insertion cursor to the beginning of the line
d2034 3
a2036 3
end of the line and clear any selection in the widget.
Shift-End moves the cursor to the end of the line and extends the selection
to that point.
@


1.34
log
@	* doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.33 2004/11/20 15:55:08 vincentdarley Exp $
a2162 9
The \fB\-elide\fP tag attribute, introduced in Tk 8.3, has one known
limitation.  Newlines which have this attribute are only actually elided
if their entire logical line is also elided.  Where there is a logical
line which begins un-elided but terminates with an elided newline, that
newline will still actually cause a line-break in the display.  The basic
limitation is that while a single logical line can result in multiple
display lines, a single display line cannot be derived from multiple
logical lines.  This does mean, however, that logical lines which are
completely elided have no problems.
@


1.33
log
@removed backslash quote
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.32 2004/11/17 13:47:07 vincentdarley Exp $
d1178 2
a1179 2
\fBtagon\fP, \fBtagoff\fP, and \fBwindow\fP.  The corresponding
\fIvalue\fP is the text, mark name, tag name, or window name.
d1181 1
a1181 1
start of the text, the mark, the tag transition, or the window.
@


1.32
log
@improved documentation of -tabs
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.31 2004/11/12 09:03:19 das Exp $
d132 1
a132 1
\fB\-tabs \"[expr {4 * [font measure $font 0]}] left\"\fR.
@


1.31
log
@	* doc/SetOptions.3:
	* doc/text.n: fixed *roff errors uncovered by running 'make html'.

        * macosx/tkMacOSXFont.c (Tk_MeasureChars,Tk_DrawChars,etc): Make
        sure that the lastSubFontPtr remains valid even when the subfont
        array is reallocated. [Bug 618872]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.30 2004/10/28 12:25:53 dkf Exp $
d130 3
a132 1
(average size) characters.
@


1.30
log
@More minor doc fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.29 2004/09/19 16:05:37 dkf Exp $
d58 2
a59 2
Specifies the colour to use for the selection (the \fB\sel\fR tag) when
the window does not have the input focus.  If empty, \fB\{}\fR, then no
d706 1
a706 1
.vE 8.5
d1411 1
a1411 1
\fIpathName \fBpeer create \fInewPathName\fR ?fIoptions\fR?
d1421 1
@


1.29
log
@Standardize style of section refs & public symbols. Remove displayed tabs
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.28 2004/09/10 12:13:40 vincentdarley Exp $
a18 1
.VS 8.4
a21 1
.VE 8.4
a33 1
.VS 8.4
a36 1
.VE 8.4
a62 1
.VS 8.4
a64 1
.VE 8.4
a131 1
.VS 8.4
a133 1
.VE 8.4
d173 1
a173 1
See TAGS below for more details.
d179 1
a179 1
See MARKS below for more details.
d183 1
a183 1
See EMBEDDED WINDOWS below for more details.
d187 1
a187 1
See EMBEDDED IMAGES below for more details.
a188 1
.VS 8.4
d190 1
a190 2
See THE UNDO MECHANISM below for more details.
.VE 8.4
d195 1
a195 1
tags, images, etc).  See PEER WIDGETS below for more details.
a196 1

d208 6
a213 4
Where \fIbase\fR gives a starting point and the \fImodifier\fRs adjust
the index from the starting point (e.g. move forward or backward one
character).  Every index must contain a \fIbase\fR, but the
\fImodifier\fRs are optional.  Most modifiers (as documented below) allow
d224 1
d279 1
d291 1
d297 1
d306 1
d309 1
d319 1
d322 1
d331 1
d334 1
d347 1
d350 1
d363 1
d366 1
d370 1
d373 1
d377 1
d380 1
d387 1
d390 1
d408 1
d616 3
a618 1
command below.  Tag bindings are shared between all peer widgets
d620 1
d623 3
a625 1
See THE SELECTION below.  With the exception of the special \fBsel\fR
d630 1
a630 1

d667 1
a667 1
as described under THE INSERTION CURSOR below.
d674 3
a676 1
Neither of these special marks may be deleted.  With the exception of
d679 1
a679 1

d693 5
a697 1
Each embedded window occupies one unit's worth of index space
d702 5
a706 2
the window is destroyed.  Similarly if the text widget as a whole
is deleted, then the window is destroyed.
d732 6
a737 4
the name of that window as its result.  Two substitutions will be
performed in \fIscript\fR before evaluation.  \fI%W\fR will be
substituted by the name of the parent text widget, and \fI%%\fR
will be substitutde by a single \fI%\fR.
d760 10
a769 9
\fB\-window \fIpathName\fR 
Specifies the name of a window to display in the annotation.  Note that
if a \fIpathName\fR has been set, then later configuring a window to the
empty string will not delete the widget corresponding to the old
\fIpathName\fR. Rather it will remove the association between the old
\fIpathName\fR and the text widget.  If multiple peer widgets are in
use, it is usually simpler to use the \fB\-create\fR option if embedded 
windows are desired in each peer.

d780 5
a784 1
Each embedded image occupies one unit's worth of index space
a840 1

d862 9
a870 6
created, and it may not be deleted with the ``\fIpathName \fBtag
delete\fR'' widget command.  Furthermore, the \fBselectBackground\fR,
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for the text
widget are tied to the \fB\-background\fR, \fB\-borderwidth\fR, and
\fB\-foreground\fR options for the \fBsel\fR tag: changes in either will
automatically be reflected in the other.  Also the
d878 1
a878 1

a887 1

a894 1

a896 1
.VS 8.4
a923 2
.VE 8.4

a980 1

a1116 1
.VS 8.4
a1120 1
.VE 8.4
a1134 1
.VS 8.4
a1142 1
.VE 8.4
a1220 1
.VS 8.4
a1252 1
.VE 8.4
a1266 1
.VS 8.4
a1269 1
.VE 8.4
d1301 1
a1301 1
See EMBEDDED IMAGES for information on the options that
d1311 1
a1311 1
See EMBEDDED IMAGES for information on the options that
d1323 1
a1323 1
\fIIndex\fR may have any of the forms described under INDICES above.
d1406 1
d1435 1
d1474 4
a1477 2
The search will proceed backward through the text, finding the matching
range closest to \fIindex\fR whose first character is before \fIindex\fR
d1482 1
d1492 3
a1494 1
command for details).  The default matching automatically passes
d1499 1
d1502 1
d1508 1
d1523 1
d1531 2
a1532 1
matches are not normally returned.  For example, applying an \fB\-all\fR search 
d1535 2
a1536 1
match once.  
d1539 1
d1548 1
d1559 1
d1565 1
d1573 1
a1573 1
again;  if \fIstopIndex\fR is specified, no wrap-around will occur. 
d1576 2
a1577 2
nothing will ever be found.  See "KNOWN BUGS" below for a number of
minor limitations of the search command.
a1632 1
.VS
d1637 1
a1637 1
under MARKS above.  An \fBEnter\fR event triggers for a tag when the tag
a1646 1
.VE
d1687 1
a1687 1
See TAGS above for details on the options available for tags.
d1803 1
a1803 1
See EMBEDDED WINDOWS for information on the options that
d1811 1
a1811 1
See EMBEDDED WINDOWS for information on the options that
d1851 1
d1860 1
d1890 3
a1892 1
one-third the way through the text; and so on.  Values close to 1 will 
d1898 1
d1904 1
d1912 5
a1916 3
adjusts by \fInumber\fR pixels.  If \fInumber\fR is negative then earlier
positions in the text become visible; if it is positive then later
positions in the text become visible.
a1947 1

a2056 1
.VS 8.4
a2057 1
.VE 8.4
a2061 1
.VS 8.4
a2062 1
.VE 8.4
a2067 1
.VS 8.4
a2068 1
.VE 8.4
a2098 1
.VS 8.4
a2104 1
.VE 8.4
a2112 1

d2114 1
d2125 1
a2125 1

a2158 1

a2159 1
.PP
d2216 3
@


1.28
log
@text widget 'peer' subcommand -- TIP#169 implementation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.27 2004/08/17 22:37:24 dkf Exp $
d1266 1
a1266 1
the ones listed in the section EMBEDDED IMAGES.
d1753 1
a1753 1
the ones listed in the section EMBEDDED WINDOWS.
@


1.27
log
@Doc patches [1010083] and [1010607] from Mikhail Kolesnitschenko.
Also some general fixes to menu.n and text.n
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.26 2004/06/04 10:51:17 vincentdarley Exp $
d47 9
d60 6
d92 9
d201 6
d604 2
a605 1
command below.
d608 5
a612 1
See THE SELECTION below.
d657 3
a659 1
Neither of these special marks may be deleted.
d679 2
a680 1
the window is destroyed.
d706 4
a709 1
the name of that window as its result.
d732 8
a739 2
\fB\-window \fIpathName\fR
Specifies the name of a window to display in the annotation.
d830 13
a842 7
created, and it may not be deleted with the ``\fIpathName \fBtag delete\fR''
widget command.  Furthermore, the \fBselectBackground\fR,
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for
the text widget are tied to the \fB\-background\fR,
\fB\-borderwidth\fR, and \fB\-foreground\fR options for the \fBsel\fR
tag:  changes in either will automatically be reflected in the
other.
d894 58
d1384 16
@


1.26
log
@text widget fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.25 2004/03/04 00:17:07 hobbs Exp $
d61 1
a61 1
This option may be overriden with \fB\-spacing1\fR options in
d68 1
a68 1
This option may be overriden with \fB\-spacing2\fR options in
d75 1
a75 1
This option may be overriden with \fB\-spacing3\fR options in
d159 2
a160 2
The second form of annotation consists of marks, which are floating
markers in the text.
d193 2
a194 2
an optional submodifier.  Valid \fIsubmodifier\fRs are nothing, \fIany\fB
or \fIdisplay\fR. If the submodifier is abbreviated, then it must be
d196 1
a196 1
submodifier and the following \fImodifier\fR.  Typically the \fIdisplay\fR
d201 1
a201 1
- -3 lines' is perfectly valid (and equivalent to '\fIbase\fR
d256 1
a256 1
\fB+ \fIcount\fB \fI?submodifier?\fB chars\fR
d261 2
a262 2
\fIdisplay\fR submodifier is given, elided characters are skipped over
without being counted.  If \fIany\fR is given, then all characters are
d269 1
a269 1
\fB\- \fIcount\fB \fI?submodifier?\fB chars\fR
d274 2
a275 2
are optional.  If the \fIdisplay\fR submodifier is given, elided
characters are skipped over without being counted.  If \fIany\fR is
d282 1
a282 1
\fB+ \fIcount\fB \fI?submodifier?\fB indices\fR
d289 3
a291 3
\fIdisplay\fR submodifier is given, elided indices are skipped over
without being counted.  If \fIany\fR is given, then all indices are
counted, which is also the default behaviour if no modifier is given.
d293 1
a293 1
\fB\- \fIcount\fB \fI?submodifier?\fB indices\fR
d298 1
a298 1
either side of \fIcount\fR are optional.  If the \fIdisplay\fR
d300 1
a300 1
counted.  If \fIany\fR is given, then all indices are counted, which is
d303 1
a303 1
\fB+ \fIcount\fB \fI?submodifier?\fB lines\fR
d311 1
a311 1
\fIcount\fR are optional.  If the \fIdisplay\fR submodifier is given,
d313 1
a313 1
\fIany\fR (or no modifier) is given, then each logical line (no matter
d317 1
a317 1
\fB\- \fIcount\fB \fI?submodifier?\fB lines\fR
d325 1
a325 1
of \fIcount\fR are optional.  If the \fIdisplay\fR submodifier is given,
d327 1
a327 1
\fIany\fR (or no modifier) is given, then each logical line (no matter
d331 1
a331 1
\fB\fI?submodifier?\fB linestart\fR
d333 1
a333 1
\fIdisplay\fR submodifier is given, this is the first character on the 
d336 1
a336 1
\fB\fI?submodifier?\fB lineend\fR
d338 1
a338 1
newline).  If the \fIdisplay\fR submodifier is given, this is the last
d341 1
a341 1
\fB\fI?submodifier?\fB wordstart\fR
d345 1
a345 1
not one of these.  If the \fIdisplay\fR submodifier is given, this only
d349 1
a349 1
\fB\fI?submodifier?\fB wordend\fR
d352 1
a352 1
last character of the text then it is not modified.  If the \fIdisplay\fR
d363 2
a364 1
or display indices and the \fIbase\fP refers to an index which is elided,
d373 1
a373 1
avoid using the the characters `` '' (space), \fB+\fR, or \fB\-\fR:
d598 1
a598 1
Each mark also has a \fIgravity\fR, which is either \fBleft\fR or
d707 1
a707 1
when the image is inserted into the text widget widh \fBimage create\fP.
d714 3
a716 3
instance.  The name is taken to be the value of the \fB-name\fP option
(described below).  If the \fB-name\fP option is not provided, the
\fB-image\fP name is used instead.  If the \fIimageName\fP is already
d721 1
a721 1
change, even though the \fB-image\fP or \fB-name\fP values can be changed
d804 1
a804 1
this flag. The flag can be queried, set and cleared programatically
d813 1
a813 1
\fB-undo\fR widget option is true) which records every insert and
d824 2
a825 2
Separators are inserted automatically when the \fB-autoseparators\fR
widget option is true.  You can insert separators programatically as
d904 5
a908 5
each counting option given.  Valid counting options are \fI-chars\fR,
\fI-displaychars\fR, \fI-displayindices\fR, \fI-displaylines\fR,
\fI-indices\fR, \fI-lines\fR, \fI-xpixels\fR and \fI-ypixels\fR. The
default value, if no option is specified, is \fI-indices\fR. There is an
additional possible option \fI-update\fR which is a modifier.  If given,
d911 1
a911 1
\fI-ypixels\fR count (which, if 'update' is not given, will use the text
d915 1
a915 1
.IP \fI-chars\fR 
d918 1
a918 1
.IP \fI-displaychars\fR 
d920 1
a920 1
.IP \fI-displayindices\fR 
d922 1
a922 1
.IP \fI-displaylines\fR 
d929 1
a929 1
.IP \fI-indices\fR 
d933 1
a933 1
.IP \fI-lines\fR 
d939 1
a939 1
.IP \fI-xpixels\fR 
d944 2
a945 2
use '.text count -xpixels "${line}.0" "${line}.0 lineend"'.
.IP \fI-ypixels\fR 
d950 2
a951 2
widget, use '.text count -ypixels 1.0 end', and to ensure this is up to
date, use '.text count -update -ypixels 1.0 end'.
d956 2
a957 2
than one option was supplied.  For example '.text count -xpixels
-ypixels 1.3 4.5' is perfectly valid and will return a list of two
d1001 1
a1001 1
first range to deleted text does not cause a undesired index shifting
d1073 1
a1073 1
of text seqments that each end with a newline.  The newline is part
d1099 1
a1099 1
When the \fB-undo\fR option is true, reapplies the last undone edits
d1101 1
a1101 1
the redo stack is empty.  Does nothing when the \fB-undo\fR option is
d1109 1
a1109 1
the \fB-undo\fR option is false.
d1112 1
a1112 1
Undoes the last edit action when the \fB-undo\fR option is true.  An
d1115 1
a1115 1
error when the undo stack is empty.  Does nothing when the \fB-undo\fR
d1120 1
a1120 1
\fIpathName \fBget\fR \fI?-displaychars?\fR \fI-- index1\fR ?\fIindex2 ...\fR?
d1139 1
a1139 1
If the \fI-displaychars\fR option is given, then, within each range,
d1350 1
a1350 1
to match the entire text, use 'search -nolinestop -regexp ".*" 1.0'.
d1371 1
a1371 1
similarly to the Tcl command \fBregexp -all\fR, in that overlapping
d1374 1
a1374 1
for each word, and matching 'Z[a-z]+Z' against 'ZooZooZoo' will just
d1384 1
a1384 1
but matching 'Z[a-z]+Z' against 'ZooZooZoo' will now match twice.  
d1388 1
a1388 1
Find elidden (hidden) text as well. By default only displayed text is
d1937 1
a1937 1
true) undoes the last edit action if the \fB-undo\fR option is true.
d1941 1
a1941 1
action if the \fB-undo\fR option is true. Does nothing otherwise.
d1958 2
a1959 2
index modifiers "+N chars" and "-N chars" continue to refer to indices.
One must use any of the full forms "+N any chars" or "-N any chars" etc
d2000 1
a2000 1
The \fB-elide\fP tag attribute, introduced in Tk 8.3, has one known
d2011 1
a2011 1
The \fBsearch -regexp\fR sub-command attempts to perform sophisticated
d2013 1
a2013 1
8.5), examing each line individually, and then in small groups of lines,
d2030 1
a2030 1
 .t search -regexp -- {(a+|b+\\nc+\\nb+)+\\na+} 1.0
d2047 1
a2047 1
 .t search -regexp -backward -- {b+\\n|a+\\n(b+\\n)+} end 
d2050 1
a2050 1
Similarly if we add \fB-all\fR to this case, it matches at 
@


1.25
log
@minor doc fixes for html conversion
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.24 2003/12/22 22:16:48 jenglish Exp $
d1709 2
a1710 1
The first element gives the position of the first character in the
d1713 2
a1714 2
The second element gives the position of the character just after
the last one in the bottom line of the window,
d1720 2
a1721 2
Adjusts the view in the window so that the character given by \fIfraction\fR
appears on the top line of the window.
d1723 7
a1729 2
character in the text, 0.33 indicates the character one-third the
way through the text, and so on.
@


1.24
log
@doc/text.n: Fix markup errors (".t" at beginning of line).
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.23 2003/12/04 12:28:37 vincentdarley Exp $
d897 1
a897 1
\fIpathName \fBcount \fI?options\fI? \fIindex1 \fIindex2\fR
d899 1
a899 1
If \fIindex1\fP is after \fIindex2\fP, the result will be a negative number 
d1119 1
a1119 1
\fIpathName \fBget \fI?-displaychars?\fR \fI--fR \fIindex1 \fR?\fIindex2 ...\fR?
d1272 1
a1272 1
\fIpathName \fBreplace \fIindex1 \fIindex2 chars \fR?\fItagList chars tagList ...\fR?
@


1.23
log
@fix to text widget tabs and xy-scroll-command
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.22 2003/11/16 14:13:09 vincentdarley Exp $
d2019 7
a2025 3
a rare problem, but it can occur, for example: \fBpack [text .t] ; 
.t insert 1.0 "aaaa\\nbbbb\\ncccc\\nbbbb\\naaaa\\n" ; .t search -regexp --
{(a+|b+\\nc+\\nb+)+\\na+} 1.0\fR will not find a match when one exists of 19
d2035 7
a2041 3
possible match which might cover large portions of the widget.  For
example: \fBpack [text .t] ; .t insert 1.0 "aaaa\\nbbbb\\nbbbb\\nbbbb\\nbbbb\\n"
; .t search -regexp -backward -- {b+\\n|a+\\n(b+\\n)+} end\fR 
@


1.22
log
@documentation and cleanup
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.21 2003/11/15 02:41:41 jenglish Exp $
d84 3
a86 1
of a list of screen distances giving the positions of the tab stops.  Each
d105 3
a107 1
the spacing and alignment from the last tab stop in the list.
@


1.21
log
@doc/text.n: Fix markup errors.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.20 2003/11/07 15:36:26 vincentdarley Exp $
d11 1
a11 1
.TH text n 8.4 Tk "Tk Built-In Commands"
d190 1
a190 1
or \fIdisplay\fB. If the submodifier is abbreviated, then it must be
d192 1
a192 1
submodifier and the following \fImodifier\fR.  Typically the \fIdisplay\fB
d195 1
a195 1
this is explained for each relevant case below.  Lastly, where \fIcount\fB
d257 2
a258 2
\fIdisplay\fB submodifier is given, elided characters are skipped over
without being counted.  If \fIany\fB is given, then all characters are
d270 2
a271 2
are optional.  If the \fIdisplay\fB submodifier is given, elided
characters are skipped over without being counted.  If \fIany\fB is
d285 1
a285 1
\fIdisplay\fB submodifier is given, elided indices are skipped over
d294 1
a294 1
either side of \fIcount\fR are optional.  If the \fIdisplay\fB
d299 1
a299 1
\fB+ \fIcount\fB \fI?modifier?\fB lines\fR
d307 1
a307 1
\fIcount\fR are optional.  If the \fIdisplay\fB submodifier is given,
d321 1
a321 1
of \fIcount\fR are optional.  If the \fIdisplay\fB submodifier is given,
d327 1
a327 1
\fB?submodifier? linestart\fR
d332 1
a332 1
\fB?submodifier? lineend\fR
d337 1
a337 1
\fB?submodifier? wordstart\fR
d345 1
a345 1
\fB?submodifier? wordend\fR
d891 1
d955 1
d1682 12
a1693 9
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
of one of these.
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
\fInumber\fR average-width characters on the display;  if it is
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then characters farther to the left
become visible;  if it is positive then characters farther to the right
become visible.
d1781 1
a1781 1
and positions the insertion cursor at the end of the word.
d1786 1
a1786 1
and positions the insertion cursor at the end of the line.
d1998 1
d2015 2
a2016 2
a rare problem, but it can occur, for example: \fBpack [text .t] ; .t
insert 1.0 "aaaa\\nbbbb\\ncccc\\nbbbb\\naaaa\\n" ; .t search -regexp --
d2035 1
@


1.20
log
@better elide tag handling
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.19 2003/10/31 09:02:07 vincentdarley Exp $
d286 1
a286 1
without being counted.  If \fIany\fB is given, then all indices are
d296 1
a296 1
counted.  If \fIany\fB is given, then all indices are counted, which is
d309 1
a309 1
\fIany\fB (or no modifier) is given, then each logical line (no matter
d323 1
a323 1
\fIany\fB (or no modifier) is given, then each logical line (no matter
d329 1
a329 1
\fIdisplay\fB submodifier is given, this is the first character on the 
d334 1
a334 1
newline).  If the \fIdisplay\fB submodifier is given, this is the last
d341 1
a341 1
not one of these.  If the \fIdisplay\fB submodifier is given, this only
d348 1
a348 1
last character of the text then it is not modified.  If the \fIdisplay\fB
d892 5
a896 4
\fIpathName \fBcount \fI?options\fI? \fIindex1 \fIindex2\fR Counts the
number of relevant things between the two indices.  If index1 is after
index2, the result will be a negative number (and this holds for each of
the possible options).  The actual items which are counted depend on the
d908 3
a910 2
.TP
\fI-chars\fR - count all characters, whether elided or not.  Do not count
d912 6
a917 7
.TP
\fI-displaychars\fR - count all non-elided characters.
.TP
\fI-displayindices\fR - count all non-elided characters, windows and
images.
.TP
\fI-displaylines\fR - count all display lines (i.e. counting one for each
d923 2
a924 2
.TP
\fI-indices\fR - count all characters and embedded windows or images (i.e.
d927 2
a928 2
.TP
\fI-lines\fR - count all logical lines (irrespective of wrapping) from
d933 2
a934 2
.TP
\fI-xpixels\fR - count the number of horizontal pixels from the first
d939 2
a940 2
.TP
\fI-ypixels\fR - count the number of vertical pixels from the first pixel
d946 1
a946 1
.TP
d953 1
d1274 1
a1274 1
.TP
d1364 1
a1364 1
similarly to the Tcl command \fB\regexp -all\fR, in that overlapping
d1376 2
a1377 2
just match twice (i.e. no different to just \fB\-all\fR), but matching
'Z[a-z]+Z' against 'ZooZooZoo' will now match twice.  
d1993 1
a1993 1

d2010 2
a2011 2
insert 1.0 "aaaa\nbbbb\ncccc\nbbbb\naaaa\n" ; .t search -regexp --
{(a+|b+\nc+\nb+)+\na+} 1.0\fR will not find a match when one exists of 19
d2013 1
a2013 1

d2022 6
a2027 5
example: \fBpack [text .t] ; .t insert 1.0 "aaaa\nbbbb\nbbbb\nbbbb\nbbbb\n"
; .t search -regexp -backward -- {b+\n|a+\n(b+\n)+} end\fR matches at
'5.0' when a true greedy match would match at '1.0'.  Similarly if we
add \fB-all\fR to this case, it matches at all of '5.0', '4.0', '3.0'
and '1.0', when really it should only match at '1.0' since that match
a2028 1

@


1.19
log
@TIP 155 implementation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.18 2003/10/06 22:14:26 jenglish Exp $
d892 15
a906 14
\fIpathName \fBcount \fI?options\fI? \fIindex1 \fIindex2\fR 
Counts the number of relevant things between the two indices.  If index1
is after index2, the result will be a negative number (and this holds for
each of the possible options).  The actual items which are counted depend
on the options given.  The result is a list of integers, one for the
result of each counting option given.  Valid counting options are
'-chars', '-displaychars', '-displayindices', '-displaylines',
'-indices', '-lines', '-xpixels' and '-ypixels'.  The default value, if
no option is specified, is '-indices'.  There is an additional possible
option '-update' which is a modifier.  If given, then all subsequent
options ensure that any possible out of date information is recalculated.
This currently only has any effect for the '-ypixels' count (which, if
'update' is not given, will use the text widget's current cached value
for each line).  The count options are interpreted as follows:
@


1.18
log
@* library/text.tcl, doc/text.n:  Text widget binding for
Control-v is now Mac-only, since it conflicts with standard
<<Paste>> binding on other platforms.  [Bug #605277]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.17 2003/05/29 21:57:56 jenglish Exp $
d41 6
d185 14
a198 4
Where \fIbase\fR gives a starting point and the \fImodifier\fRs
adjust the index from the starting point (e.g. move forward or
backward one character).  Every index must contain a \fIbase\fR,
but the \fImodifier\fRs are optional.
d252 15
a266 2
\fB+ \fIcount\fB chars\fR
Adjust the index forward by \fIcount\fR characters, moving to later
d268 9
a276 3
characters in the text after the current index, then set the index
to the last character in the text.
Spaces on either side of \fIcount\fR are optional.
d278 2
a279 2
\fB\- \fIcount\fB chars\fR
Adjust the index backward by \fIcount\fR characters, moving to earlier
d281 17
a297 3
characters in the text before the current index, then set the index
to the first character in the text.
Spaces on either side of \fIcount\fR are optional.
d299 1
a299 1
\fB+ \fIcount\fB lines\fR
d302 3
a304 13
lines after the line containing the current index, then set the index
to refer to the same character position on the last line of the text.
Then, if the line is not long enough to contain a character at the indicated
character position, adjust the character position to refer to the last
character of the line (the newline).
Spaces on either side of \fIcount\fR are optional.
.TP
\fB\- \fIcount\fB lines\fR
Adjust the index backward by \fIcount\fR lines, retaining the same
character position within the line.  If there are fewer than \fIcount\fR
lines before the line containing the current index, then set the index
to refer to the same character position on the first line of the text.
Then, if the line is not long enough to contain a character at the indicated
d306 30
a335 2
character of the line (the newline).
Spaces on either side of \fIcount\fR are optional.
d337 1
a337 7
\fBlinestart\fR
Adjust the index to refer to the first character on the line.
.TP
\fBlineend\fR
Adjust the index to refer to the last character on the line (the newline).
.TP
\fBwordstart\fR
d340 4
a343 2
that are letters, digits, or underscores, or a single character that
is not one of these.
d345 1
a345 1
\fBwordend\fR
d347 4
a350 2
word containing the current index.  If the current index refers to the last
character of the text then it is not modified.
d357 5
a361 1

d632 1
a632 1
Each embedded window occupies one character's worth of index space
d699 1
a699 1
Each embedded image occupies one character's worth of index space
d811 7
a817 8
Boundaries (called "separators") are inserted between edit actions.
The purpose of these separators is to group inserts and deletes into
one compound edit action.  When undoing a change everything between
two separators will be undone.  The undone changes are then moved to
the redo stack, so that an undone edit can be redone again.  The redo
stack is cleared whenever new edit actions are recorded on the undo
stack.  The undo and redo stacks can be cleared to keep their depth
under control.
d892 60
d1110 1
a1110 1
\fIpathName \fBget \fIindex1 \fR?\fIindex2 ...\fR?
d1128 5
d1263 14
d1314 6
a1319 5
The search will proceed backward through the text, finding the
matching range closest to \fIindex\fR whose first character
is before \fIindex\fR.  Note that, for a variety of reasons, backwards
searches can be substantially slower than forwards searches, so it is
recommended that performance-critical code use forward searches.
d1336 2
a1337 3
This allows 
\fI.\fR and \fI[^\fR sequences to match the newline character \fI\en\fR,
which they will otherwise not do (see the \fBregexp\fR
d1339 2
a1340 1
is also given, and an error will be thrown otherwise.
d1349 2
a1350 1
embedded images or windows in the matching range, this is equivalent to the
d1360 16
a1375 1
windows or hidden text. 
d1386 5
a1390 5
The matching range must be entirely within a single line of text.
For regular expression matching the newlines are removed from the ends
of the lines before matching:  use the \fB$\fR feature in regular
expressions to match the end of a line.
For exact matching the newlines are retained.
d1398 5
a1402 1
again;  if \fIstopIndex\fR is specified, no wrap-around will occur.
d1716 11
a1726 8
\fINumber\fR must be an integer.
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
\fInumber\fR lines on the display;  if it is \fBpages\fR then
the view adjusts by \fInumber\fR screenfuls.
If \fInumber\fR is negative then earlier positions in the text
become visible;  if it is positive then later positions in the text
become visible.
d1933 12
d1978 49
@


1.17
log
@Fixed markup errors.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.16 2003/05/19 13:04:22 vincentdarley Exp $
a1660 2
Control-v moves the view down one screenful without moving the
insertion cursor or adjusting the selection.
d1739 2
a1740 1
Control-x deletes whatever is selected in the text widget.
@


1.16
log
@tip 113 implementation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15 2003/02/19 18:52:14 mdejong Exp $
d165 1
a165 1
See UNDO MECHANISM below for more details.
d1185 1
a1185 1
sequences will never match the newline character \fI\n\fR.
d1189 1
a1189 1
\fI.\fR and \fI[^\fR sequences to match the newline character \fI\n\fR,
@


1.15
log
@	* doc/entry.n:
	* doc/text.n: Update double and triple click
	docs to match implementation changes made on
	2002-02-14.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.14 2002/06/22 08:21:51 hobbs Exp $
d1169 3
a1171 1
is before \fIindex\fR.
d1181 12
a1192 1
command for details).
d1204 8
@


1.15.2.1
log
@More backporting of doc fixes
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15 2003/02/19 18:52:14 mdejong Exp $
d55 1
a55 1
This option may be overridden with \fB\-spacing1\fR options in
d62 1
a62 1
This option may be overridden with \fB\-spacing2\fR options in
d69 1
a69 1
This option may be overridden with \fB\-spacing3\fR options in
d78 1
a78 3
of a list of screen distances giving the positions of the tab stops,
each of which is a distance relative to the left edge of the widget
(excluding borders, padding, etc).  Each
d97 1
a97 3
the spacing and alignment from the last tab stop in the list.  Tab
distances must be strictly positive, and must always increase from one 
tab stop to the next (if not, an error is thrown).
d147 1
a147 1
See \fBTAGS\fR below for more details.
d149 2
a150 2
The second form of annotation consists of floating markers in the text
called "marks".
d153 1
a153 1
See \fBMARKS\fR below for more details.
d157 1
a157 1
See \fBEMBEDDED WINDOWS\fR below for more details.
d161 1
a161 1
See \fBEMBEDDED IMAGES\fR below for more details.
d165 1
a165 1
See \fBTHE UNDO MECHANISM\fR below for more details.
d167 1
d292 1
d299 1
a299 1
avoid using the characters `` '' (space), \fB+\fR, or \fB\-\fR:
d503 2
a504 1
See \fBTHE SELECTION\fR below.
d524 1
a524 1
Each mark also has a "gravity", which is either \fBleft\fR or
d541 1
a541 1
as described under \fBTHE INSERTION CURSOR\fR below.
d549 1
d619 1
d633 1
a633 1
when the image is inserted into the text widget with \fBimage create\fP.
d640 3
a642 3
instance.  The name is taken to be the value of the \fB\-name\fP option
(described below).  If the \fB\-name\fP option is not provided, the
\fB\-image\fP name is used instead.  If the \fIimageName\fP is already
d647 1
a647 1
change, even though the \fB\-image\fP or \fB\-name\fP values can be changed
d687 1
d716 1
d726 1
d730 1
a730 1
this flag. The flag can be queried, set and cleared programmatically
d734 1
d739 1
a739 1
\fB\-undo\fR widget option is true) which records every insert and
d742 8
a749 7
Boundaries (called "separators") are inserted between edit actions.  The
purpose of these separators is to group inserts, deletes and replaces
into one compound edit action.  When undoing a change everything between
two separators will be undone.  The undone changes are then moved to the
redo stack, so that an undone edit can be redone again.  The redo stack
is cleared whenever new edit actions are recorded on the undo stack.  The
undo and redo stacks can be cleared to keep their depth under control.
d751 2
a752 2
Separators are inserted automatically when the \fB\-autoseparators\fR
widget option is true.  You can insert separators programmatically as
d767 1
d863 1
a863 1
first range to deleted text does not cause an undesired index shifting
d935 1
a935 1
of text segments that each end with a newline.  The newline is part
d961 1
a961 1
When the \fB\-undo\fR option is true, reapplies the last undone edits
d963 1
a963 1
the redo stack is empty.  Does nothing when the \fB\-undo\fR option is
d971 1
a971 1
the \fB\-undo\fR option is false.
d974 1
a974 1
Undoes the last edit action when the \fB\-undo\fR option is true.  An
d977 1
a977 1
error when the undo stack is empty.  Does nothing when the \fB\-undo\fR
d1012 1
a1012 1
the ones listed in the section \fBEMBEDDED IMAGES\fR.
d1026 1
a1026 1
See \fBEMBEDDED IMAGES\fR for information on the options that
d1036 1
a1036 1
See \fBEMBEDDED IMAGES\fR for information on the options that
d1048 1
a1048 1
\fIIndex\fR may have any of the forms described under \fBINDICES\fR above.
d1188 1
a1188 2
embedded images or windows in the matching range (and there are no
elided characters if \fB\-elide\fR is not given), this is equivalent to the
d1193 1
a1193 1
Find elided (hidden) text as well. By default only displayed text is
d1274 1
a1274 1
under \fBMARKS\fR above.  An \fBEnter\fR event triggers for a tag when the tag
d1325 1
a1325 1
See \fBTAGS\fR above for details on the options available for tags.
d1427 1
a1427 1
the ones listed in the section \fBEMBEDDED WINDOWS\fR.
d1441 1
a1441 1
See \fBEMBEDDED WINDOWS\fR for information on the options that
d1449 1
a1449 1
See \fBEMBEDDED WINDOWS\fR for information on the options that
d1566 1
d1720 1
a1720 2
Control-x deletes whatever is selected in the text widget
after copying it to the clipboard.
d1727 1
a1727 1
true) undoes the last edit action if the \fB\-undo\fR option is true.
d1731 1
a1731 1
action if the \fB\-undo\fR option is true. Does nothing otherwise.
d1741 1
a1774 4

.SH "SEE ALSO"
entry(n), scrollbar(n)

@


1.15.2.2
log
@	* doc/text.n: note 'image' key in 'dump' command. [Bug 1115907]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15.2.1 2004/10/28 12:25:22 dkf Exp $
d895 2
a896 2
\fBtagon\fP, \fBtagoff\fP, \fBimage\fP, and \fBwindow\fP.  The corresponding
\fIvalue\fP is the text, mark name, tag name, image name, or window name.
d898 1
a898 1
start of the text, mark, tag transition, image or window.
@


1.15.2.3
log
@Updated out-of-date references to "Tk_GetBoolean"
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15.2.2 2005/02/11 21:05:04 hobbs Exp $
d416 1
a416 1
\fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR.
d473 1
a473 1
It may have any of the forms accepted by \fBTcl_GetBoolean\fR.
@


1.15.2.4
log
@clarify text index documentation
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15.2.3 2005/05/12 22:50:59 dgp Exp $
d294 1
a294 5
the first one in the word containing the insertion cursor.  Modifiers
are applied one by one in this left to right order, and after each step
the resulting index is constrained to be a valid index in the text 
widget.  So, for example, the index ''\fB1.0 -1c +1c\fR'' refers to the 
index ''\fB2.0\fR''.
@


1.15.2.5
log
@fix make-html error
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.15.2.4 2005/11/16 09:51:18 vincentdarley Exp $
d297 2
a298 2
widget.  So, for example, the index ``\fB1.0 -1c +1c\fR'' refers to the 
index ``\fB2.0\fR''.
@


1.14
log
@	* doc/text.n:                             TIP #93 implementation that
	* generic/tkText.c (TextWidgetCmd):       enhances the text get and
	* generic/tkTextIndex.c (TkTextGetIndex): delete methods to accept
	* tests/text.test:                        multiple range pairs.
	This handles the delete case in an atomic, fixed-index fashion.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.13 2002/06/21 23:22:24 hobbs Exp $
d1581 1
a1581 1
and positions the insertion cursor at the beginning of the word.
d1586 1
a1586 1
and positions the insertion cursor at the beginning of the line.
@


1.13
log
@added 8.4 version marker to -maxundo
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.12 2002/06/21 23:09:55 hobbs Exp $
d11 1
a11 1
.TH text n 4.0 Tk "Tk Built-In Commands"
d846 1
a846 1
\fIpathName \fBdelete \fIindex1 \fR?\fIindex2\fR?
d859 10
d982 1
a982 1
\fIpathName \fBget \fIindex1 \fR?\fIindex2\fR?
d995 5
@


1.12
log
@	* doc/text.n:          TIP #104 implementation which generalizes the
	* generic/tkText.c:    undo/redo stack to not be tied solely to the
	* generic/tkText.h:    text widget.  The APIs are still private.
	* generic/tkUndo.c:    This also adds a stack limiting ability and
	* generic/tkUndo.h:    a -maxundo option to the text widget (in
	* library/text.tcl:    addition to the options from TIP #26) should
	* mac/tkMacDefault.h:  users want to limit the undo/redo stack
	* tests/text.test:     (should not be necessary in most cases).
	* unix/Makefile.in:    [Patch #554763] (callewart)
	* unix/tkUnixDefault.h:
	* win/Makefile.in:
	* win/makefile.vc:
	* win/tkWinDefault.h:
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.11 2001/11/15 11:55:26 dkf Exp $
d46 1
d49 1
@


1.11
log
@Minor improvements to undo (demo,docs&bindings)
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.10 2001/11/13 00:19:05 hobbs Exp $
d35 1
a35 1
.OP \-autoseparators autoSseparators AutoSeparators
d45 3
d738 1
a738 1
delete action is recorded on a stack.
d752 1
a752 1
no other will inserted.  That means that two separators on the undo
d758 1
a758 1
to automatically to the appropriate state.  This automatic coupling
@


1.10
log
@added TIP#26 text widget undo/redo functionality
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.9 2001/08/01 16:21:11 dgp Exp $
d23 1
a23 1
.VE
d36 5
a40 2
Specifies whether separators are automatically inserted in the undo
stack. Is only active when the \fB\-undo\fR option is true.
d99 4
a102 2
Specifies whether the undo mechanism is active (value \fB0\fR) or
not (value \fB1\fR).
a134 1
.VS
a136 1
.VE
a153 1
.VS
a156 1
.VE
d158 4
a161 2
The text widget also has a built-in undo/redo mechanism. See 
UNDO MECHANISM below for more details.
a217 1
.VS
a222 1
.VE
a614 1
.VS
a681 1
.VE
d732 30
a761 30
The text widget has an unlimited undo and redo mechanism. This undo 
mechanism is only active when the \fB-undo\fR widget option is true.
Every insert and delete action is recorded on this stack.
.PP
Boundaries are inserted between edit actions: the so-called 
separators. The purpose of these separators is to group inserts and
deletes into one compound edit action. When undoing a change everything
between two separators will be undone. The undone changes are then
moved to the redo stack, so that an undone edit can be redone again.
The redo stack is cleared whenever new edit actions are recorded
on the undo stack. The undo and redo stacks can be cleared to keep 
their depth under control.
.PP
Separators are inserted automatically when the 
\fB-autoseparators\fR widget option is true. You can insert separators
programatically as well. If a separator is already present at the top
of the undo stack no other will inserted. That means that two 
separators on the undo stack are always separated by at least one 
insert or delete action.
.PP
The undo mechanism is also linked to the modified flag. This means
that undoing or redoing changes can take a modified text widget back 
to the unmodified state or vice versa. The modified flag
will be set to automatically to the appropriate state. This 
automatic coupling does not work when the modified flag has been 
set by the user, until the flag has been reset again. 

.PP
See below for the \fBedit\fR widget command that controls the 
undo mechanism.
d839 1
a839 1
.VE
d932 5
a936 4
This command controls the undo mechanism and the modified flag.  
The exact behavior of the command depends on the \fIoption\fR 
argument that follows the \fBedit\fR argument.  The following 
forms of the command are currently supported:
d940 4
a943 5
If \fIboolean\fR is not specified, returns the modified flag of
the widget. The insert, delete, edit undo and edit redo commands
or the user can set or clear the modified flag.
If \fIboolean\fR is specified, sets the modified flag of the widget
to \fIboolean\fR.
d946 4
a949 4
When the \fB-undo\fR option is true, reapplies the last undone 
edits provided no other edits were done since then. Generates an
error when the redo stack is empty.
Does nothing when the \fB-undo\fR option is false.
d955 2
a956 2
Inserts a separator (boundary) on the undo stack. Does nothing
when the \fB-undo\fR option is false.
d959 5
a963 5
Undoes the last edit action when the \fB-undo\fR option is true. 
An edit action is defined as all the insert and delete commands that are 
recorded on the undo stack in between two separators. Generates an error
when the undo stack is empty.
Does nothing when the \fB-undo\fR option is false.
d965 1
d1660 1
a1660 1
.VE
d1667 1
a1667 1
.VE
d1675 1
a1675 1
.VE
d1705 4
a1708 2
Control-z undoes the last edit action if the \fB-undo\fR option is
true. Does nothing otherwise.
d1710 3
a1712 2
Control-Z reapplies the last undone edit action if the \fB-undo\fR 
option is true. Does nothing otherwise.
@


1.9
log
@	Merged changes from feature branch dgp-privates-into-namespace,
	implementing TIP 44.  All Tk commands and variables matching
	tk[A-Z]* are now in the ::tk namespace.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.8 2000/08/25 06:58:33 ericm Exp $
d35 3
d95 3
d156 3
d700 3
d723 41
d932 35
d1704 6
@


1.9.2.1
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.9 2001/08/01 16:21:11 dgp Exp $
d23 1
a23 1
.VE 8.4
a34 6
.OP \-autoseparators autoSseparators AutoSeparators
.VS 8.4
Specifies a boolean that says whether separators are automatically
inserted in the undo stack. Only meaningful when the \fB\-undo\fR
option is true.
.VE 8.4
a91 5
.OP \-undo undo Undo
.VS 8.4
Specifies a boolean that says whether the undo mechanism is active or
not.
.VE 8.4
d124 1
d127 1
d145 1
d149 1
a149 5
.PP
.VS 8.4
The text widget also has a built-in undo/redo mechanism.
See UNDO MECHANISM below for more details.
.VE 8.4
d206 1
d212 1
d605 1
d673 1
a690 3
.IP [4]
Whenever the \fBsel\fR tag range changes a virtual event 
\fB<<Selection>>\fR is generated.
a710 41
.SH "THE MODIFIED FLAG"
The text widget can keep track of changes to the content of the widget
by means of the modified flag. Inserting or deleting text will set
this flag. The flag can be queried, set and cleared programatically
as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual 
event is generated. See the \fBedit modified\fR widget command for 
more details.

.SH "THE UNDO MECHANISM"
.PP
.VS 8.4
The text widget has an unlimited undo and redo mechanism (when the
\fB-undo\fR widget option is true) which records every insert and
delete action is recorded on a stack.
.PP
Boundaries (called "separators") are inserted between edit actions.
The purpose of these separators is to group inserts and deletes into
one compound edit action.  When undoing a change everything between
two separators will be undone.  The undone changes are then moved to
the redo stack, so that an undone edit can be redone again.  The redo
stack is cleared whenever new edit actions are recorded on the undo
stack.  The undo and redo stacks can be cleared to keep their depth
under control.
.PP
Separators are inserted automatically when the \fB-autoseparators\fR
widget option is true.  You can insert separators programatically as
well.  If a separator is already present at the top of the undo stack
no other will inserted.  That means that two separators on the undo
stack are always separated by at least one insert or delete action.
.PP
The undo mechanism is also linked to the modified flag.  This means
that undoing or redoing changes can take a modified text widget back
to the unmodified state or vice versa.  The modified flag will be set
to automatically to the appropriate state.  This automatic coupling
does not work when the modified flag has been set by the user, until
the flag has been reset again.
.PP
See below for the \fBedit\fR widget command that controls the undo
mechanism.
.VE 8.4

d787 1
a787 1
.VE 8.4
a878 36
\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
.VS 8.4
This command controls the undo mechanism and the modified flag.  The
exact behavior of the command depends on the \fIoption\fR argument
that follows the \fBedit\fR argument.  The following forms of the
command are currently supported:
.RS
.TP
\fIpathName \fBedit modified ?\fIboolean\fR?
If \fIboolean\fR is not specified, returns the modified flag of the
widget. The insert, delete, edit undo and edit redo commands or the
user can set or clear the modified flag.  If \fIboolean\fR is
specified, sets the modified flag of the widget to \fIboolean\fR.
.TP
\fIpathName \fBedit redo\fR
When the \fB-undo\fR option is true, reapplies the last undone edits
provided no other edits were done since then. Generates an error when
the redo stack is empty.  Does nothing when the \fB-undo\fR option is
false.
.TP
\fIpathName \fBedit reset\fR
Clears the undo and redo stacks.
.TP
\fIpathName \fBedit separator\fR
Inserts a separator (boundary) on the undo stack. Does nothing when
the \fB-undo\fR option is false.
.TP
\fIpathName \fBedit undo\fR
Undoes the last edit action when the \fB-undo\fR option is true.  An
edit action is defined as all the insert and delete commands that are
recorded on the undo stack in between two separators. Generates an
error when the undo stack is empty.  Does nothing when the \fB-undo\fR
option is false.
.RE
.VE 8.4
.TP
d1572 1
a1572 1
.VE 8.4
d1579 1
a1579 1
.VE 8.4
d1587 1
a1587 1
.VE 8.4
a1615 9
.IP [32]
.VS 8.4
Control-z (and Control-underscore on UNIX when \fBtk_strictMotif\fR is
true) undoes the last edit action if the \fB-undo\fR option is true.
Does nothing otherwise.
.IP [33]
Control-Z (or Control-y on Windows) reapplies the last undone edit
action if the \fB-undo\fR option is true. Does nothing otherwise.
.VE 8.4
@


1.9.2.2
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id$
d11 1
a11 1
.TH text n 8.4 Tk "Tk Built-In Commands"
d35 1
a35 1
.OP \-autoseparators autoSeparators AutoSeparators
a44 5
.OP \-maxundo maxUndo MaxUndo
.VS 8.4
Specifies the maximum number of compound undo actions on the undo
stack. A zero or a negative value imply an unlimited undo stack.
.VE 8.4
d735 1
a735 1
delete action on a stack.
d749 1
a749 1
no other will be inserted.  That means that two separators on the undo
d755 1
a755 1
automatically to the appropriate state.  This automatic coupling
d841 1
a841 1
\fIpathName \fBdelete \fIindex1 \fR?\fIindex2 ...\fR?
a853 10
.VS 8.4
If more indices are given, multiple ranges of text will be deleted.
All indices are first checked for validity before any deletions are made.
They are sorted and the text is removed from the last range to the
first range to deleted text does not cause a undesired index shifting
side-effects.  If multiple ranges with the same start index are given,
then the longest range is used.  If overlapping ranges are given, then
they will be merged into spans that do not cause deletion of text
outside the given ranges due to text shifted during deletion.
.VE 8.4
d967 1
a967 1
\fIpathName \fBget \fIindex1 \fR?\fIindex2 ...\fR?
a979 5
.VS 8.4
If multiple index pairs are given, multiple ranges of text will be returned
in a list.  Invalid ranges will not be represented with empty strings in
the list.  The ranges are returned in the order passed to \fBget\fR.
.VE 8.4
@


1.8
log
@* doc/toplevel.n:
* doc/spinbox.n:
* doc/scrollbar.n:
* doc/scale.n:
* doc/menubutton.n:
* doc/menu.n:
* doc/listbox.n:
* doc/entry.n:
* doc/frame.n:
* doc/message.n:
* doc/checkbutton.n:
* doc/radiobutton.n:
* doc/button.n:
* doc/label.n:
* doc/canvas.n:
* doc/text.n: Fixed Standard Options section to make best use of
new tab settings in man.macros.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.7 2000/07/25 21:14:35 jenglish Exp $
d15 1
a15 1
text \- Create and manipulate text widgets
d17 1
d19 5
d781 7
d1570 3
d1577 3
d1585 3
d1659 1
a1659 1
text, widget
@


1.8.2.1
log
@sync with head
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.11 2001/11/15 11:55:26 dkf Exp $
d15 1
a15 1
text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate text widgets
a16 1
.nf
a17 5
.VS 8.4
\fBtk_textCopy\fR \fIpathName\fR
\fBtk_textCut\fR \fIpathName\fR
\fBtk_textPaste\fR \fIpathName\fR
.VE 8.4
a28 6
.OP \-autoseparators autoSseparators AutoSeparators
.VS 8.4
Specifies a boolean that says whether separators are automatically
inserted in the undo stack. Only meaningful when the \fB\-undo\fR
option is true.
.VE 8.4
a85 5
.OP \-undo undo Undo
.VS 8.4
Specifies a boolean that says whether the undo mechanism is active or
not.
.VE 8.4
d118 1
d121 1
d139 1
d143 1
a143 5
.PP
.VS 8.4
The text widget also has a built-in undo/redo mechanism.
See UNDO MECHANISM below for more details.
.VE 8.4
d200 1
d206 1
d599 1
d667 1
a684 3
.IP [4]
Whenever the \fBsel\fR tag range changes a virtual event 
\fB<<Selection>>\fR is generated.
a704 41
.SH "THE MODIFIED FLAG"
The text widget can keep track of changes to the content of the widget
by means of the modified flag. Inserting or deleting text will set
this flag. The flag can be queried, set and cleared programatically
as well. Whenever the flag changes state a \fB<<Modified>>\fR virtual 
event is generated. See the \fBedit modified\fR widget command for 
more details.

.SH "THE UNDO MECHANISM"
.PP
.VS 8.4
The text widget has an unlimited undo and redo mechanism (when the
\fB-undo\fR widget option is true) which records every insert and
delete action is recorded on a stack.
.PP
Boundaries (called "separators") are inserted between edit actions.
The purpose of these separators is to group inserts and deletes into
one compound edit action.  When undoing a change everything between
two separators will be undone.  The undone changes are then moved to
the redo stack, so that an undone edit can be redone again.  The redo
stack is cleared whenever new edit actions are recorded on the undo
stack.  The undo and redo stacks can be cleared to keep their depth
under control.
.PP
Separators are inserted automatically when the \fB-autoseparators\fR
widget option is true.  You can insert separators programatically as
well.  If a separator is already present at the top of the undo stack
no other will inserted.  That means that two separators on the undo
stack are always separated by at least one insert or delete action.
.PP
The undo mechanism is also linked to the modified flag.  This means
that undoing or redoing changes can take a modified text widget back
to the unmodified state or vice versa.  The modified flag will be set
to automatically to the appropriate state.  This automatic coupling
does not work when the modified flag has been set by the user, until
the flag has been reset again.
.PP
See below for the \fBedit\fR widget command that controls the undo
mechanism.
.VE 8.4

a774 7
.PP
.VS 8.4
When debugging is turned on, the drawing routines of the text widget
set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR
to the lists of indices that are redrawn.  The values of these variables
are tested by Tk's test suite.
.VE 8.4
a865 36
\fIpathName \fBedit \fIoption \fR?\fIarg arg ...\fR?
.VS 8.4
This command controls the undo mechanism and the modified flag.  The
exact behavior of the command depends on the \fIoption\fR argument
that follows the \fBedit\fR argument.  The following forms of the
command are currently supported:
.RS
.TP
\fIpathName \fBedit modified ?\fIboolean\fR?
If \fIboolean\fR is not specified, returns the modified flag of the
widget. The insert, delete, edit undo and edit redo commands or the
user can set or clear the modified flag.  If \fIboolean\fR is
specified, sets the modified flag of the widget to \fIboolean\fR.
.TP
\fIpathName \fBedit redo\fR
When the \fB-undo\fR option is true, reapplies the last undone edits
provided no other edits were done since then. Generates an error when
the redo stack is empty.  Does nothing when the \fB-undo\fR option is
false.
.TP
\fIpathName \fBedit reset\fR
Clears the undo and redo stacks.
.TP
\fIpathName \fBedit separator\fR
Inserts a separator (boundary) on the undo stack. Does nothing when
the \fB-undo\fR option is false.
.TP
\fIpathName \fBedit undo\fR
Undoes the last edit action when the \fB-undo\fR option is true.  An
edit action is defined as all the insert and delete commands that are
recorded on the undo stack in between two separators. Generates an
error when the undo stack is empty.  Does nothing when the \fB-undo\fR
option is false.
.RE
.VE 8.4
.TP
a1556 3
.VS 8.4
This action is carried out by the command \fBtk_textCopy\fR.
.VE 8.4
a1560 3
.VS 8.4
This action is carried out by the command \fBtk_textCut\fR.
.VE 8.4
a1565 3
.VS 8.4
This action is carried out by the command \fBtk_textPaste\fR.
.VE 8.4
a1593 9
.IP [32]
.VS 8.4
Control-z (and Control-underscore on UNIX when \fBtk_strictMotif\fR is
true) undoes the last edit action if the \fB-undo\fR option is true.
Does nothing otherwise.
.IP [33]
Control-Z (or Control-y on Windows) reapplies the last undone edit
action if the \fB-undo\fR option is true. Does nothing otherwise.
.VE 8.4
d1637 1
a1637 1
text, widget, tkvars
@


1.8.4.1
log
@	BRANCH dgp-privates-into-namespace:
	* doc/text.n:
	* doc/tkvars.n:
	* unix/mkLinks: Added documentation for commands and variables
	matching tk_text*.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.8 2000/08/25 06:58:33 ericm Exp $
d15 1
a15 1
text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate text widgets
a16 1
.nf
a17 5
.VS 8.4
\fBtk_textCopy\fR \fIpathName\fR
\fBtk_textCut\fR \fIpathName\fR
\fBtk_textPaste\fR \fIpathName\fR
.VE
a774 7
.PP
.VS 8.4
When debugging is turned on, the drawing routines of the text widget
set the global variables \fBtk_textRedraw\fR and \fBtk_textRelayout\fR
to the lists of indices that are redrawn.  The values of these variables
are tested by Tk's test suite.
.VE
a1556 3
.VS 8.4
This action is carried out by the command \fBtk_textCopy\fR.
.VE
a1560 3
.VS 8.4
This action is carried out by the command \fBtk_textCut\fR.
.VE
a1565 3
.VS 8.4
This action is carried out by the command \fBtk_textPaste\fR.
.VE
d1637 1
a1637 1
text, widget, tkvars
@


1.7
log
@CanvPsY.3, ConfigWidg.3, CrtImgType.3, CrtItemType.3,
FontId.3, GetFont.3, canvas.n, font.n, options.n, text.n:
Documentation fix: Replaced references to XFontStruct *
and Tk_FontStruct with Tk_Font.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.6 2000/02/01 11:40:58 hobbs Exp $
d19 8
a26 6
\-background	\-highlightbackground	\-insertontime	\-selectborderwidth
\-borderwidth	\-highlightcolor	\-insertwidth	\-selectforeground
\-cursor	\-highlightthickness	\-padx	\-setgrid
\-exportselection	\-insertbackground	\-pady	\-takefocus
\-font	\-insertborderwidth	\-relief	\-xscrollcommand
\-foreground	\-insertofftime	\-selectbackground	\-yscrollcommand
@


1.6
log
@	* doc/text.n: clarified docs on what happens during a search with
	-count when images/windows are embedded
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.5 2000/01/21 03:54:21 hobbs Exp $
d342 1
a342 1
It may have any of the forms accepted by \fBTk_GetFontStruct\fR.
d527 1
a527 1
.SH EMBEDDED WINDOWS
d598 1
a598 1
.SH EMBEDDED IMAGES
d667 1
a667 1
.SH THE SELECTION
d693 1
a693 1
.SH THE INSERTION CURSOR
@


1.6.2.1
log
@doc cleanup and clarifications from 8.4aCVS backport
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.8 2000/08/25 06:58:33 ericm Exp $
d19 6
a24 8
\-background	\-highlightthickness	\-relief
\-borderwidth	\-insertbackground	\-selectbackground
\-cursor	\-insertborderwidth	\-selectborderwidth
\-exportselection	\-insertofftime	\-selectforeground
\-font	\-insertontime	\-setgrid
\-foreground	\-insertwidth	\-takefocus
\-highlightbackground	\-padx	\-xscrollcommand
\-highlightcolor	\-pady	\-yscrollcommand
d342 1
a342 1
It may have any of the forms accepted by \fBTk_GetFont\fR.
d527 1
a527 1
.SH "EMBEDDED WINDOWS"
d598 1
a598 1
.SH "EMBEDDED IMAGES"
d667 1
a667 1
.SH "THE SELECTION"
d693 1
a693 1
.SH "THE INSERTION CURSOR"
@


1.5
log
@	* doc/WindowId.3: added docs for Tk_IsContainer and Tk_IsEmbedded

	* doc/text.n: clarified mark gravity definition and usage of
	``word'' in binding definitions.  [Bug: 2004 2277 1388]
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.4 2000/01/06 02:18:54 hobbs Exp $
d1063 5
a1067 2
if a match is found, the number of characters in the matching
range will be stored in the variable.
d1070 2
a1071 1
Find elidden (hidden) text as well. By default only displayed text is found.
@


1.4
log
@	* doc/text.n:
	* generic/tkText.c:
	* generic/tkText.h:
	* generic/tkTextBTree.c:
	* generic/tkTextDisp.c:
	* generic/tkTextTag.c: removed the -state option for text tags,
	and reoriented it around -elide, as -state disabled was never
	implemented, and -state hidden is better as -elide.
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.3 1999/12/14 06:51:44 hobbs Exp $
d509 2
a510 2
position will appear to the right of the mark.  The gravity
for a mark defaults to \fBright\fR.
d828 1
a828 1
Return information about all elements: text, marks, tags, and windows.
d837 3
d844 3
a846 3
Include information about tag transitions in the dump results. Tag information is
returned as \fBtagon\fP and \fBtagoff\fP elements that indicate the
begin and end of each range of each tag, respectively.
d1444 2
a1445 3
In the descriptions below, ``word'' refers to a contiguous group
of letters, digits, or ``_'' characters, or any single character
other than these.
@


1.3
log
@	* doc/canvas.n: added docs for items added by dash patch (-*dash*,
	-state, -active*, -disabled*, -offset, essentially rewrote the
	man patch for completely updated 8.3 canvas widget.
	* doc/entry.n: added docs for entry widget validation
	* doc/event.n: added docs for -warp
	* doc/text.n: doc'ed new -state value 'hidden'
	* doc/GetDash.3: (new file) man page explaining Tk_GetDash
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.2 1998/09/14 18:23:00 stanton Exp $
d327 5
a432 5
\fB\-state \fIstate\fR
\fIState\fR specifies if the text is \fIhidden\fR or \fInormal\fR.
Hidden text is not displayed and takes no space on screen, but further
on behaves just as normal text.
.TP
d1063 2
a1064 2
\fB\-hidden\fR
Find hidden text as well. By default only displayed text is found.
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id$
d428 5
d1062 3
@


1.1
log
@Initial revision
@
text
@d8 1
a8 1
'\" SCCS: @@(#) text.n 1.68 97/10/31 12:58:41
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d8 1
a8 1
'\" RCS: @@(#) $Id: text.n,v 1.2 1998/09/14 18:23:00 stanton Exp $
@


