OSDN Git Service

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