1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1992 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: text.n,v 1.1.1.1 2002-01-16 10:25:49 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH text n 4.0 Tk "Tk Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
text \- Create and manipulate text widgets
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBtext\fR \fIpathName \fR?\fIoptions\fR?
|
18 |
|
|
.SO
|
19 |
|
|
\-background \-highlightbackground \-insertontime \-selectborderwidth
|
20 |
|
|
\-borderwidth \-highlightcolor \-insertwidth \-selectforeground
|
21 |
|
|
\-cursor \-highlightthickness \-padx \-setgrid
|
22 |
|
|
\-exportselection \-insertbackground \-pady \-takefocus
|
23 |
|
|
\-font \-insertborderwidth \-relief \-xscrollcommand
|
24 |
|
|
\-foreground \-insertofftime \-selectbackground \-yscrollcommand
|
25 |
|
|
.SE
|
26 |
|
|
.SH "WIDGET-SPECIFIC OPTIONS"
|
27 |
|
|
.OP \-height height Height
|
28 |
|
|
Specifies the desired height for the window, in units of characters
|
29 |
|
|
in the font given by the \fB\-font\fR option.
|
30 |
|
|
Must be at least one.
|
31 |
|
|
.OP \-spacing1 spacing1 Spacing1
|
32 |
|
|
Requests additional space above each text line in the widget,
|
33 |
|
|
using any of the standard forms for screen distances.
|
34 |
|
|
If a line wraps, this option only applies to the first line
|
35 |
|
|
on the display.
|
36 |
|
|
This option may be overriden with \fB\-spacing1\fR options in
|
37 |
|
|
tags.
|
38 |
|
|
.OP \-spacing2 spacing2 Spacing2
|
39 |
|
|
For lines that wrap (so that they cover more than one line on the
|
40 |
|
|
display) this option specifies additional space to provide between
|
41 |
|
|
the display lines that represent a single line of text.
|
42 |
|
|
The value may have any of the standard forms for screen distances.
|
43 |
|
|
This option may be overriden with \fB\-spacing2\fR options in
|
44 |
|
|
tags.
|
45 |
|
|
.OP \-spacing3 spacing3 Spacing3
|
46 |
|
|
Requests additional space below each text line in the widget,
|
47 |
|
|
using any of the standard forms for screen distances.
|
48 |
|
|
If a line wraps, this option only applies to the last line
|
49 |
|
|
on the display.
|
50 |
|
|
This option may be overriden with \fB\-spacing3\fR options in
|
51 |
|
|
tags.
|
52 |
|
|
.OP \-state state State
|
53 |
|
|
Specifies one of two states for the text: \fBnormal\fR or \fBdisabled\fR.
|
54 |
|
|
If the text is disabled then characters may not be inserted or deleted
|
55 |
|
|
and no insertion cursor will be displayed, even if the input focus is
|
56 |
|
|
in the widget.
|
57 |
|
|
.OP \-tabs tabs Tabs
|
58 |
|
|
Specifies a set of tab stops for the window. The option's value consists
|
59 |
|
|
of a list of screen distances giving the positions of the tab stops. Each
|
60 |
|
|
position may optionally be followed in the next list element
|
61 |
|
|
by one of the keywords \fBleft\fR, \fBright\fR, \fBcenter\fR,
|
62 |
|
|
or \fBnumeric\fR, which specifies how to justify
|
63 |
|
|
text relative to the tab stop. \fBLeft\fR is the default; it causes
|
64 |
|
|
the text following the tab character to be positioned with its left edge
|
65 |
|
|
at the tab position. \fBRight\fR means that the right edge of the text
|
66 |
|
|
following the tab character is positioned at the tab position, and
|
67 |
|
|
\fBcenter\fR means that the text is centered at the tab position.
|
68 |
|
|
\fBNumeric\fR means that the decimal point in the text is positioned
|
69 |
|
|
at the tab position; if there is no decimal point then the least
|
70 |
|
|
significant digit of the number is positioned just to the left of the
|
71 |
|
|
tab position; if there is no number in the text then the text is
|
72 |
|
|
right-justified at the tab position.
|
73 |
|
|
For example, \fB\-tabs {2c left 4c 6c center}\fR creates three
|
74 |
|
|
tab stops at two-centimeter intervals; the first two use left
|
75 |
|
|
justification and the third uses center justification.
|
76 |
|
|
If the list of tab stops does not have enough elements to cover all
|
77 |
|
|
of the tabs in a text line, then Tk extrapolates new tab stops using
|
78 |
|
|
the spacing and alignment from the last tab stop in the list.
|
79 |
|
|
The value of the \fBtabs\fR option may be overridden by \fB\-tabs\fR
|
80 |
|
|
options in tags.
|
81 |
|
|
If no \fB\-tabs\fR option is specified, or if it is specified as
|
82 |
|
|
an empty list, then Tk uses default tabs spaced every eight
|
83 |
|
|
(average size) characters.
|
84 |
|
|
.OP \-width width Width
|
85 |
|
|
Specifies the desired width for the window in units of characters
|
86 |
|
|
in the font given by the \fB\-font\fR option.
|
87 |
|
|
If the font doesn't have a uniform width then the width of the
|
88 |
|
|
character ``0'' is used in translating from character units to
|
89 |
|
|
screen units.
|
90 |
|
|
.OP \-wrap wrap Wrap
|
91 |
|
|
Specifies how to handle lines in the text that are too long to be
|
92 |
|
|
displayed in a single line of the text's window.
|
93 |
|
|
The value must be \fBnone\fR or \fBchar\fR or \fBword\fR.
|
94 |
|
|
A wrap mode of \fBnone\fR means that each line of text appears as
|
95 |
|
|
exactly one line on the screen; extra characters that don't fit
|
96 |
|
|
on the screen are not displayed.
|
97 |
|
|
In the other modes each line of text will be broken up into several
|
98 |
|
|
screen lines if necessary to keep all the characters visible.
|
99 |
|
|
In \fBchar\fR mode a screen line break may occur after any character;
|
100 |
|
|
in \fBword\fR mode a line break will only be made at word boundaries.
|
101 |
|
|
.BE
|
102 |
|
|
|
103 |
|
|
.SH DESCRIPTION
|
104 |
|
|
.PP
|
105 |
|
|
The \fBtext\fR command creates a new window (given by the
|
106 |
|
|
\fIpathName\fR argument) and makes it into a text widget.
|
107 |
|
|
Additional
|
108 |
|
|
options, described above, may be specified on the command line
|
109 |
|
|
or in the option database
|
110 |
|
|
to configure aspects of the text such as its default background color
|
111 |
|
|
and relief. The \fBtext\fR command returns the
|
112 |
|
|
path name of the new window.
|
113 |
|
|
.PP
|
114 |
|
|
A text widget displays one or more lines of text and allows that
|
115 |
|
|
text to be edited.
|
116 |
|
|
.VS
|
117 |
|
|
Text widgets support four different kinds of annotations on the
|
118 |
|
|
text, called tags, marks, embedded windows or embedded images.
|
119 |
|
|
.VE
|
120 |
|
|
Tags allow different portions of the text
|
121 |
|
|
to be displayed with different fonts and colors.
|
122 |
|
|
In addition, Tcl commands can be associated with tags so
|
123 |
|
|
that scripts are invoked when particular actions such as keystrokes
|
124 |
|
|
and mouse button presses occur in particular ranges of the text.
|
125 |
|
|
See TAGS below for more details.
|
126 |
|
|
.PP
|
127 |
|
|
The second form of annotation consists of marks, which are floating
|
128 |
|
|
markers in the text.
|
129 |
|
|
Marks are used to keep track of various interesting positions in the
|
130 |
|
|
text as it is edited.
|
131 |
|
|
See MARKS below for more details.
|
132 |
|
|
.PP
|
133 |
|
|
The third form of annotation allows arbitrary windows to be
|
134 |
|
|
embedded in a text widget.
|
135 |
|
|
See EMBEDDED WINDOWS below for more details.
|
136 |
|
|
.PP
|
137 |
|
|
.VS
|
138 |
|
|
The fourth form of annotation allows Tk images to be embedded in a text
|
139 |
|
|
widget.
|
140 |
|
|
See EMBEDDED IMAGES below for more details.
|
141 |
|
|
.VE
|
142 |
|
|
|
143 |
|
|
.SH INDICES
|
144 |
|
|
.PP
|
145 |
|
|
Many of the widget commands for texts take one or more indices
|
146 |
|
|
as arguments.
|
147 |
|
|
An index is a string used to indicate a particular place within
|
148 |
|
|
a text, such as a place to insert characters or one endpoint of a
|
149 |
|
|
range of characters to delete.
|
150 |
|
|
Indices have the syntax
|
151 |
|
|
.CS
|
152 |
|
|
\fIbase modifier modifier modifier ...\fR
|
153 |
|
|
.CE
|
154 |
|
|
Where \fIbase\fR gives a starting point and the \fImodifier\fRs
|
155 |
|
|
adjust the index from the starting point (e.g. move forward or
|
156 |
|
|
backward one character). Every index must contain a \fIbase\fR,
|
157 |
|
|
but the \fImodifier\fRs are optional.
|
158 |
|
|
.PP
|
159 |
|
|
The \fIbase\fR for an index must have one of the following forms:
|
160 |
|
|
.TP 12
|
161 |
|
|
\fIline\fB.\fIchar\fR
|
162 |
|
|
Indicates \fIchar\fR'th character on line \fIline\fR.
|
163 |
|
|
Lines are numbered from 1 for consistency with other UNIX programs
|
164 |
|
|
that use this numbering scheme.
|
165 |
|
|
Within a line, characters are numbered from 0.
|
166 |
|
|
If \fIchar\fR is \fBend\fR then it refers to the newline character
|
167 |
|
|
that ends the line.
|
168 |
|
|
.TP 12
|
169 |
|
|
\fB@\fIx\fB,\fIy\fR
|
170 |
|
|
Indicates the character that covers the pixel whose x and y coordinates
|
171 |
|
|
within the text's window are \fIx\fR and \fIy\fR.
|
172 |
|
|
.TP 12
|
173 |
|
|
\fBend\fR
|
174 |
|
|
Indicates the end of the text (the character just after the last
|
175 |
|
|
newline).
|
176 |
|
|
.TP 12
|
177 |
|
|
\fImark\fR
|
178 |
|
|
Indicates the character just after the mark whose name is \fImark\fR.
|
179 |
|
|
.TP 12
|
180 |
|
|
\fItag\fB.first\fR
|
181 |
|
|
Indicates the first character in the text that has been tagged with
|
182 |
|
|
\fItag\fR.
|
183 |
|
|
This form generates an error if no characters are currently tagged
|
184 |
|
|
with \fItag\fR.
|
185 |
|
|
.TP 12
|
186 |
|
|
\fItag\fB.last\fR
|
187 |
|
|
Indicates the character just after the last one in the text that has
|
188 |
|
|
been tagged with \fItag\fR.
|
189 |
|
|
This form generates an error if no characters are currently tagged
|
190 |
|
|
with \fItag\fR.
|
191 |
|
|
.TP 12
|
192 |
|
|
\fIpathName\fR
|
193 |
|
|
Indicates the position of the embedded window whose name is
|
194 |
|
|
\fIpathName\fR.
|
195 |
|
|
This form generates an error if there is no embedded window
|
196 |
|
|
by the given name.
|
197 |
|
|
.TP 12
|
198 |
|
|
.VS
|
199 |
|
|
\fIimageName\fR
|
200 |
|
|
Indicates the position of the embedded image whose name is
|
201 |
|
|
\fIimageName\fR.
|
202 |
|
|
This form generates an error if there is no embedded image
|
203 |
|
|
by the given name.
|
204 |
|
|
.VE
|
205 |
|
|
.PP
|
206 |
|
|
If the \fIbase\fP could match more than one of the above forms, such
|
207 |
|
|
as a \fImark\fP and \fIimageName\fP both having the same value, then
|
208 |
|
|
the form earlier in the above list takes precedence.
|
209 |
|
|
If modifiers follow the base index, each one of them must have one
|
210 |
|
|
of the forms listed below. Keywords such as \fBchars\fR and \fBwordend\fR
|
211 |
|
|
may be abbreviated as long as the abbreviation is unambiguous.
|
212 |
|
|
.TP
|
213 |
|
|
\fB+ \fIcount\fB chars\fR
|
214 |
|
|
Adjust the index forward by \fIcount\fR characters, moving to later
|
215 |
|
|
lines in the text if necessary. If there are fewer than \fIcount\fR
|
216 |
|
|
characters in the text after the current index, then set the index
|
217 |
|
|
to the last character in the text.
|
218 |
|
|
Spaces on either side of \fIcount\fR are optional.
|
219 |
|
|
.TP
|
220 |
|
|
\fB\- \fIcount\fB chars\fR
|
221 |
|
|
Adjust the index backward by \fIcount\fR characters, moving to earlier
|
222 |
|
|
lines in the text if necessary. If there are fewer than \fIcount\fR
|
223 |
|
|
characters in the text before the current index, then set the index
|
224 |
|
|
to the first character in the text.
|
225 |
|
|
Spaces on either side of \fIcount\fR are optional.
|
226 |
|
|
.TP
|
227 |
|
|
\fB+ \fIcount\fB lines\fR
|
228 |
|
|
Adjust the index forward by \fIcount\fR lines, retaining the same
|
229 |
|
|
character position within the line. If there are fewer than \fIcount\fR
|
230 |
|
|
lines after the line containing the current index, then set the index
|
231 |
|
|
to refer to the same character position on the last line of the text.
|
232 |
|
|
Then, if the line is not long enough to contain a character at the indicated
|
233 |
|
|
character position, adjust the character position to refer to the last
|
234 |
|
|
character of the line (the newline).
|
235 |
|
|
Spaces on either side of \fIcount\fR are optional.
|
236 |
|
|
.TP
|
237 |
|
|
\fB\- \fIcount\fB lines\fR
|
238 |
|
|
Adjust the index backward by \fIcount\fR lines, retaining the same
|
239 |
|
|
character position within the line. If there are fewer than \fIcount\fR
|
240 |
|
|
lines before the line containing the current index, then set the index
|
241 |
|
|
to refer to the same character position on the first line of the text.
|
242 |
|
|
Then, if the line is not long enough to contain a character at the indicated
|
243 |
|
|
character position, adjust the character position to refer to the last
|
244 |
|
|
character of the line (the newline).
|
245 |
|
|
Spaces on either side of \fIcount\fR are optional.
|
246 |
|
|
.TP
|
247 |
|
|
\fBlinestart\fR
|
248 |
|
|
Adjust the index to refer to the first character on the line.
|
249 |
|
|
.TP
|
250 |
|
|
\fBlineend\fR
|
251 |
|
|
Adjust the index to refer to the last character on the line (the newline).
|
252 |
|
|
.TP
|
253 |
|
|
\fBwordstart\fR
|
254 |
|
|
Adjust the index to refer to the first character of the word containing
|
255 |
|
|
the current index. A word consists of any number of adjacent characters
|
256 |
|
|
that are letters, digits, or underscores, or a single character that
|
257 |
|
|
is not one of these.
|
258 |
|
|
.TP
|
259 |
|
|
\fBwordend\fR
|
260 |
|
|
Adjust the index to refer to the character just after the last one of the
|
261 |
|
|
word containing the current index. If the current index refers to the last
|
262 |
|
|
character of the text then it is not modified.
|
263 |
|
|
.PP
|
264 |
|
|
If more than one modifier is present then they are applied in
|
265 |
|
|
left-to-right order. For example, the index ``\fBend \- 1 chars\fR''
|
266 |
|
|
refers to the next-to-last character in the text and
|
267 |
|
|
``\fBinsert wordstart \- 1 c\fR'' refers to the character just before
|
268 |
|
|
the first one in the word containing the insertion cursor.
|
269 |
|
|
|
270 |
|
|
.SH TAGS
|
271 |
|
|
.PP
|
272 |
|
|
The first form of annotation in text widgets is a tag.
|
273 |
|
|
A tag is a textual string that is associated with some of the characters
|
274 |
|
|
in a text.
|
275 |
|
|
Tags may contain arbitrary characters, but it is probably best to
|
276 |
|
|
avoid using the the characters `` '' (space), \fB+\fR, or \fB\-\fR:
|
277 |
|
|
these characters have special meaning in indices, so tags containing
|
278 |
|
|
them can't be used as indices.
|
279 |
|
|
There may be any number of tags associated with characters in a
|
280 |
|
|
text.
|
281 |
|
|
Each tag may refer to a single character, a range of characters, or
|
282 |
|
|
several ranges of characters.
|
283 |
|
|
An individual character may have any number of tags associated with it.
|
284 |
|
|
.PP
|
285 |
|
|
A priority order is defined among tags, and this order is used in
|
286 |
|
|
implementing some of the tag-related functions described below.
|
287 |
|
|
When a tag is defined (by associating it with characters or setting
|
288 |
|
|
its display options or binding commands to it), it is given
|
289 |
|
|
a priority higher than any existing tag.
|
290 |
|
|
The priority order of tags may be redefined using the
|
291 |
|
|
``\fIpathName \fBtag raise\fR'' and ``\fIpathName \fBtag lower\fR''
|
292 |
|
|
widget commands.
|
293 |
|
|
.PP
|
294 |
|
|
Tags serve three purposes in text widgets.
|
295 |
|
|
First, they control the way information is displayed on the screen.
|
296 |
|
|
By default, characters are displayed as determined by the
|
297 |
|
|
\fBbackground\fR, \fBfont\fR, and \fBforeground\fR options for the
|
298 |
|
|
text widget.
|
299 |
|
|
However, display options may be associated with individual tags
|
300 |
|
|
using the ``\fIpathName \fBtag configure\fR'' widget command.
|
301 |
|
|
If a character has been tagged, then the display options associated
|
302 |
|
|
with the tag override the default display style.
|
303 |
|
|
The following options are currently supported for tags:
|
304 |
|
|
.TP
|
305 |
|
|
\fB\-background \fIcolor\fR
|
306 |
|
|
\fIColor\fR specifies the background color to use for characters
|
307 |
|
|
associated with the tag.
|
308 |
|
|
It may have any of the forms accepted by \fBTk_GetColor\fR.
|
309 |
|
|
.TP
|
310 |
|
|
\fB\-bgstipple \fIbitmap\fR
|
311 |
|
|
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
|
312 |
|
|
for the background.
|
313 |
|
|
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
|
314 |
|
|
If \fIbitmap\fR hasn't been specified, or if it is specified
|
315 |
|
|
as an empty string, then a solid fill will be used for the
|
316 |
|
|
background.
|
317 |
|
|
.TP
|
318 |
|
|
\fB\-borderwidth \fIpixels\fR
|
319 |
|
|
\fIPixels\fR specifies the width of a 3-D border to draw around
|
320 |
|
|
the background.
|
321 |
|
|
It may have any of the forms accepted by \fBTk_GetPixels\fR.
|
322 |
|
|
This option is used in conjunction with the \fB\-relief\fR
|
323 |
|
|
option to give a 3-D appearance to the background for characters;
|
324 |
|
|
it is ignored unless the \fB\-background\fR option
|
325 |
|
|
has been set for the tag.
|
326 |
|
|
.TP
|
327 |
|
|
\fB\-fgstipple \fIbitmap\fR
|
328 |
|
|
\fIBitmap\fR specifies a bitmap that is used as a stipple pattern
|
329 |
|
|
when drawing text and other foreground information such as
|
330 |
|
|
underlines.
|
331 |
|
|
It may have any of the forms accepted by \fBTk_GetBitmap\fR.
|
332 |
|
|
If \fIbitmap\fR hasn't been specified, or if it is specified
|
333 |
|
|
as an empty string, then a solid fill will be used.
|
334 |
|
|
.TP
|
335 |
|
|
\fB\-font \fIfontName\fR
|
336 |
|
|
\fIFontName\fR is the name of a font to use for drawing characters.
|
337 |
|
|
It may have any of the forms accepted by \fBTk_GetFontStruct\fR.
|
338 |
|
|
.TP
|
339 |
|
|
\fB\-foreground \fIcolor\fR
|
340 |
|
|
\fIColor\fR specifies the color to use when drawing text and other
|
341 |
|
|
foreground information such as underlines.
|
342 |
|
|
It may have any of the forms accepted by \fBTk_GetColor\fR.
|
343 |
|
|
.TP
|
344 |
|
|
\fB\-justify \fIjustify\fR
|
345 |
|
|
If the first character of a display line has a tag for which this
|
346 |
|
|
option has been specified, then \fIjustify\fR determines how to
|
347 |
|
|
justify the line.
|
348 |
|
|
It must be one of \fBleft\fR, \fBright\fR, or \fBcenter\fR.
|
349 |
|
|
If a line wraps, then the justification for each line on the
|
350 |
|
|
display is determined by the first character of that display line.
|
351 |
|
|
.TP
|
352 |
|
|
\fB\-lmargin1 \fIpixels\fR
|
353 |
|
|
If the first character of a text line has a tag for which this
|
354 |
|
|
option has been specified, then \fIpixels\fR specifies how
|
355 |
|
|
much the line should be indented from the left edge of the
|
356 |
|
|
window.
|
357 |
|
|
\fIPixels\fR may have any of the standard forms for screen
|
358 |
|
|
distances.
|
359 |
|
|
If a line of text wraps, this option only applies to the
|
360 |
|
|
first line on the display; the \fB\-lmargin2\fR option controls
|
361 |
|
|
the indentation for subsequent lines.
|
362 |
|
|
.TP
|
363 |
|
|
\fB\-lmargin2 \fIpixels\fR
|
364 |
|
|
If the first character of a display line has a tag for which this
|
365 |
|
|
option has been specified, and if the display line is not the
|
366 |
|
|
first for its text line (i.e., the text line has wrapped), then
|
367 |
|
|
\fIpixels\fR specifies how much the line should be indented from
|
368 |
|
|
the left edge of the window.
|
369 |
|
|
\fIPixels\fR may have any of the standard forms for screen
|
370 |
|
|
distances.
|
371 |
|
|
This option is only used when wrapping is enabled, and it only
|
372 |
|
|
applies to the second and later display lines for a text line.
|
373 |
|
|
.TP
|
374 |
|
|
\fB\-offset \fIpixels\fR
|
375 |
|
|
\fIPixels\fR specifies an amount by which the text's baseline
|
376 |
|
|
should be offset vertically from the baseline of the overall
|
377 |
|
|
line, in pixels.
|
378 |
|
|
For example, a positive offset can be used for superscripts
|
379 |
|
|
and a negative offset can be used for subscripts.
|
380 |
|
|
\fIPixels\fR may have any of the standard forms for screen
|
381 |
|
|
distances.
|
382 |
|
|
.TP
|
383 |
|
|
\fB\-overstrike \fIboolean\fR
|
384 |
|
|
Specifies whether or not to draw a horizontal rule through
|
385 |
|
|
the middle of characters.
|
386 |
|
|
\fIBoolean\fR may have any of the forms accepted by \fBTk_GetBoolean\fR.
|
387 |
|
|
.TP
|
388 |
|
|
\fB\-relief \fIrelief\fR
|
389 |
|
|
\fIRelief\fR specifies the 3-D relief to use for drawing backgrounds,
|
390 |
|
|
in any of the forms accepted by \fBTk_GetRelief\fR.
|
391 |
|
|
This option is used in conjunction with the \fB\-borderwidth\fR
|
392 |
|
|
option to give a 3-D appearance to the background for characters;
|
393 |
|
|
it is ignored unless the \fB\-background\fR option
|
394 |
|
|
has been set for the tag.
|
395 |
|
|
.TP
|
396 |
|
|
\fB\-rmargin \fIpixels\fR
|
397 |
|
|
If the first character of a display line has a tag for which this
|
398 |
|
|
option has been specified, then \fIpixels\fR specifies how wide
|
399 |
|
|
a margin to leave between the end of the line and the right
|
400 |
|
|
edge of the window.
|
401 |
|
|
\fIPixels\fR may have any of the standard forms for screen
|
402 |
|
|
distances.
|
403 |
|
|
This option is only used when wrapping is enabled.
|
404 |
|
|
If a text line wraps, the right margin for each line on the
|
405 |
|
|
display is determined by the first character of that display
|
406 |
|
|
line.
|
407 |
|
|
.TP
|
408 |
|
|
\fB\-spacing1 \fIpixels\fR
|
409 |
|
|
\fIPixels\fR specifies how much additional space should be
|
410 |
|
|
left above each text line, using any of the standard forms for
|
411 |
|
|
screen distances.
|
412 |
|
|
If a line wraps, this option only applies to the first
|
413 |
|
|
line on the display.
|
414 |
|
|
.TP
|
415 |
|
|
\fB\-spacing2 \fIpixels\fR
|
416 |
|
|
For lines that wrap, this option specifies how much additional
|
417 |
|
|
space to leave between the display lines for a single text line.
|
418 |
|
|
\fIPixels\fR may have any of the standard forms for screen
|
419 |
|
|
distances.
|
420 |
|
|
.TP
|
421 |
|
|
\fB\-spacing3 \fIpixels\fR
|
422 |
|
|
\fIPixels\fR specifies how much additional space should be
|
423 |
|
|
left below each text line, using any of the standard forms for
|
424 |
|
|
screen distances.
|
425 |
|
|
If a line wraps, this option only applies to the last
|
426 |
|
|
line on the display.
|
427 |
|
|
.TP
|
428 |
|
|
\fB\-tabs \fItabList\fR
|
429 |
|
|
\fITabList\fR specifies a set of tab stops in the same form
|
430 |
|
|
as for the \fB\-tabs\fR option for the text widget. This
|
431 |
|
|
option only applies to a display line if it applies to the
|
432 |
|
|
first character on that display line.
|
433 |
|
|
If this option is specified as an empty string, it cancels
|
434 |
|
|
the option, leaving it unspecified for the tag (the default).
|
435 |
|
|
If the option is specified as a non-empty string that is
|
436 |
|
|
an empty list, such as \fB\-tags\0{\0}\fR, then it requests
|
437 |
|
|
default 8-character tabs as described for the \fBtags\fR
|
438 |
|
|
widget option.
|
439 |
|
|
.TP
|
440 |
|
|
\fB\-underline \fIboolean\fR
|
441 |
|
|
\fIBoolean\fR specifies whether or not to draw an underline underneath
|
442 |
|
|
characters.
|
443 |
|
|
It may have any of the forms accepted by \fBTk_GetBoolean\fR.
|
444 |
|
|
.TP
|
445 |
|
|
\fB\-wrap \fImode\fR
|
446 |
|
|
\fIMode\fR specifies how to handle lines that are wider than the
|
447 |
|
|
text's window.
|
448 |
|
|
It has the same legal values as the \fB\-wrap\fR option
|
449 |
|
|
for the text widget: \fBnone\fR, \fBchar\fR, or \fBword\fR.
|
450 |
|
|
If this tag option is specified, it overrides the \fB\-wrap\fR option
|
451 |
|
|
for the text widget.
|
452 |
|
|
.PP
|
453 |
|
|
If a character has several tags associated with it, and if their
|
454 |
|
|
display options conflict, then the options of the highest priority
|
455 |
|
|
tag are used.
|
456 |
|
|
If a particular display option hasn't been specified for a
|
457 |
|
|
particular tag, or if it is specified as an empty string, then
|
458 |
|
|
that option will never be used; the next-highest-priority
|
459 |
|
|
tag's option will used instead.
|
460 |
|
|
If no tag specifies a particular display option, then the default
|
461 |
|
|
style for the widget will be used.
|
462 |
|
|
.PP
|
463 |
|
|
The second purpose for tags is event bindings.
|
464 |
|
|
You can associate bindings with a tag in much the same way you can
|
465 |
|
|
associate bindings with a widget class: whenever particular X
|
466 |
|
|
events occur on characters with the given tag, a given
|
467 |
|
|
Tcl command will be executed.
|
468 |
|
|
Tag bindings can be used to give behaviors to ranges of characters;
|
469 |
|
|
among other things, this allows hypertext-like
|
470 |
|
|
features to be implemented.
|
471 |
|
|
For details, see the description of the \fBtag bind\fR widget
|
472 |
|
|
command below.
|
473 |
|
|
.PP
|
474 |
|
|
The third use for tags is in managing the selection.
|
475 |
|
|
See THE SELECTION below.
|
476 |
|
|
|
477 |
|
|
.SH MARKS
|
478 |
|
|
.PP
|
479 |
|
|
The second form of annotation in text widgets is a mark.
|
480 |
|
|
Marks are used for remembering particular places in a text.
|
481 |
|
|
They are something like tags, in that they have names and
|
482 |
|
|
they refer to places in the file, but a mark isn't associated
|
483 |
|
|
with particular characters.
|
484 |
|
|
Instead, a mark is associated with the gap between two characters.
|
485 |
|
|
Only a single position may be associated with a mark at any given
|
486 |
|
|
time.
|
487 |
|
|
If the characters around a mark are deleted the mark will still
|
488 |
|
|
remain; it will just have new neighbor characters.
|
489 |
|
|
In contrast, if the characters containing a tag are deleted then
|
490 |
|
|
the tag will no longer have an association with characters in
|
491 |
|
|
the file.
|
492 |
|
|
Marks may be manipulated with the ``\fIpathName \fBmark\fR'' widget
|
493 |
|
|
command, and their current locations may be determined by using the
|
494 |
|
|
mark name as an index in widget commands.
|
495 |
|
|
.PP
|
496 |
|
|
Each mark also has a \fIgravity\fR, which is either \fBleft\fR or
|
497 |
|
|
\fBright\fR.
|
498 |
|
|
The gravity for a mark specifies what happens to the mark when
|
499 |
|
|
text is inserted at the point of the mark.
|
500 |
|
|
If a mark has left gravity, then the mark is treated as if it
|
501 |
|
|
were attached to the character on its left, so the mark will
|
502 |
|
|
remain to the left of any text inserted at the mark position.
|
503 |
|
|
If the mark has right gravity, new text inserted at the mark
|
504 |
|
|
position will appear to the right of the mark. The gravity
|
505 |
|
|
for a mark defaults to \fBright\fR.
|
506 |
|
|
.PP
|
507 |
|
|
The name space for marks is different from that for tags: the
|
508 |
|
|
same name may be used for both a mark and a tag, but they will refer
|
509 |
|
|
to different things.
|
510 |
|
|
.PP
|
511 |
|
|
Two marks have special significance.
|
512 |
|
|
First, the mark \fBinsert\fR is associated with the insertion cursor,
|
513 |
|
|
as described under THE INSERTION CURSOR below.
|
514 |
|
|
Second, the mark \fBcurrent\fR is associated with the character
|
515 |
|
|
closest to the mouse and is adjusted automatically to track the
|
516 |
|
|
mouse position and any changes to the text in the widget (one
|
517 |
|
|
exception: \fBcurrent\fR is not updated in response to mouse
|
518 |
|
|
motions if a mouse button is down; the update will be deferred
|
519 |
|
|
until all mouse buttons have been released).
|
520 |
|
|
Neither of these special marks may be deleted.
|
521 |
|
|
|
522 |
|
|
.SH EMBEDDED WINDOWS
|
523 |
|
|
.PP
|
524 |
|
|
The third form of annotation in text widgets is an embedded window.
|
525 |
|
|
Each embedded window annotation causes a window to be displayed
|
526 |
|
|
at a particular point in the text.
|
527 |
|
|
There may be any number of embedded windows in a text widget,
|
528 |
|
|
and any widget may be used as an embedded window (subject to the
|
529 |
|
|
usual rules for geometry management, which require the text window
|
530 |
|
|
to be the parent of the embedded window or a descendant of its
|
531 |
|
|
parent).
|
532 |
|
|
The embedded window's position on the screen will be updated as the
|
533 |
|
|
text is modified or scrolled, and it will be mapped and unmapped as
|
534 |
|
|
it moves into and out of the visible area of the text widget.
|
535 |
|
|
Each embedded window occupies one character's worth of index space
|
536 |
|
|
in the text widget, and it may be referred to either by the name
|
537 |
|
|
of its embedded window or by its position in the widget's
|
538 |
|
|
index space.
|
539 |
|
|
If the range of text containing the embedded window is deleted then
|
540 |
|
|
the window is destroyed.
|
541 |
|
|
.PP
|
542 |
|
|
When an embedded window is added to a text widget with the
|
543 |
|
|
\fBwindow create\fR widget command, several configuration
|
544 |
|
|
options may be associated with it.
|
545 |
|
|
These options may be modified later with the \fBwindow configure\fR
|
546 |
|
|
widget command.
|
547 |
|
|
The following options are currently supported:
|
548 |
|
|
.TP
|
549 |
|
|
\fB\-align \fIwhere\fR
|
550 |
|
|
If the window is not as tall as the line in which it is displayed,
|
551 |
|
|
this option determines where the window is displayed in the line.
|
552 |
|
|
\fIWhere\fR must have one of the values \fBtop\fR (align the top of the window
|
553 |
|
|
with the top of the line), \fBcenter\fR (center the window
|
554 |
|
|
within the range of the line), \fBbottom\fR (align the bottom of the
|
555 |
|
|
window with the bottom of the line's area),
|
556 |
|
|
or \fBbaseline\fR (align the bottom of the window with the baseline
|
557 |
|
|
of the line).
|
558 |
|
|
.TP
|
559 |
|
|
\fB\-create \fIscript\fR
|
560 |
|
|
Specifies a Tcl script that may be evaluated to create the window
|
561 |
|
|
for the annotation.
|
562 |
|
|
If no \fB\-window\fR option has been specified for the annotation
|
563 |
|
|
this script will be evaluated when the annotation is about to
|
564 |
|
|
be displayed on the screen.
|
565 |
|
|
\fIScript\fR must create a window for the annotation and return
|
566 |
|
|
the name of that window as its result.
|
567 |
|
|
If the annotation's window should ever be deleted, \fIscript\fR
|
568 |
|
|
will be evaluated again the next time the annotation is displayed.
|
569 |
|
|
.TP
|
570 |
|
|
\fB\-padx \fIpixels\fR
|
571 |
|
|
\fIPixels\fR specifies the amount of extra space to leave on
|
572 |
|
|
each side of the embedded window.
|
573 |
|
|
It may have any of the usual forms defined for a screen distance.
|
574 |
|
|
.TP
|
575 |
|
|
\fB\-pady \fIpixels\fR
|
576 |
|
|
\fIPixels\fR specifies the amount of extra space to leave on
|
577 |
|
|
the top and on the bottom of the embedded window.
|
578 |
|
|
It may have any of the usual forms defined for a screen distance.
|
579 |
|
|
.TP
|
580 |
|
|
\fB\-stretch \fIboolean\fR
|
581 |
|
|
If the requested height of the embedded window is less than the
|
582 |
|
|
height of the line in which it is displayed, this option can be
|
583 |
|
|
used to specify whether the window should be stretched vertically
|
584 |
|
|
to fill its line.
|
585 |
|
|
If the \fB\-pady\fR option has been specified as well, then the
|
586 |
|
|
requested padding will be retained even if the window is
|
587 |
|
|
stretched.
|
588 |
|
|
.TP
|
589 |
|
|
\fB\-window \fIpathName\fR
|
590 |
|
|
Specifies the name of a window to display in the annotation.
|
591 |
|
|
|
592 |
|
|
.VS
|
593 |
|
|
.SH EMBEDDED IMAGES
|
594 |
|
|
.PP
|
595 |
|
|
The final form of annotation in text widgets is an embedded image.
|
596 |
|
|
Each embedded image annotation causes an image to be displayed
|
597 |
|
|
at a particular point in the text.
|
598 |
|
|
There may be any number of embedded images in a text widget,
|
599 |
|
|
and a particular image may be embedded in multiple places in the same
|
600 |
|
|
text widget.
|
601 |
|
|
The embedded image's position on the screen will be updated as the
|
602 |
|
|
text is modified or scrolled.
|
603 |
|
|
Each embedded image occupies one character's worth of index space
|
604 |
|
|
in the text widget, and it may be referred to either by
|
605 |
|
|
its position in the widget's index space, or the name it is assigned
|
606 |
|
|
when the image is inserted into the text widget widh \fBimage create\fP.
|
607 |
|
|
If the range of text containing the embedded image is deleted then
|
608 |
|
|
that copy of the image is removed from the screen.
|
609 |
|
|
.PP
|
610 |
|
|
When an embedded image is added to a text widget with the \fBimage
|
611 |
|
|
create\fR widget command, a name unique to this instance of the image
|
612 |
|
|
is returned. This name may then be used to refer to this image
|
613 |
|
|
instance. The name is taken to be the value of the \fB-name\fP option
|
614 |
|
|
(described below). If the \fB-name\fP option is not provided, the
|
615 |
|
|
\fB-image\fP name is used instead. If the \fIimageName\fP is already
|
616 |
|
|
in use in the text widget, then \fB#\fInn\fR is added to the end of the
|
617 |
|
|
\fIimageName\fP, where \fInn\fP is an arbitrary integer. This insures
|
618 |
|
|
the \fIimageName\fP is unique.
|
619 |
|
|
Once this name is assigned to this instance of the image, it does not
|
620 |
|
|
change, even though the \fB-image\fP or \fB-name\fP values can be changed
|
621 |
|
|
with \fBimage configure\fP.
|
622 |
|
|
.PP
|
623 |
|
|
When an embedded image is added to a text widget with the
|
624 |
|
|
\fBimage create\fR widget command, several configuration
|
625 |
|
|
options may be associated with it.
|
626 |
|
|
These options may be modified later with the \fBimage configure\fR
|
627 |
|
|
widget command.
|
628 |
|
|
The following options are currently supported:
|
629 |
|
|
.TP
|
630 |
|
|
\fB\-align \fIwhere\fR
|
631 |
|
|
If the image is not as tall as the line in which it is displayed,
|
632 |
|
|
this option determines where the image is displayed in the line.
|
633 |
|
|
\fIWhere\fR must have one of the values \fBtop\fR (align the top of the image
|
634 |
|
|
with the top of the line), \fBcenter\fR (center the image
|
635 |
|
|
within the range of the line), \fBbottom\fR (align the bottom of the
|
636 |
|
|
image with the bottom of the line's area),
|
637 |
|
|
or \fBbaseline\fR (align the bottom of the image with the baseline
|
638 |
|
|
of the line).
|
639 |
|
|
.TP
|
640 |
|
|
\fB\-image \fIimage\fR
|
641 |
|
|
Specifies the name of the Tk image to display in the annotation.
|
642 |
|
|
If \fIimage\fP is not a valid Tk image, then an error is returned.
|
643 |
|
|
.TP
|
644 |
|
|
\fB\-name \fIImageName\fR
|
645 |
|
|
Specifies the name by which this image instance may be referenced in
|
646 |
|
|
the text widget. If \fIImageName\fP is not supplied, then the
|
647 |
|
|
name of the Tk image is used instead.
|
648 |
|
|
If the \fIimageName\fP is already in use, \fI#nn\fP is appended to
|
649 |
|
|
the end of the name as described above.
|
650 |
|
|
.TP
|
651 |
|
|
\fB\-padx \fIpixels\fR
|
652 |
|
|
\fIPixels\fR specifies the amount of extra space to leave on
|
653 |
|
|
each side of the embedded image.
|
654 |
|
|
It may have any of the usual forms defined for a screen distance.
|
655 |
|
|
.TP
|
656 |
|
|
\fB\-pady \fIpixels\fR
|
657 |
|
|
\fIPixels\fR specifies the amount of extra space to leave on
|
658 |
|
|
the top and on the bottom of the embedded image.
|
659 |
|
|
It may have any of the usual forms defined for a screen distance.
|
660 |
|
|
.VE
|
661 |
|
|
|
662 |
|
|
.SH THE SELECTION
|
663 |
|
|
.PP
|
664 |
|
|
Selection support is implemented via tags.
|
665 |
|
|
If the \fBexportSelection\fR option for the text widget is true
|
666 |
|
|
then the \fBsel\fR tag will be associated with the selection:
|
667 |
|
|
.IP [1]
|
668 |
|
|
Whenever characters are tagged with \fBsel\fR the text widget
|
669 |
|
|
will claim ownership of the selection.
|
670 |
|
|
.IP [2]
|
671 |
|
|
Attempts to retrieve the
|
672 |
|
|
selection will be serviced by the text widget, returning all the
|
673 |
|
|
characters with the \fBsel\fR tag.
|
674 |
|
|
.IP [3]
|
675 |
|
|
If the selection is claimed away by another application or by another
|
676 |
|
|
window within this application, then the \fBsel\fR tag will be removed
|
677 |
|
|
from all characters in the text.
|
678 |
|
|
.PP
|
679 |
|
|
The \fBsel\fR tag is automatically defined when a text widget is
|
680 |
|
|
created, and it may not be deleted with the ``\fIpathName \fBtag delete\fR''
|
681 |
|
|
widget command. Furthermore, the \fBselectBackground\fR,
|
682 |
|
|
\fBselectBorderWidth\fR, and \fBselectForeground\fR options for
|
683 |
|
|
the text widget are tied to the \fB\-background\fR,
|
684 |
|
|
\fB\-borderwidth\fR, and \fB\-foreground\fR options for the \fBsel\fR
|
685 |
|
|
tag: changes in either will automatically be reflected in the
|
686 |
|
|
other.
|
687 |
|
|
|
688 |
|
|
.SH THE INSERTION CURSOR
|
689 |
|
|
.PP
|
690 |
|
|
The mark named \fBinsert\fR has special significance in text widgets.
|
691 |
|
|
It is defined automatically when a text widget is created and it
|
692 |
|
|
may not be unset with the ``\fIpathName \fBmark unset\fR'' widget
|
693 |
|
|
command.
|
694 |
|
|
The \fBinsert\fR mark represents the position of the insertion
|
695 |
|
|
cursor, and the insertion cursor will automatically be drawn at
|
696 |
|
|
this point whenever the text widget has the input focus.
|
697 |
|
|
|
698 |
|
|
.SH "WIDGET COMMAND"
|
699 |
|
|
.PP
|
700 |
|
|
The \fBtext\fR command creates a new Tcl command whose
|
701 |
|
|
name is the same as the path name of the text's window. This
|
702 |
|
|
command may be used to invoke various
|
703 |
|
|
operations on the widget. It has the following general form:
|
704 |
|
|
.CS
|
705 |
|
|
\fIpathName option \fR?\fIarg arg ...\fR?
|
706 |
|
|
.CE
|
707 |
|
|
\fIPathName\fR is the name of the command, which is the same as
|
708 |
|
|
the text widget's path name. \fIOption\fR and the \fIarg\fRs
|
709 |
|
|
determine the exact behavior of the command. The following
|
710 |
|
|
commands are possible for text widgets:
|
711 |
|
|
.TP
|
712 |
|
|
\fIpathName \fBbbox \fIindex\fR
|
713 |
|
|
Returns a list of four elements describing the screen area
|
714 |
|
|
of the character given by \fIindex\fR.
|
715 |
|
|
The first two elements of the list give the x and y coordinates
|
716 |
|
|
of the upper-left corner of the area occupied by the
|
717 |
|
|
character, and the last two elements give the width and height
|
718 |
|
|
of the area.
|
719 |
|
|
If the character is only partially visible on the screen, then
|
720 |
|
|
the return value reflects just the visible part.
|
721 |
|
|
If the character is not visible on the screen then the return
|
722 |
|
|
value is an empty list.
|
723 |
|
|
.TP
|
724 |
|
|
\fIpathName \fBcget\fR \fIoption\fR
|
725 |
|
|
Returns the current value of the configuration option given
|
726 |
|
|
by \fIoption\fR.
|
727 |
|
|
\fIOption\fR may have any of the values accepted by the \fBtext\fR
|
728 |
|
|
command.
|
729 |
|
|
.TP
|
730 |
|
|
\fIpathName \fBcompare\fR \fIindex1 op index2\fR
|
731 |
|
|
Compares the indices given by \fIindex1\fR and \fIindex2\fR according
|
732 |
|
|
to the relational operator given by \fIop\fR, and returns 1 if
|
733 |
|
|
the relationship is satisfied and 0 if it isn't.
|
734 |
|
|
\fIOp\fR must be one of the operators <, <=, ==, >=, >, or !=.
|
735 |
|
|
If \fIop\fR is == then 1 is returned if the two indices refer to
|
736 |
|
|
the same character, if \fIop\fR is < then 1 is returned if \fIindex1\fR
|
737 |
|
|
refers to an earlier character in the text than \fIindex2\fR, and
|
738 |
|
|
so on.
|
739 |
|
|
.TP
|
740 |
|
|
\fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR?
|
741 |
|
|
Query or modify the configuration options of the widget.
|
742 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
743 |
|
|
the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
|
744 |
|
|
information on the format of this list). If \fIoption\fR is specified
|
745 |
|
|
with no \fIvalue\fR, then the command returns a list describing the
|
746 |
|
|
one named option (this list will be identical to the corresponding
|
747 |
|
|
sublist of the value returned if no \fIoption\fR is specified). If
|
748 |
|
|
one or more \fIoption\-value\fR pairs are specified, then the command
|
749 |
|
|
modifies the given widget option(s) to have the given value(s); in
|
750 |
|
|
this case the command returns an empty string.
|
751 |
|
|
\fIOption\fR may have any of the values accepted by the \fBtext\fR
|
752 |
|
|
command.
|
753 |
|
|
.TP
|
754 |
|
|
\fIpathName \fBdebug \fR?\fIboolean\fR?
|
755 |
|
|
If \fIboolean\fR is specified, then it must have one of the true or
|
756 |
|
|
false values accepted by Tcl_GetBoolean.
|
757 |
|
|
If the value is a true one then internal consistency checks will be
|
758 |
|
|
turned on in the B-tree code associated with text widgets.
|
759 |
|
|
If \fIboolean\fR has a false value then the debugging checks will
|
760 |
|
|
be turned off.
|
761 |
|
|
In either case the command returns an empty string.
|
762 |
|
|
If \fIboolean\fR is not specified then the command returns \fBon\fR
|
763 |
|
|
or \fBoff\fR to indicate whether or not debugging is turned on.
|
764 |
|
|
There is a single debugging switch shared by all text widgets: turning
|
765 |
|
|
debugging on or off in any widget turns it on or off for all widgets.
|
766 |
|
|
For widgets with large amounts of text, the consistency checks may
|
767 |
|
|
cause a noticeable slow-down.
|
768 |
|
|
.TP
|
769 |
|
|
\fIpathName \fBdelete \fIindex1 \fR?\fIindex2\fR?
|
770 |
|
|
Delete a range of characters from the text.
|
771 |
|
|
If both \fIindex1\fR and \fIindex2\fR are specified, then delete
|
772 |
|
|
all the characters starting with the one given by \fIindex1\fR
|
773 |
|
|
and stopping just before \fIindex2\fR (i.e. the character at
|
774 |
|
|
\fIindex2\fR is not deleted).
|
775 |
|
|
If \fIindex2\fR doesn't specify a position later in the text
|
776 |
|
|
than \fIindex1\fR then no characters are deleted.
|
777 |
|
|
If \fIindex2\fR isn't specified then the single character at
|
778 |
|
|
\fIindex1\fR is deleted.
|
779 |
|
|
It is not allowable to delete characters in a way that would leave
|
780 |
|
|
the text without a newline as the last character.
|
781 |
|
|
The command returns an empty string.
|
782 |
|
|
.TP
|
783 |
|
|
\fIpathName \fBdlineinfo \fIindex\fR
|
784 |
|
|
Returns a list with five elements describing the area occupied
|
785 |
|
|
by the display line containing \fIindex\fR.
|
786 |
|
|
The first two elements of the list give the x and y coordinates
|
787 |
|
|
of the upper-left corner of the area occupied by the
|
788 |
|
|
line, the third and fourth elements give the width and height
|
789 |
|
|
of the area, and the fifth element gives the position of the baseline
|
790 |
|
|
for the line, measured down from the top of the area.
|
791 |
|
|
All of this information is measured in pixels.
|
792 |
|
|
If the current wrap mode is \fBnone\fR and the line extends beyond
|
793 |
|
|
the boundaries of the window,
|
794 |
|
|
the area returned reflects the entire area of the line, including the
|
795 |
|
|
portions that are out of the window.
|
796 |
|
|
If the line is shorter than the full width of the window then the
|
797 |
|
|
area returned reflects just the portion of the line that is occupied
|
798 |
|
|
by characters and embedded windows.
|
799 |
|
|
If the display line containing \fIindex\fR is not visible on
|
800 |
|
|
the screen then the return value is an empty list.
|
801 |
|
|
.TP
|
802 |
|
|
\fIpathName \fBdump \fR?\fIswitches\fR? \fIindex1 \fR?\fIindex2\fR?
|
803 |
|
|
Return the contents of the text widget from \fIindex1\fR up to,
|
804 |
|
|
but not including \fIindex2\fR,
|
805 |
|
|
including the text and
|
806 |
|
|
information about marks, tags, and embedded windows.
|
807 |
|
|
If \fIindex2\fR is not specified, then it defaults to
|
808 |
|
|
one character past \fIindex1\fR. The information is returned
|
809 |
|
|
in the following format:
|
810 |
|
|
.LP
|
811 |
|
|
.RS
|
812 |
|
|
\fIkey1 value1 index1 key2 value2 index2\fR ...
|
813 |
|
|
.LP
|
814 |
|
|
The possible \fIkey\fP values are \fBtext\fP, \fBmark\fP,
|
815 |
|
|
\fBtagon\fP, \fBtagoff\fP, and \fBwindow\fP. The corresponding
|
816 |
|
|
\fIvalue\fP is the text, mark name, tag name, or window name.
|
817 |
|
|
The \fIindex\fP information is the index of the
|
818 |
|
|
start of the text, the mark, the tag transition, or the window.
|
819 |
|
|
One or more of the following switches (or abbreviations thereof)
|
820 |
|
|
may be specified to control the dump:
|
821 |
|
|
.TP
|
822 |
|
|
\fB\-all\fR
|
823 |
|
|
Return information about all elements: text, marks, tags, and windows.
|
824 |
|
|
This is the default.
|
825 |
|
|
.TP
|
826 |
|
|
\fB\-command \fIcommand\fR
|
827 |
|
|
Instead of returning the information as the result of the dump operation,
|
828 |
|
|
invoke the \fIcommand\fR on each element of the text widget within the range.
|
829 |
|
|
The command has three arguments appended to it before it is evaluated:
|
830 |
|
|
the \fIkey\fP, \fIvalue\fP, and \fIindex\fP.
|
831 |
|
|
.TP
|
832 |
|
|
\fB\-mark\fR
|
833 |
|
|
Include information about marks in the dump results.
|
834 |
|
|
.TP
|
835 |
|
|
\fB\-tag\fR
|
836 |
|
|
Include information about tag transitions in the dump results. Tag information is
|
837 |
|
|
returned as \fBtagon\fP and \fBtagoff\fP elements that indicate the
|
838 |
|
|
begin and end of each range of each tag, respectively.
|
839 |
|
|
.TP
|
840 |
|
|
\fB\-text\fR
|
841 |
|
|
Include information about text in the dump results. The value is the
|
842 |
|
|
text up to the next element or the end of range indicated by \fIindex2\fR.
|
843 |
|
|
A text element does not span newlines. A multi-line block of text that
|
844 |
|
|
contains no marks or tag transitions will still be dumped as a set
|
845 |
|
|
of text seqments that each end with a newline. The newline is part
|
846 |
|
|
of the value.
|
847 |
|
|
.TP
|
848 |
|
|
\fB\-window\fR
|
849 |
|
|
Include information about embedded windows in the dump results.
|
850 |
|
|
The value of a window is its Tk pathname, unless the window
|
851 |
|
|
has not been created yet. (It must have a create script.)
|
852 |
|
|
In this case an empty string is returned, and you must query the
|
853 |
|
|
window by its index position to get more information.
|
854 |
|
|
.RE
|
855 |
|
|
.TP
|
856 |
|
|
\fIpathName \fBget \fIindex1 \fR?\fIindex2\fR?
|
857 |
|
|
Return a range of characters from the text.
|
858 |
|
|
The return value will be all the characters in the text starting
|
859 |
|
|
with the one whose index is \fIindex1\fR and ending just before
|
860 |
|
|
the one whose index is \fIindex2\fR (the character at \fIindex2\fR
|
861 |
|
|
will not be returned).
|
862 |
|
|
If \fIindex2\fR is omitted then the single character at \fIindex1\fR
|
863 |
|
|
is returned.
|
864 |
|
|
If there are no characters in the specified range (e.g. \fIindex1\fR
|
865 |
|
|
is past the end of the file or \fIindex2\fR is less than or equal
|
866 |
|
|
to \fIindex1\fR) then an empty string is returned.
|
867 |
|
|
If the specified range contains embedded windows, no information
|
868 |
|
|
about them is included in the returned string.
|
869 |
|
|
.TP
|
870 |
|
|
\fIpathName \fBimage \fIoption \fR?\fIarg arg ...\fR?
|
871 |
|
|
This command is used to manipulate embedded images.
|
872 |
|
|
The behavior of the command depends on the \fIoption\fR argument
|
873 |
|
|
that follows the \fBtag\fR argument.
|
874 |
|
|
The following forms of the command are currently supported:
|
875 |
|
|
.RS
|
876 |
|
|
.TP
|
877 |
|
|
\fIpathName \fBimage cget\fR \fIindex option\fR
|
878 |
|
|
Returns the value of a configuration option for an embedded image.
|
879 |
|
|
\fIIndex\fR identifies the embedded image, and \fIoption\fR
|
880 |
|
|
specifies a particular configuration option, which must be one of
|
881 |
|
|
the ones listed in the section EMBEDDED IMAGES.
|
882 |
|
|
.TP
|
883 |
|
|
\fIpathName \fBimage configure \fIindex\fR ?\fIoption value ...\fR?
|
884 |
|
|
Query or modify the configuration options for an embedded image.
|
885 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
886 |
|
|
the available options for the embedded image at \fIindex\fR
|
887 |
|
|
(see \fBTk_ConfigureInfo\fR for information on the format of this list).
|
888 |
|
|
If \fIoption\fR is specified with no \fIvalue\fR, then the command
|
889 |
|
|
returns a list describing the one named option (this list will be
|
890 |
|
|
identical to the corresponding sublist of the value returned if no
|
891 |
|
|
\fIoption\fR is specified).
|
892 |
|
|
If one or more \fIoption\-value\fR pairs are specified, then the command
|
893 |
|
|
modifies the given option(s) to have the given value(s); in
|
894 |
|
|
this case the command returns an empty string.
|
895 |
|
|
See EMBEDDED IMAGES for information on the options that
|
896 |
|
|
are supported.
|
897 |
|
|
.TP
|
898 |
|
|
\fIpathName \fBimage create \fIindex\fR ?\fIoption value ...\fR?
|
899 |
|
|
This command creates a new image annotation, which will appear
|
900 |
|
|
in the text at the position given by \fIindex\fR.
|
901 |
|
|
Any number of \fIoption\-value\fR pairs may be specified to
|
902 |
|
|
configure the annotation.
|
903 |
|
|
Returns a unique identifier that may be used as an index to refer to
|
904 |
|
|
this image.
|
905 |
|
|
See EMBEDDED IMAGES for information on the options that
|
906 |
|
|
are supported, and a description of the identifier returned.
|
907 |
|
|
.TP
|
908 |
|
|
\fIpathName \fBimage names\fR
|
909 |
|
|
Returns a list whose elements are the names of all image instances currently
|
910 |
|
|
embedded in \fIwindow\fR.
|
911 |
|
|
.RE
|
912 |
|
|
.TP
|
913 |
|
|
\fIpathName \fBindex \fIindex\fR
|
914 |
|
|
Returns the position corresponding to \fIindex\fR in the form
|
915 |
|
|
\fIline.char\fR where \fIline\fR is the line number and \fIchar\fR
|
916 |
|
|
is the character number.
|
917 |
|
|
\fIIndex\fR may have any of the forms described under INDICES above.
|
918 |
|
|
.TP
|
919 |
|
|
\fIpathName \fBinsert \fIindex chars \fR?\fItagList chars tagList ...\fR?
|
920 |
|
|
Inserts all of the \fIchars\fR arguments just before the character at
|
921 |
|
|
\fIindex\fR.
|
922 |
|
|
If \fIindex\fR refers to the end of the text (the character after
|
923 |
|
|
the last newline) then the new text is inserted just before the
|
924 |
|
|
last newline instead.
|
925 |
|
|
If there is a single \fIchars\fR argument and no \fItagList\fR, then
|
926 |
|
|
the new text will receive any tags that are present on both the
|
927 |
|
|
character before and the character after the insertion point; if a tag
|
928 |
|
|
is present on only one of these characters then it will not be
|
929 |
|
|
applied to the new text.
|
930 |
|
|
If \fItagList\fR is specified then it consists of a list of
|
931 |
|
|
tag names; the new characters will receive all of the tags in
|
932 |
|
|
this list and no others, regardless of the tags present around
|
933 |
|
|
the insertion point.
|
934 |
|
|
If multiple \fIchars\fR\-\fItagList\fR argument pairs are present,
|
935 |
|
|
they produce the same effect as if a separate \fBinsert\fR widget
|
936 |
|
|
command had been issued for each pair, in order.
|
937 |
|
|
The last \fItagList\fR argument may be omitted.
|
938 |
|
|
.TP
|
939 |
|
|
\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?
|
940 |
|
|
This command is used to manipulate marks. The exact behavior of
|
941 |
|
|
the command depends on the \fIoption\fR argument that follows
|
942 |
|
|
the \fBmark\fR argument. The following forms of the command
|
943 |
|
|
are currently supported:
|
944 |
|
|
.RS
|
945 |
|
|
.TP
|
946 |
|
|
\fIpathName \fBmark gravity \fImarkName\fR ?\fIdirection\fR?
|
947 |
|
|
If \fIdirection\fR is not specified, returns \fBleft\fR or \fBright\fR
|
948 |
|
|
to indicate which of its adjacent characters \fImarkName\fR is attached
|
949 |
|
|
to.
|
950 |
|
|
If \fIdirection\fR is specified, it must be \fBleft\fR or \fBright\fR;
|
951 |
|
|
the gravity of \fImarkName\fR is set to the given value.
|
952 |
|
|
.TP
|
953 |
|
|
\fIpathName \fBmark names\fR
|
954 |
|
|
Returns a list whose elements are the names of all the marks that
|
955 |
|
|
are currently set.
|
956 |
|
|
.TP
|
957 |
|
|
\fIpathName \fBmark next \fIindex\fR
|
958 |
|
|
Returns the name of the next mark at or after \fIindex\fR.
|
959 |
|
|
If \fIindex\fR is specified in numerical form, then the search for
|
960 |
|
|
the next mark begins at that index.
|
961 |
|
|
If \fIindex\fR is the name of a mark, then the search for
|
962 |
|
|
the next mark begins immediately after that mark.
|
963 |
|
|
This can still return a mark at the same position if
|
964 |
|
|
there are multiple marks at the same index.
|
965 |
|
|
These semantics mean that the \fBmark next\fP operation can be used to
|
966 |
|
|
step through all the marks in a text widget in the same order
|
967 |
|
|
as the mark information returned by the \fBdump\fP operation.
|
968 |
|
|
If a mark has been set to the special \fBend\fP index,
|
969 |
|
|
then it appears to be \fIafter\fP \fBend\fP with respect to the \fBmark next\fP operation.
|
970 |
|
|
An empty string is returned if there are no marks after \fIindex\fR.
|
971 |
|
|
.TP
|
972 |
|
|
\fIpathName \fBmark previous \fIindex\fR
|
973 |
|
|
Returns the name of the mark at or before \fIindex\fR.
|
974 |
|
|
If \fIindex\fR is specified in numerical form, then the search for
|
975 |
|
|
the previous mark begins with the character just before that index.
|
976 |
|
|
If \fIindex\fR is the name of a mark, then the search for
|
977 |
|
|
the next mark begins immediately before that mark.
|
978 |
|
|
This can still return a mark at the same position if
|
979 |
|
|
there are multiple marks at the same index.
|
980 |
|
|
These semantics mean that the \fBmark previous\fP operation can be used to
|
981 |
|
|
step through all the marks in a text widget in the reverse order
|
982 |
|
|
as the mark information returned by the \fBdump\fP operation.
|
983 |
|
|
An empty string is returned if there are no marks before \fIindex\fR.
|
984 |
|
|
.TP
|
985 |
|
|
\fIpathName \fBmark set \fImarkName index\fR
|
986 |
|
|
Sets the mark named \fImarkName\fR to a position just before the
|
987 |
|
|
character at \fIindex\fR.
|
988 |
|
|
If \fImarkName\fR already exists, it is moved from its old position;
|
989 |
|
|
if it doesn't exist, a new mark is created.
|
990 |
|
|
This command returns an empty string.
|
991 |
|
|
.TP
|
992 |
|
|
\fIpathName \fBmark unset \fImarkName \fR?\fImarkName markName ...\fR?
|
993 |
|
|
Remove the mark corresponding to each of the \fImarkName\fR arguments.
|
994 |
|
|
The removed marks will not be usable in indices and will not be
|
995 |
|
|
returned by future calls to ``\fIpathName \fBmark names\fR''.
|
996 |
|
|
This command returns an empty string.
|
997 |
|
|
.RE
|
998 |
|
|
.TP
|
999 |
|
|
\fIpathName \fBscan\fR \fIoption args\fR
|
1000 |
|
|
This command is used to implement scanning on texts. It has
|
1001 |
|
|
two forms, depending on \fIoption\fR:
|
1002 |
|
|
.RS
|
1003 |
|
|
.TP
|
1004 |
|
|
\fIpathName \fBscan mark \fIx y\fR
|
1005 |
|
|
Records \fIx\fR and \fIy\fR and the current view in the text window,
|
1006 |
|
|
for use in conjunction with later \fBscan dragto\fR commands.
|
1007 |
|
|
Typically this command is associated with a mouse button press in
|
1008 |
|
|
the widget. It returns an empty string.
|
1009 |
|
|
.TP
|
1010 |
|
|
\fIpathName \fBscan dragto \fIx y\fR
|
1011 |
|
|
This command computes the difference between its \fIx\fR and \fIy\fR
|
1012 |
|
|
arguments and the \fIx\fR and \fIy\fR arguments to the last
|
1013 |
|
|
\fBscan mark\fR command for the widget.
|
1014 |
|
|
It then adjusts the view by 10 times the difference in coordinates.
|
1015 |
|
|
This command is typically associated
|
1016 |
|
|
with mouse motion events in the widget, to produce the effect of
|
1017 |
|
|
dragging the text at high speed through the window. The return
|
1018 |
|
|
value is an empty string.
|
1019 |
|
|
.RE
|
1020 |
|
|
.TP
|
1021 |
|
|
\fIpathName \fBsearch \fR?\fIswitches\fR? \fIpattern index \fR?\fIstopIndex\fR?
|
1022 |
|
|
Searches the text in \fIpathName\fR starting at \fIindex\fR for a range
|
1023 |
|
|
of characters that matches \fIpattern\fR.
|
1024 |
|
|
If a match is found, the index of the first character in the match is
|
1025 |
|
|
returned as result; otherwise an empty string is returned.
|
1026 |
|
|
One or more of the following switches (or abbreviations thereof)
|
1027 |
|
|
may be specified to control the search:
|
1028 |
|
|
.RS
|
1029 |
|
|
.TP
|
1030 |
|
|
\fB\-forwards\fR
|
1031 |
|
|
The search will proceed forward through the text, finding the first
|
1032 |
|
|
matching range starting at or after the position given by \fIindex\fR.
|
1033 |
|
|
This is the default.
|
1034 |
|
|
.TP
|
1035 |
|
|
\fB\-backwards\fR
|
1036 |
|
|
The search will proceed backward through the text, finding the
|
1037 |
|
|
matching range closest to \fIindex\fR whose first character
|
1038 |
|
|
is before \fIindex\fR.
|
1039 |
|
|
.TP
|
1040 |
|
|
\fB\-exact\fR
|
1041 |
|
|
Use exact matching: the characters in the matching range must be
|
1042 |
|
|
identical to those in \fIpattern\fR.
|
1043 |
|
|
This is the default.
|
1044 |
|
|
.TP
|
1045 |
|
|
\fB\-regexp\fR
|
1046 |
|
|
Treat \fIpattern\fR as a regular expression and match it against
|
1047 |
|
|
the text using the rules for regular expressions (see the \fBregexp\fR
|
1048 |
|
|
command for details).
|
1049 |
|
|
.TP
|
1050 |
|
|
\fB\-nocase\fR
|
1051 |
|
|
Ignore case differences between the pattern and the text.
|
1052 |
|
|
.TP
|
1053 |
|
|
\fB\-count\fI varName\fR
|
1054 |
|
|
The argument following \fB\-count\fR gives the name of a variable;
|
1055 |
|
|
if a match is found, the number of characters in the matching
|
1056 |
|
|
range will be stored in the variable.
|
1057 |
|
|
.TP
|
1058 |
|
|
\fB\-\|\-\fR
|
1059 |
|
|
This switch has no effect except to terminate the list of switches:
|
1060 |
|
|
the next argument will be treated as \fIpattern\fR even if it starts
|
1061 |
|
|
with \fB\-\fR.
|
1062 |
|
|
.LP
|
1063 |
|
|
The matching range must be entirely within a single line of text.
|
1064 |
|
|
For regular expression matching the newlines are removed from the ends
|
1065 |
|
|
of the lines before matching: use the \fB$\fR feature in regular
|
1066 |
|
|
expressions to match the end of a line.
|
1067 |
|
|
For exact matching the newlines are retained.
|
1068 |
|
|
If \fIstopIndex\fR is specified, the search stops at that index:
|
1069 |
|
|
for forward searches, no match at or after \fIstopIndex\fR will
|
1070 |
|
|
be considered; for backward searches, no match earlier in the
|
1071 |
|
|
text than \fIstopIndex\fR will be considered.
|
1072 |
|
|
If \fIstopIndex\fR is omitted, the entire text will be searched:
|
1073 |
|
|
when the beginning or end of the text is reached, the search
|
1074 |
|
|
continues at the other end until the starting location is reached
|
1075 |
|
|
again; if \fIstopIndex\fR is specified, no wrap-around will occur.
|
1076 |
|
|
.RE
|
1077 |
|
|
.TP
|
1078 |
|
|
\fIpathName \fBsee \fIindex\fR
|
1079 |
|
|
Adjusts the view in the window so that the character given by \fIindex\fR
|
1080 |
|
|
is completely visible.
|
1081 |
|
|
If \fIindex\fR is already visible then the command does nothing.
|
1082 |
|
|
If \fIindex\fR is a short distance out of view, the command
|
1083 |
|
|
adjusts the view just enough to make \fIindex\fR visible at the
|
1084 |
|
|
edge of the window.
|
1085 |
|
|
If \fIindex\fR is far out of view, then the command centers
|
1086 |
|
|
\fIindex\fR in the window.
|
1087 |
|
|
.TP
|
1088 |
|
|
\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?
|
1089 |
|
|
This command is used to manipulate tags. The exact behavior of the
|
1090 |
|
|
command depends on the \fIoption\fR argument that follows the
|
1091 |
|
|
\fBtag\fR argument. The following forms of the command are currently
|
1092 |
|
|
supported:
|
1093 |
|
|
.RS
|
1094 |
|
|
.TP
|
1095 |
|
|
\fIpathName \fBtag add \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
|
1096 |
|
|
Associate the tag \fItagName\fR with all of the characters starting
|
1097 |
|
|
with \fIindex1\fR and ending just before
|
1098 |
|
|
\fIindex2\fR (the character at \fIindex2\fR isn't tagged).
|
1099 |
|
|
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
|
1100 |
|
|
pairs.
|
1101 |
|
|
If the last \fIindex2\fR is omitted then the single character at
|
1102 |
|
|
\fIindex1\fR is tagged.
|
1103 |
|
|
If there are no characters in the specified range (e.g. \fIindex1\fR
|
1104 |
|
|
is past the end of the file or \fIindex2\fR is less than or equal
|
1105 |
|
|
to \fIindex1\fR) then the command has no effect.
|
1106 |
|
|
.TP
|
1107 |
|
|
\fIpathName \fBtag bind \fItagName\fR ?\fIsequence\fR? ?\fIscript\fR?
|
1108 |
|
|
This command associates \fIscript\fR with the tag given by
|
1109 |
|
|
\fItagName\fR.
|
1110 |
|
|
Whenever the event sequence given by \fIsequence\fR occurs for a
|
1111 |
|
|
character that has been tagged with \fItagName\fR,
|
1112 |
|
|
the script will be invoked.
|
1113 |
|
|
This widget command is similar to the \fBbind\fR command except that
|
1114 |
|
|
it operates on characters in a text rather than entire widgets.
|
1115 |
|
|
See the \fBbind\fR manual entry for complete details
|
1116 |
|
|
on the syntax of \fIsequence\fR and the substitutions performed
|
1117 |
|
|
on \fIscript\fR before invoking it.
|
1118 |
|
|
If all arguments are specified then a new binding is created, replacing
|
1119 |
|
|
any existing binding for the same \fIsequence\fR and \fItagName\fR
|
1120 |
|
|
(if the first character of \fIscript\fR is ``+'' then \fIscript\fR
|
1121 |
|
|
augments an existing binding rather than replacing it).
|
1122 |
|
|
In this case the return value is an empty string.
|
1123 |
|
|
If \fIscript\fR is omitted then the command returns the \fIscript\fR
|
1124 |
|
|
associated with \fItagName\fR and \fIsequence\fR (an error occurs
|
1125 |
|
|
if there is no such binding).
|
1126 |
|
|
If both \fIscript\fR and \fIsequence\fR are omitted then the command
|
1127 |
|
|
returns a list of all the sequences for which bindings have been
|
1128 |
|
|
defined for \fItagName\fR.
|
1129 |
|
|
.RS
|
1130 |
|
|
.PP
|
1131 |
|
|
.VS
|
1132 |
|
|
The only events for which bindings may be specified are those related
|
1133 |
|
|
to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
|
1134 |
|
|
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
|
1135 |
|
|
Event bindings for a text widget use the \fBcurrent\fR mark described
|
1136 |
|
|
under MARKS above. An \fBEnter\fR event triggers for a tag when the tag
|
1137 |
|
|
first becomes present on the current character, and a \fBLeave\fR event
|
1138 |
|
|
triggers for a tag when it ceases to be present on the current character.
|
1139 |
|
|
\fBEnter\fR and \fBLeave\fR events can happen either because the
|
1140 |
|
|
\fBcurrent\fR mark moved or because the character at that position
|
1141 |
|
|
changed. Note that these events are different than \fBEnter\fR and
|
1142 |
|
|
\fBLeave\fR events for windows. Mouse and keyboard events are directed
|
1143 |
|
|
to the current character. If a virtual event is used in a binding, that
|
1144 |
|
|
binding can trigger only if the virtual event is defined by an underlying
|
1145 |
|
|
mouse-related or keyboard-related event.
|
1146 |
|
|
.VE
|
1147 |
|
|
.PP
|
1148 |
|
|
It is possible for the current character to have multiple tags,
|
1149 |
|
|
and for each of them to have a binding for a particular event
|
1150 |
|
|
sequence.
|
1151 |
|
|
When this occurs, one binding is invoked for each tag, in order
|
1152 |
|
|
from lowest-priority to highest priority.
|
1153 |
|
|
If there are multiple matching bindings for a single tag, then
|
1154 |
|
|
the most specific binding is chosen (see the manual entry for
|
1155 |
|
|
the \fBbind\fR command for details).
|
1156 |
|
|
\fBcontinue\fR and \fBbreak\fR commands within binding scripts
|
1157 |
|
|
are processed in the same way as for bindings created with
|
1158 |
|
|
the \fBbind\fR command.
|
1159 |
|
|
.PP
|
1160 |
|
|
If bindings are created for the widget as a whole using the
|
1161 |
|
|
\fBbind\fR command, then those bindings will supplement the
|
1162 |
|
|
tag bindings.
|
1163 |
|
|
The tag bindings will be invoked first, followed by bindings
|
1164 |
|
|
for the window as a whole.
|
1165 |
|
|
.RE
|
1166 |
|
|
.TP
|
1167 |
|
|
\fIpathName \fBtag cget\fR \fItagName option\fR
|
1168 |
|
|
This command returns the current value of the option named \fIoption\fR
|
1169 |
|
|
associated with the tag given by \fItagName\fR.
|
1170 |
|
|
\fIOption\fR may have any of the values accepted by the \fBtag configure\fR
|
1171 |
|
|
widget command.
|
1172 |
|
|
.TP
|
1173 |
|
|
\fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
|
1174 |
|
|
This command is similar to the \fBconfigure\fR widget command except
|
1175 |
|
|
that it modifies options associated with the tag given by \fItagName\fR
|
1176 |
|
|
instead of modifying options for the overall text widget.
|
1177 |
|
|
If no \fIoption\fR is specified, the command returns a list describing
|
1178 |
|
|
all of the available options for \fItagName\fR (see \fBTk_ConfigureInfo\fR
|
1179 |
|
|
for information on the format of this list).
|
1180 |
|
|
If \fIoption\fR is specified with no \fIvalue\fR, then the command returns
|
1181 |
|
|
a list describing the one named option (this list will be identical to
|
1182 |
|
|
the corresponding sublist of the value returned if no \fIoption\fR
|
1183 |
|
|
is specified).
|
1184 |
|
|
If one or more \fIoption\-value\fR pairs are specified, then the command
|
1185 |
|
|
modifies the given option(s) to have the given value(s) in \fItagName\fR;
|
1186 |
|
|
in this case the command returns an empty string.
|
1187 |
|
|
See TAGS above for details on the options available for tags.
|
1188 |
|
|
.TP
|
1189 |
|
|
\fIpathName \fBtag delete \fItagName \fR?\fItagName ...\fR?
|
1190 |
|
|
Deletes all tag information for each of the \fItagName\fR
|
1191 |
|
|
arguments.
|
1192 |
|
|
The command removes the tags from all characters in the file
|
1193 |
|
|
and also deletes any other information associated with the tags,
|
1194 |
|
|
such as bindings and display information.
|
1195 |
|
|
The command returns an empty string.
|
1196 |
|
|
.TP
|
1197 |
|
|
\fIpathName\fB tag lower \fItagName \fR?\fIbelowThis\fR?
|
1198 |
|
|
Changes the priority of tag \fItagName\fR so that it is just lower
|
1199 |
|
|
in priority than the tag whose name is \fIbelowThis\fR.
|
1200 |
|
|
If \fIbelowThis\fR is omitted, then \fItagName\fR's priority
|
1201 |
|
|
is changed to make it lowest priority of all tags.
|
1202 |
|
|
.TP
|
1203 |
|
|
\fIpathName \fBtag names \fR?\fIindex\fR?
|
1204 |
|
|
Returns a list whose elements are the names of all the tags that
|
1205 |
|
|
are active at the character position given by \fIindex\fR.
|
1206 |
|
|
If \fIindex\fR is omitted, then the return value will describe
|
1207 |
|
|
all of the tags that exist for the text (this includes all tags
|
1208 |
|
|
that have been named in a ``\fIpathName \fBtag\fR'' widget
|
1209 |
|
|
command but haven't been deleted by a ``\fIpathName \fBtag delete\fR''
|
1210 |
|
|
widget command, even if no characters are currently marked with
|
1211 |
|
|
the tag).
|
1212 |
|
|
The list will be sorted in order from lowest priority to highest
|
1213 |
|
|
priority.
|
1214 |
|
|
.TP
|
1215 |
|
|
\fIpathName \fBtag nextrange \fItagName index1 \fR?\fIindex2\fR?
|
1216 |
|
|
This command searches the text for a range of characters tagged
|
1217 |
|
|
with \fItagName\fR where the first character of the range is
|
1218 |
|
|
no earlier than the character at \fIindex1\fR and no later than
|
1219 |
|
|
the character just before \fIindex2\fR (a range starting at
|
1220 |
|
|
\fIindex2\fR will not be considered).
|
1221 |
|
|
If several matching ranges exist, the first one is chosen.
|
1222 |
|
|
The command's return value is a list containing
|
1223 |
|
|
two elements, which are the index of the first character of the
|
1224 |
|
|
range and the index of the character just after the last one in
|
1225 |
|
|
the range.
|
1226 |
|
|
If no matching range is found then the return value is an
|
1227 |
|
|
empty string.
|
1228 |
|
|
If \fIindex2\fR is not given then it defaults to the end of the text.
|
1229 |
|
|
.TP
|
1230 |
|
|
\fIpathName \fBtag prevrange \fItagName index1 \fR?\fIindex2\fR?
|
1231 |
|
|
This command searches the text for a range of characters tagged
|
1232 |
|
|
with \fItagName\fR where the first character of the range is
|
1233 |
|
|
before the character at \fIindex1\fR and no earlier than
|
1234 |
|
|
the character at \fIindex2\fR (a range starting at
|
1235 |
|
|
\fIindex2\fR will be considered).
|
1236 |
|
|
If several matching ranges exist, the one closest to \fIindex1\fR is chosen.
|
1237 |
|
|
The command's return value is a list containing
|
1238 |
|
|
two elements, which are the index of the first character of the
|
1239 |
|
|
range and the index of the character just after the last one in
|
1240 |
|
|
the range.
|
1241 |
|
|
If no matching range is found then the return value is an
|
1242 |
|
|
empty string.
|
1243 |
|
|
If \fIindex2\fR is not given then it defaults to the beginning of the text.
|
1244 |
|
|
.TP
|
1245 |
|
|
\fIpathName\fB tag raise \fItagName \fR?\fIaboveThis\fR?
|
1246 |
|
|
Changes the priority of tag \fItagName\fR so that it is just higher
|
1247 |
|
|
in priority than the tag whose name is \fIaboveThis\fR.
|
1248 |
|
|
If \fIaboveThis\fR is omitted, then \fItagName\fR's priority
|
1249 |
|
|
is changed to make it highest priority of all tags.
|
1250 |
|
|
.TP
|
1251 |
|
|
\fIpathName \fBtag ranges \fItagName\fR
|
1252 |
|
|
Returns a list describing all of the ranges of text that have been
|
1253 |
|
|
tagged with \fItagName\fR.
|
1254 |
|
|
The first two elements of the list describe the first tagged range
|
1255 |
|
|
in the text, the next two elements describe the second range, and
|
1256 |
|
|
so on.
|
1257 |
|
|
The first element of each pair contains the index of the first
|
1258 |
|
|
character of the range, and the second element of the pair contains
|
1259 |
|
|
the index of the character just after the last one in the
|
1260 |
|
|
range.
|
1261 |
|
|
If there are no characters tagged with \fItag\fR then an
|
1262 |
|
|
empty string is returned.
|
1263 |
|
|
.TP
|
1264 |
|
|
\fIpathName \fBtag remove \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?
|
1265 |
|
|
Remove the tag \fItagName\fR from all of the characters starting
|
1266 |
|
|
at \fIindex1\fR and ending just before
|
1267 |
|
|
\fIindex2\fR (the character at \fIindex2\fR isn't affected).
|
1268 |
|
|
A single command may contain any number of \fIindex1\fR\-\fIindex2\fR
|
1269 |
|
|
pairs.
|
1270 |
|
|
If the last \fIindex2\fR is omitted then the single character at
|
1271 |
|
|
\fIindex1\fR is tagged.
|
1272 |
|
|
If there are no characters in the specified range (e.g. \fIindex1\fR
|
1273 |
|
|
is past the end of the file or \fIindex2\fR is less than or equal
|
1274 |
|
|
to \fIindex1\fR) then the command has no effect.
|
1275 |
|
|
This command returns an empty string.
|
1276 |
|
|
.RE
|
1277 |
|
|
.TP
|
1278 |
|
|
\fIpathName \fBwindow \fIoption \fR?\fIarg arg ...\fR?
|
1279 |
|
|
This command is used to manipulate embedded windows.
|
1280 |
|
|
The behavior of the command depends on the \fIoption\fR argument
|
1281 |
|
|
that follows the \fBtag\fR argument.
|
1282 |
|
|
The following forms of the command are currently supported:
|
1283 |
|
|
.RS
|
1284 |
|
|
.TP
|
1285 |
|
|
\fIpathName \fBwindow cget\fR \fIindex option\fR
|
1286 |
|
|
Returns the value of a configuration option for an embedded window.
|
1287 |
|
|
\fIIndex\fR identifies the embedded window, and \fIoption\fR
|
1288 |
|
|
specifies a particular configuration option, which must be one of
|
1289 |
|
|
the ones listed in the section EMBEDDED WINDOWS.
|
1290 |
|
|
.TP
|
1291 |
|
|
\fIpathName \fBwindow configure \fIindex\fR ?\fIoption value ...\fR?
|
1292 |
|
|
Query or modify the configuration options for an embedded window.
|
1293 |
|
|
If no \fIoption\fR is specified, returns a list describing all of
|
1294 |
|
|
the available options for the embedded window at \fIindex\fR
|
1295 |
|
|
(see \fBTk_ConfigureInfo\fR for information on the format of this list).
|
1296 |
|
|
If \fIoption\fR is specified with no \fIvalue\fR, then the command
|
1297 |
|
|
returns a list describing the one named option (this list will be
|
1298 |
|
|
identical to the corresponding sublist of the value returned if no
|
1299 |
|
|
\fIoption\fR is specified).
|
1300 |
|
|
If one or more \fIoption\-value\fR pairs are specified, then the command
|
1301 |
|
|
modifies the given option(s) to have the given value(s); in
|
1302 |
|
|
this case the command returns an empty string.
|
1303 |
|
|
See EMBEDDED WINDOWS for information on the options that
|
1304 |
|
|
are supported.
|
1305 |
|
|
.TP
|
1306 |
|
|
\fIpathName \fBwindow create \fIindex\fR ?\fIoption value ...\fR?
|
1307 |
|
|
This command creates a new window annotation, which will appear
|
1308 |
|
|
in the text at the position given by \fIindex\fR.
|
1309 |
|
|
Any number of \fIoption\-value\fR pairs may be specified to
|
1310 |
|
|
configure the annotation.
|
1311 |
|
|
See EMBEDDED WINDOWS for information on the options that
|
1312 |
|
|
are supported.
|
1313 |
|
|
Returns an empty string.
|
1314 |
|
|
.TP
|
1315 |
|
|
\fIpathName \fBwindow names\fR
|
1316 |
|
|
Returns a list whose elements are the names of all windows currently
|
1317 |
|
|
embedded in \fIwindow\fR.
|
1318 |
|
|
.RE
|
1319 |
|
|
.TP
|
1320 |
|
|
\fIpathName \fBxview \fIoption args\fR
|
1321 |
|
|
This command is used to query and change the horizontal position of the
|
1322 |
|
|
text in the widget's window. It can take any of the following
|
1323 |
|
|
forms:
|
1324 |
|
|
.RS
|
1325 |
|
|
.TP
|
1326 |
|
|
\fIpathName \fBxview\fR
|
1327 |
|
|
Returns a list containing two elements.
|
1328 |
|
|
Each element is a real fraction between 0 and 1; together they describe
|
1329 |
|
|
the portion of the document's horizontal span that is visible in
|
1330 |
|
|
the window.
|
1331 |
|
|
For example, if the first element is .2 and the second element is .6,
|
1332 |
|
|
20% of the text is off-screen to the left, the middle 40% is visible
|
1333 |
|
|
in the window, and 40% of the text is off-screen to the right.
|
1334 |
|
|
The fractions refer only to the lines that are actually visible in the
|
1335 |
|
|
window: if the lines in the window are all very short, so that they
|
1336 |
|
|
are entirely visible, the returned fractions will be 0 and 1,
|
1337 |
|
|
even if there are other lines in the text that are
|
1338 |
|
|
much wider than the window.
|
1339 |
|
|
These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
|
1340 |
|
|
option.
|
1341 |
|
|
.TP
|
1342 |
|
|
\fIpathName \fBxview moveto\fI fraction\fR
|
1343 |
|
|
Adjusts the view in the window so that \fIfraction\fR of the horizontal
|
1344 |
|
|
span of the text is off-screen to the left.
|
1345 |
|
|
\fIFraction\fR is a fraction between 0 and 1.
|
1346 |
|
|
.TP
|
1347 |
|
|
\fIpathName \fBxview scroll \fInumber what\fR
|
1348 |
|
|
This command shifts the view in the window left or right according to
|
1349 |
|
|
\fInumber\fR and \fIwhat\fR.
|
1350 |
|
|
\fINumber\fR must be an integer.
|
1351 |
|
|
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
|
1352 |
|
|
of one of these.
|
1353 |
|
|
If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by
|
1354 |
|
|
\fInumber\fR average-width characters on the display; if it is
|
1355 |
|
|
\fBpages\fR then the view adjusts by \fInumber\fR screenfuls.
|
1356 |
|
|
If \fInumber\fR is negative then characters farther to the left
|
1357 |
|
|
become visible; if it is positive then characters farther to the right
|
1358 |
|
|
become visible.
|
1359 |
|
|
.RE
|
1360 |
|
|
.TP
|
1361 |
|
|
\fIpathName \fByview \fI?args\fR?
|
1362 |
|
|
This command is used to query and change the vertical position of the
|
1363 |
|
|
text in the widget's window.
|
1364 |
|
|
It can take any of the following forms:
|
1365 |
|
|
.RS
|
1366 |
|
|
.TP
|
1367 |
|
|
\fIpathName \fByview\fR
|
1368 |
|
|
Returns a list containing two elements, both of which are real fractions
|
1369 |
|
|
between 0 and 1.
|
1370 |
|
|
The first element gives the position of the first character in the
|
1371 |
|
|
top line in the window, relative to the text as a whole (0.5 means
|
1372 |
|
|
it is halfway through the text, for example).
|
1373 |
|
|
The second element gives the position of the character just after
|
1374 |
|
|
the last one in the bottom line of the window,
|
1375 |
|
|
relative to the text as a whole.
|
1376 |
|
|
These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
|
1377 |
|
|
option.
|
1378 |
|
|
.TP
|
1379 |
|
|
\fIpathName \fByview moveto\fI fraction\fR
|
1380 |
|
|
Adjusts the view in the window so that the character given by \fIfraction\fR
|
1381 |
|
|
appears on the top line of the window.
|
1382 |
|
|
\fIFraction\fR is a fraction between 0 and 1; 0 indicates the first
|
1383 |
|
|
character in the text, 0.33 indicates the character one-third the
|
1384 |
|
|
way through the text, and so on.
|
1385 |
|
|
.TP
|
1386 |
|
|
\fIpathName \fByview scroll \fInumber what\fR
|
1387 |
|
|
This command adjust the view in the window up or down according to
|
1388 |
|
|
\fInumber\fR and \fIwhat\fR.
|
1389 |
|
|
\fINumber\fR must be an integer.
|
1390 |
|
|
\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
|
1391 |
|
|
If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by
|
1392 |
|
|
\fInumber\fR lines on the display; if it is \fBpages\fR then
|
1393 |
|
|
the view adjusts by \fInumber\fR screenfuls.
|
1394 |
|
|
If \fInumber\fR is negative then earlier positions in the text
|
1395 |
|
|
become visible; if it is positive then later positions in the text
|
1396 |
|
|
become visible.
|
1397 |
|
|
.TP
|
1398 |
|
|
\fIpathName \fByview \fR?\fB\-pickplace\fR? \fIindex\fR
|
1399 |
|
|
Changes the view in the widget's window to make \fIindex\fR visible.
|
1400 |
|
|
If the \fB\-pickplace\fR option isn't specified then \fIindex\fR will
|
1401 |
|
|
appear at the top of the window.
|
1402 |
|
|
If \fB\-pickplace\fR is specified then the widget chooses where
|
1403 |
|
|
\fIindex\fR appears in the window:
|
1404 |
|
|
.RS
|
1405 |
|
|
.IP [1]
|
1406 |
|
|
If \fIindex\fR is already visible somewhere in the window then the
|
1407 |
|
|
command does nothing.
|
1408 |
|
|
.IP [2]
|
1409 |
|
|
If \fIindex\fR is only a few lines off-screen above the window then
|
1410 |
|
|
it will be positioned at the top of the window.
|
1411 |
|
|
.IP [3]
|
1412 |
|
|
If \fIindex\fR is only a few lines off-screen below the window then
|
1413 |
|
|
it will be positioned at the bottom of the window.
|
1414 |
|
|
.IP [4]
|
1415 |
|
|
Otherwise, \fIindex\fR will be centered in the window.
|
1416 |
|
|
.LP
|
1417 |
|
|
The \fB\-pickplace\fR option has been obsoleted by the \fBsee\fR widget
|
1418 |
|
|
command (\fBsee\fR handles both x- and y-motion to make a location
|
1419 |
|
|
visible, whereas \fB\-pickplace\fR only handles motion in y).
|
1420 |
|
|
.RE
|
1421 |
|
|
.TP
|
1422 |
|
|
\fIpathName \fByview \fInumber\fR
|
1423 |
|
|
This command makes the first character on the line after
|
1424 |
|
|
the one given by \fInumber\fR visible at the top of the window.
|
1425 |
|
|
\fINumber\fR must be an integer.
|
1426 |
|
|
This command used to be used for scrolling, but now it is obsolete.
|
1427 |
|
|
.RE
|
1428 |
|
|
|
1429 |
|
|
.SH BINDINGS
|
1430 |
|
|
.PP
|
1431 |
|
|
Tk automatically creates class bindings for texts that give them
|
1432 |
|
|
the following default behavior.
|
1433 |
|
|
In the descriptions below, ``word'' refers to a contiguous group
|
1434 |
|
|
of letters, digits, or ``_'' characters, or any single character
|
1435 |
|
|
other than these.
|
1436 |
|
|
.IP [1]
|
1437 |
|
|
Clicking mouse button 1 positions the insertion cursor
|
1438 |
|
|
just before the character underneath the mouse cursor, sets the
|
1439 |
|
|
input focus to this widget, and clears any selection in the widget.
|
1440 |
|
|
Dragging with mouse button 1 strokes out a selection between
|
1441 |
|
|
the insertion cursor and the character under the mouse.
|
1442 |
|
|
.IP [2]
|
1443 |
|
|
Double-clicking with mouse button 1 selects the word under the mouse
|
1444 |
|
|
and positions the insertion cursor at the beginning of the word.
|
1445 |
|
|
Dragging after a double click will stroke out a selection consisting
|
1446 |
|
|
of whole words.
|
1447 |
|
|
.IP [3]
|
1448 |
|
|
Triple-clicking with mouse button 1 selects the line under the mouse
|
1449 |
|
|
and positions the insertion cursor at the beginning of the line.
|
1450 |
|
|
Dragging after a triple click will stroke out a selection consisting
|
1451 |
|
|
of whole lines.
|
1452 |
|
|
.IP [4]
|
1453 |
|
|
The ends of the selection can be adjusted by dragging with mouse
|
1454 |
|
|
button 1 while the Shift key is down; this will adjust the end
|
1455 |
|
|
of the selection that was nearest to the mouse cursor when button
|
1456 |
|
|
1 was pressed.
|
1457 |
|
|
If the button is double-clicked before dragging then the selection
|
1458 |
|
|
will be adjusted in units of whole words; if it is triple-clicked
|
1459 |
|
|
then the selection will be adjusted in units of whole lines.
|
1460 |
|
|
.IP [5]
|
1461 |
|
|
Clicking mouse button 1 with the Control key down will reposition the
|
1462 |
|
|
insertion cursor without affecting the selection.
|
1463 |
|
|
.IP [6]
|
1464 |
|
|
If any normal printing characters are typed, they are
|
1465 |
|
|
inserted at the point of the insertion cursor.
|
1466 |
|
|
.IP [7]
|
1467 |
|
|
The view in the widget can be adjusted by dragging with mouse button 2.
|
1468 |
|
|
If mouse button 2 is clicked without moving the mouse, the selection
|
1469 |
|
|
is copied into the text at the position of the mouse cursor.
|
1470 |
|
|
The Insert key also inserts the selection, but at the position of
|
1471 |
|
|
the insertion cursor.
|
1472 |
|
|
.IP [8]
|
1473 |
|
|
If the mouse is dragged out of the widget
|
1474 |
|
|
while button 1 is pressed, the entry will automatically scroll to
|
1475 |
|
|
make more text visible (if there is more text off-screen on the side
|
1476 |
|
|
where the mouse left the window).
|
1477 |
|
|
.IP [9]
|
1478 |
|
|
The Left and Right keys move the insertion cursor one character to the
|
1479 |
|
|
left or right; they also clear any selection in the text.
|
1480 |
|
|
If Left or Right is typed with the Shift key down, then the insertion
|
1481 |
|
|
cursor moves and the selection is extended to include the new character.
|
1482 |
|
|
Control-Left and Control-Right move the insertion cursor by words, and
|
1483 |
|
|
Control-Shift-Left and Control-Shift-Right move the insertion cursor
|
1484 |
|
|
by words and also extend the selection.
|
1485 |
|
|
Control-b and Control-f behave the same as Left and Right, respectively.
|
1486 |
|
|
Meta-b and Meta-f behave the same as Control-Left and Control-Right,
|
1487 |
|
|
respectively.
|
1488 |
|
|
.IP [10]
|
1489 |
|
|
The Up and Down keys move the insertion cursor one line up or
|
1490 |
|
|
down and clear any selection in the text.
|
1491 |
|
|
If Up or Right is typed with the Shift key down, then the insertion
|
1492 |
|
|
cursor moves and the selection is extended to include the new character.
|
1493 |
|
|
Control-Up and Control-Down move the insertion cursor by paragraphs (groups
|
1494 |
|
|
of lines separated by blank lines), and
|
1495 |
|
|
Control-Shift-Up and Control-Shift-Down move the insertion cursor
|
1496 |
|
|
by paragraphs and also extend the selection.
|
1497 |
|
|
Control-p and Control-n behave the same as Up and Down, respectively.
|
1498 |
|
|
.IP [11]
|
1499 |
|
|
The Next and Prior keys move the insertion cursor forward or backwards
|
1500 |
|
|
by one screenful and clear any selection in the text.
|
1501 |
|
|
If the Shift key is held down while Next or Prior is typed, then
|
1502 |
|
|
the selection is extended to include the new character.
|
1503 |
|
|
Control-v moves the view down one screenful without moving the
|
1504 |
|
|
insertion cursor or adjusting the selection.
|
1505 |
|
|
.IP [12]
|
1506 |
|
|
Control-Next and Control-Prior scroll the view right or left by one page
|
1507 |
|
|
without moving the insertion cursor or affecting the selection.
|
1508 |
|
|
.IP [13]
|
1509 |
|
|
Home and Control-a move the insertion cursor to the
|
1510 |
|
|
beginning of its line and clear any selection in the widget.
|
1511 |
|
|
Shift-Home moves the insertion cursor to the beginning of the line
|
1512 |
|
|
and also extends the selection to that point.
|
1513 |
|
|
.IP [14]
|
1514 |
|
|
End and Control-e move the insertion cursor to the
|
1515 |
|
|
end of the line and clear any selection in the widget.
|
1516 |
|
|
Shift-End moves the cursor to the end of the line and extends the selection
|
1517 |
|
|
to that point.
|
1518 |
|
|
.IP [15]
|
1519 |
|
|
Control-Home and Meta-< move the insertion cursor to the beginning of
|
1520 |
|
|
the text and clear any selection in the widget.
|
1521 |
|
|
Control-Shift-Home moves the insertion cursor to the beginning of the text
|
1522 |
|
|
and also extends the selection to that point.
|
1523 |
|
|
.IP [16]
|
1524 |
|
|
Control-End and Meta-> move the insertion cursor to the end of the
|
1525 |
|
|
text and clear any selection in the widget.
|
1526 |
|
|
Control-Shift-End moves the cursor to the end of the text and extends
|
1527 |
|
|
the selection to that point.
|
1528 |
|
|
.IP [17]
|
1529 |
|
|
The Select key and Control-Space set the selection anchor to the position
|
1530 |
|
|
of the insertion cursor. They don't affect the current selection.
|
1531 |
|
|
Shift-Select and Control-Shift-Space adjust the selection to the
|
1532 |
|
|
current position of the insertion cursor, selecting from the anchor
|
1533 |
|
|
to the insertion cursor if there was not any selection previously.
|
1534 |
|
|
.IP [18]
|
1535 |
|
|
Control-/ selects the entire contents of the widget.
|
1536 |
|
|
.IP [19]
|
1537 |
|
|
Control-\e clears any selection in the widget.
|
1538 |
|
|
.IP [20]
|
1539 |
|
|
The F16 key (labelled Copy on many Sun workstations) or Meta-w
|
1540 |
|
|
copies the selection in the widget to the clipboard, if there is a selection.
|
1541 |
|
|
.IP [21]
|
1542 |
|
|
The F20 key (labelled Cut on many Sun workstations) or Control-w
|
1543 |
|
|
copies the selection in the widget to the clipboard and deletes
|
1544 |
|
|
the selection.
|
1545 |
|
|
If there is no selection in the widget then these keys have no effect.
|
1546 |
|
|
.IP [22]
|
1547 |
|
|
The F18 key (labelled Paste on many Sun workstations) or Control-y
|
1548 |
|
|
inserts the contents of the clipboard at the position of the
|
1549 |
|
|
insertion cursor.
|
1550 |
|
|
.IP [23]
|
1551 |
|
|
The Delete key deletes the selection, if there is one in the widget.
|
1552 |
|
|
If there is no selection, it deletes the character to the right of
|
1553 |
|
|
the insertion cursor.
|
1554 |
|
|
.IP [24]
|
1555 |
|
|
Backspace and Control-h delete the selection, if there is one
|
1556 |
|
|
in the widget.
|
1557 |
|
|
If there is no selection, they delete the character to the left of
|
1558 |
|
|
the insertion cursor.
|
1559 |
|
|
.IP [25]
|
1560 |
|
|
Control-d deletes the character to the right of the insertion cursor.
|
1561 |
|
|
.IP [26]
|
1562 |
|
|
Meta-d deletes the word to the right of the insertion cursor.
|
1563 |
|
|
.IP [27]
|
1564 |
|
|
Control-k deletes from the insertion cursor to the end of its line;
|
1565 |
|
|
if the insertion cursor is already at the end of a line, then
|
1566 |
|
|
Control-k deletes the newline character.
|
1567 |
|
|
.IP [28]
|
1568 |
|
|
Control-o opens a new line by inserting a newline character in
|
1569 |
|
|
front of the insertion cursor without moving the insertion cursor.
|
1570 |
|
|
.IP [29]
|
1571 |
|
|
Meta-backspace and Meta-Delete delete the word to the left of the
|
1572 |
|
|
insertion cursor.
|
1573 |
|
|
.IP [30]
|
1574 |
|
|
Control-x deletes whatever is selected in the text widget.
|
1575 |
|
|
.IP [31]
|
1576 |
|
|
Control-t reverses the order of the two characters to the right of
|
1577 |
|
|
the insertion cursor.
|
1578 |
|
|
.PP
|
1579 |
|
|
If the widget is disabled using the \fB\-state\fR option, then its
|
1580 |
|
|
view can still be adjusted and text can still be selected,
|
1581 |
|
|
but no insertion cursor will be displayed and no text modifications will
|
1582 |
|
|
take place.
|
1583 |
|
|
.PP
|
1584 |
|
|
The behavior of texts can be changed by defining new bindings for
|
1585 |
|
|
individual widgets or by redefining the class bindings.
|
1586 |
|
|
|
1587 |
|
|
.SH "PERFORMANCE ISSUES"
|
1588 |
|
|
.PP
|
1589 |
|
|
Text widgets should run efficiently under a variety
|
1590 |
|
|
of conditions. The text widget uses about 2-3 bytes of
|
1591 |
|
|
main memory for each byte of text, so texts containing a megabyte
|
1592 |
|
|
or more should be practical on most workstations.
|
1593 |
|
|
Text is represented internally with a modified B-tree structure
|
1594 |
|
|
that makes operations relatively efficient even with large texts.
|
1595 |
|
|
Tags are included in the B-tree structure in a way that allows
|
1596 |
|
|
tags to span large ranges or have many disjoint smaller ranges
|
1597 |
|
|
without loss of efficiency.
|
1598 |
|
|
Marks are also implemented in a way that allows large numbers of
|
1599 |
|
|
marks.
|
1600 |
|
|
In most cases it is fine to have large numbers of unique tags,
|
1601 |
|
|
or a tag that has many distinct ranges.
|
1602 |
|
|
.PP
|
1603 |
|
|
One performance problem can arise if you have hundreds or thousands
|
1604 |
|
|
of different tags that all have the following characteristics:
|
1605 |
|
|
the first and last ranges of each tag are near the beginning and
|
1606 |
|
|
end of the text, respectively,
|
1607 |
|
|
or a single tag range covers most of the text widget.
|
1608 |
|
|
The cost of adding and deleting tags like this is proportional
|
1609 |
|
|
to the number of other tags with the same properties.
|
1610 |
|
|
In contrast, there is no problem with having thousands of distinct
|
1611 |
|
|
tags if their overall ranges are localized and spread uniformly throughout
|
1612 |
|
|
the text.
|
1613 |
|
|
.PP
|
1614 |
|
|
Very long text lines can be expensive,
|
1615 |
|
|
especially if they have many marks and tags within them.
|
1616 |
|
|
.PP
|
1617 |
|
|
The display line with the insert cursor is redrawn each time the
|
1618 |
|
|
cursor blinks, which causes a steady stream of graphics traffic.
|
1619 |
|
|
Set the \fBinsertOffTime\fP attribute to 0 avoid this.
|
1620 |
|
|
.SH KEYWORDS
|
1621 |
|
|
text, widget
|