OSDN Git Service

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