1mNAME0m
       text - Create and manipulate text widgets

1mSYNOPSIS0m
       1mtext 4m22mpathName24m ?4moptions24m?

1mSTANDARD OPTIONS0m
       1m-background           -highlightthickness  -relief0m
       1m-borderwidth          -insertbackground    -selectbackground0m
       1m-cursor               -insertborderwidth   -selectborderwidth0m
       1m-exportselection      -insertofftime       -selectforeground0m
       1m-font                 -insertontime        -setgrid0m
       1m-foreground           -insertwidth         -takefocus0m
       1m-highlightbackground  -padx                -xscrollcommand0m
       1m-highlightcolor       -pady                -yscrollcommand0m

       See the 1moptions 22mmanual entry for details on the standard options.

1mWIDGET-SPECIFIC OPTIONS0m
       Command-Line Name:1m-height0m
       Database Name:  1mheight0m
       Database Class: 1mHeight0m

              Specifies the desired height for the window, in units of charac-
              ters in the font given by the 1m-font 22moption.  Must  be  at  least
              one.

       Command-Line Name:1m-spacing10m
       Database Name:  1mspacing10m
       Database Class: 1mSpacing10m

              Requests  additional  space  above each text line in the widget,
              using any of the standard forms for screen distances.  If a line
              wraps,  this  option  only applies to the first line on the dis-
              play.  This option may be overriden with  1m-spacing1  22moptions  in
              tags.

       Command-Line Name:1m-spacing20m
       Database Name:  1mspacing20m
       Database Class: 1mSpacing20m

              For  lines  that  wrap (so that they cover more than one line on
              the display) this option specifies additional space  to  provide
              between  the display lines that represent a single line of text.
              The value may have any of the standard  forms  for  screen  dis-
              tances.   This option may be overriden with 1m-spacing2 22moptions in
              tags.

       Command-Line Name:1m-spacing30m
       Database Name:  1mspacing30m
       Database Class: 1mSpacing30m

              Requests additional space below each text line  in  the  widget,
              using any of the standard forms for screen distances.  If a line
              wraps, this option only applies to the last line on the display.
              This option may be overriden with 1m-spacing3 22moptions in tags.

       Command-Line Name:1m-state0m
       Database Name:  1mstate0m
       Database Class: 1mState0m

              Specifies  one  of two states for the text:  1mnormal 22mor 1mdisabled22m.
              If the text is disabled then characters may not be  inserted  or
              deleted  and  no insertion cursor will be displayed, even if the
              input focus is in the widget.

       Command-Line Name:1m-tabs0m
       Database Name:  1mtabs0m
       Database Class: 1mTabs0m

              Specifies a set of tab stops for the window.  The option's value
              consists  of  a list of screen distances giving the positions of
              the tab stops.  Each position may optionally be followed in  the
              next list element by one of the keywords 1mleft22m, 1mright22m, 1mcenter22m, or
              1mnumeric22m, which specifies how to justify text relative to the tab
              stop.  1mLeft 22mis the default; it causes the text following the tab
              character to be positioned with its left edge at the  tab  posi-
              tion.  1mRight 22mmeans that the right edge of the text following the
              tab character is positioned at  the  tab  position,  and  1mcenter0m
              means  that  the  text is centered at the tab position.  1mNumeric0m
              means that the decimal point in the text is  positioned  at  the
              tab  position;  if there is no decimal point then the least sig-
              nificant digit of the number is positioned just to the  left  of
              the  tab  position;   if there is no number in the text then the
              text is right-justified at the tab position.  For example, 1m-tabs0m
              1m{2c left 4c 6c center} 22mcreates three tab stops at two-centimeter
              intervals;  the first two use left justification and  the  third
              uses  center  justification.   If the list of tab stops does not
              have enough elements to cover all of the tabs in  a  text  line,
              then  Tk extrapolates new tab stops using the spacing and align-
              ment from the last tab stop in the list.  The value of the  1mtabs0m
              option  may be overridden by 1m-tabs 22moptions in tags.  If no 1m-tabs0m
              option is specified, or if it is specified  as  an  empty  list,
              then  Tk  uses  default  tabs  spaced every eight (average size)
              characters.

       Command-Line Name:1m-width0m
       Database Name:  1mwidth0m
       Database Class: 1mWidth0m

              Specifies the desired width for the window in units  of  charac-
              ters in the font given by the 1m-font 22moption.  If the font doesn't
              have a uniform width then the width of the  character  ``0''  is
              used in translating from character units to screen units.

       Command-Line Name:1m-wrap0m
       Database Name:  1mwrap0m
       Database Class: 1mWrap0m

              Specifies  how  to handle lines in the text that are too long to
              be displayed in a single line of the text's window.   The  value
              must  be  1mnone  22mor 1mchar 22mor 1mword22m.  A wrap mode of 1mnone 22mmeans that
              each line of text appears as exactly one  line  on  the  screen;
              extra characters that don't fit on the screen are not displayed.
              In the other modes each line of text will be broken up into sev-
              eral  screen lines if necessary to keep all the characters visi-
              ble.  In 1mchar 22mmode a screen line break may occur after any char-
              acter;  in  1mword  22mmode  a  line  break will only be made at word
              boundaries.


1mDESCRIPTION0m
       The 1mtext 22mcommand creates a new window (given by the 4mpathName24m  argument)
       and  makes it into a text widget.  Additional options, described above,
       may be specified on the command line or in the option database to  con-
       figure  aspects  of  the  text such as its default background color and
       relief.  The 1mtext 22mcommand returns the path name of the new window.

       A text widget displays one or more lines of text and allows  that  text
       to be edited.  Text widgets support four different kinds of annotations
       on the text, called tags, marks, embedded windows or  embedded  images.
       Tags  allow different portions of the text to be displayed with differ-
       ent fonts and colors.  In addition, Tcl commands can be associated with
       tags  so  that  scripts  are  invoked  when  particular actions such as
       keystrokes and mouse button presses occur in particular ranges  of  the
       text.  See TAGS below for more details.

       The  second  form  of  annotation consists of marks, which are floating
       markers in the text.  Marks are used to keep track of various interest-
       ing  positions  in  the text as it is edited.  See MARKS below for more
       details.

       The third form of annotation allows arbitrary windows to be embedded in
       a text widget.  See EMBEDDED WINDOWS below for more details.

       The fourth form of annotation allows Tk images to be embedded in a text
       widget.  See EMBEDDED IMAGES below for more details.


1mINDICES0m
       Many of the widget commands for texts take one or more indices as argu-
       ments.  An index is a string used to indicate a particular place within
       a text, such as a place to insert characters or one endpoint of a range
       of characters to delete.  Indices have the syntax
              4mbase24m 4mmodifier24m 4mmodifier24m 4mmodifier24m 4m...0m
       Where  4mbase24m  gives  a starting point and the 4mmodifier24ms adjust the index
       from the starting point (e.g. move forward or backward one  character).
       Every index must contain a 4mbase24m, but the 4mmodifier24ms are optional.

       The 4mbase24m for an index must have one of the following forms:

       4mline24m1m.4m22mchar24m   Indicates  4mchar24m'th  character on line 4mline24m.  Lines are num-
                   bered from 1 for consistency with other UNIX programs  that
                   use  this  numbering scheme.  Within a line, characters are
                   numbered from 0.  If 4mchar24m is 1mend 22mthen it refers to the new-
                   line character that ends the line.

       1m@4m22mx24m1m,4m22my24m        Indicates the character that covers the pixel whose x and y
                   coordinates within the text's window are 4mx24m and 4my24m.

       1mend         22mIndicates the end of the text (the character just after the
                   last newline).

       4mmark24m        Indicates  the  character just after the mark whose name is
                   4mmark24m.

       4mtag24m1m.first   22mIndicates the first character in the  text  that  has  been
                   tagged  with 4mtag24m.  This form generates an error if no char-
                   acters are currently tagged with 4mtag24m.

       4mtag24m1m.last    22mIndicates the character just after the last one in the text
                   that  has  been  tagged  with  4mtag24m.  This form generates an
                   error if no characters are currently tagged with 4mtag24m.

       4mpathName24m    Indicates the position of the embedded window whose name is
                   4mpathName24m.   This  form  generates  an  error if there is no
                   embedded window by the given name.

       4mimageName24m   Indicates the position of the embedded image whose name  is
                   4mimageName24m.   This  form  generates  an error if there is no
                   embedded image by the given name.

       If the 4mbase24m could match more than one of the above  forms,  such  as  a
       4mmark24m and 4mimageName24m both having the same value, then the form earlier in
       the above list takes precedence.  If modifiers follow the  base  index,
       each  one  of  them  must have one of the forms listed below.  Keywords
       such  as  1mchars  22mand  1mwordend  22mmay  be  abbreviated  as  long  as   the
       abbreviation is unambiguous.

       1m+ 4m22mcount24m 1mchars0m
              Adjust  the  index  forward by 4mcount24m characters, moving to later
              lines in the text if necessary.  If there are fewer  than  4mcount0m
              characters  in  the  text  after the current index, then set the
              index to the last character in the text.  Spaces on either  side
              of 4mcount24m are optional.

       1m- 4m22mcount24m 1mchars0m
              Adjust the index backward by 4mcount24m characters, moving to earlier
              lines in the text if necessary.  If there are fewer  than  4mcount0m
              characters  in  the  text before the current index, then set the
              index to the first character in the text.  Spaces on either side
              of 4mcount24m are optional.

       1m+ 4m22mcount24m 1mlines0m
              Adjust  the  index  forward  by  4mcount24m lines, retaining the same
              character position within the line.  If  there  are  fewer  than
              4mcount24m  lines  after  the line containing the current index, then
              set the index to refer to the same  character  position  on  the
              last  line of the text.  Then, if the line is not long enough to
              contain a character at the indicated character position,  adjust
              the  character  position  to  refer to the last character of the
              line  (the  newline).   Spaces  on  either  side  of  4mcount24m  are
              optional.

       1m- 4m22mcount24m 1mlines0m
              Adjust  the  index  backward  by 4mcount24m lines, retaining the same
              character position within the line.  If  there  are  fewer  than
              4mcount24m  lines  before the line containing the current index, then
              set the index to refer to the same  character  position  on  the
              first line of the text.  Then, if the line is not long enough to
              contain a character at the indicated character position,  adjust
              the  character  position  to  refer to the last character of the
              line  (the  newline).   Spaces  on  either  side  of  4mcount24m  are
              optional.

       1mlinestart0m
              Adjust the index to refer to the first character on the line.

       1mlineend0m
              Adjust the index to refer to the last character on the line (the
              newline).

       1mwordstart0m
              Adjust the index to refer to the first  character  of  the  word
              containing  the current index.  A word consists of any number of
              adjacent characters that are letters, digits, or underscores, or
              a single character that is not one of these.

       1mwordend0m
              Adjust  the  index to refer to the character just after the last
              one of the word containing the current index.   If  the  current
              index  refers  to  the last character of the text then it is not
              modified.

       If more than one modifier is present then they are applied in  left-to-
       right  order.   For  example, the index ``1mend - 1 chars22m'' refers to the
       next-to-last character in the text  and  ``1minsert  wordstart  -  1  c22m''
       refers  to the character just before the first one in the word contain-
       ing the insertion cursor.


1mTAGS0m
       The first form of annotation in text widgets is a tag.  A tag is a tex-
       tual  string  that is associated with some of the characters in a text.
       Tags may contain arbitrary characters, but it is probably best to avoid
       using  the the characters `` '' (space), 1m+22m, or 1m-22m: these characters have
       special meaning in indices, so tags containing them can't  be  used  as
       indices.  There may be any number of tags associated with characters in
       a text.  Each tag may refer to a single character, a range  of  charac-
       ters,  or  several  ranges  of characters.  An individual character may
       have any number of tags associated with it.

       A priority order is defined among tags,  and  this  order  is  used  in
       implementing some of the tag-related functions described below.  When a
       tag is defined (by associating it with characters or setting  its  dis-
       play  options or binding commands to it), it is given a priority higher
       than any existing tag.  The priority order of  tags  may  be  redefined
       using the ``4mpathName24m 1mtag raise22m'' and ``4mpathName24m 1mtag lower22m'' widget com-
       mands.

       Tags serve three purposes in text widgets.  First, they control the way
       information  is  displayed  on  the screen.  By default, characters are
       displayed as determined by the 1mbackground22m, 1mfont22m, and 1mforeground 22moptions
       for  the  text widget.  However, display options may be associated with
       individual tags using the ``4mpathName24m 1mtag  configure22m''  widget  command.
       If  a  character  has  been tagged, then the display options associated
       with the tag override the default display style.  The following options
       are currently supported for tags:

       1m-background 4m22mcolor0m
              4mColor24m specifies the background color to use for characters asso-
              ciated with the tag.  It may have any of the forms  accepted  by
              1mTk_GetColor22m.

       1m-bgstipple 4m22mbitmap0m
              4mBitmap24m  specifies a bitmap that is used as a stipple pattern for
              the background.  It may  have  any  of  the  forms  accepted  by
              1mTk_GetBitmap22m.   If  4mbitmap24m  hasn't  been  specified, or if it is
              specified as an empty string, then a solid fill will be used for
              the background.

       1m-borderwidth 4m22mpixels0m
              4mPixels24m  specifies  the  width of a 3-D border to draw around the
              background.  It may have any of the forms accepted by 1mTk_GetPix-0m
              1mels22m.  This option is used in conjunction with the 1m-relief 22moption
              to give a 3-D appearance to the background for characters; it is
              ignored  unless the 1m-background 22moption has been set for the tag.

       1m-elide 4m22mboolean0m
              4mElide24m specifies whether the data should be elided.  Elided  data
              is  not  displayed  and takes no space on screen, but further on
              behaves just as normal data.

       1m-fgstipple 4m22mbitmap0m
              4mBitmap24m specifies a bitmap that is used as a stipple pattern when
              drawing  text  and  other  foreground information such as under-
              lines.  It may have any of the forms accepted  by  1mTk_GetBitmap22m.
              If  4mbitmap24m  hasn't  been  specified, or if it is specified as an
              empty string, then a solid fill will be used.

       1m-font 4m22mfontName0m
              4mFontName24m is the name of a font to use  for  drawing  characters.
              It may have any of the forms accepted by 1mTk_GetFont22m.

       1m-foreground 4m22mcolor0m
              4mColor24m  specifies  the  color  to use when drawing text and other
              foreground information such as underlines.  It may have  any  of
              the forms accepted by 1mTk_GetColor22m.

       1m-justify 4m22mjustify0m
              If  the  first  character  of a display line has a tag for which
              this option has been specified, then 4mjustify24m determines  how  to
              justify the line.  It must be one of 1mleft22m, 1mright22m, or 1mcenter22m.  If
              a line wraps, then the justification for each line on  the  dis-
              play  is determined by the first character of that display line.

       1m-lmargin1 4m22mpixels0m
              If the first character of a text line has a tag for  which  this
              option  has  been  specified, then 4mpixels24m specifies how much the
              line should be indented from the left edge of the window.   4mPix-0m
              4mels24m may have any of the standard forms for screen distances.  If
              a line of text wraps, this option only applies to the first line
              on  the  display;  the 1m-lmargin2 22moption controls the indentation
              for subsequent lines.

       1m-lmargin2 4m22mpixels0m
              If the first character of a display line has  a  tag  for  which
              this  option  has been specified, and if the display line is not
              the first for its text line (i.e., the text line  has  wrapped),
              then  4mpixels24m specifies how much the line should be indented from
              the left edge of the window.  4mPixels24m may have any of  the  stan-
              dard  forms for screen distances.  This option is only used when
              wrapping is enabled, and it only applies to the second and later
              display lines for a text line.

       1m-offset 4m22mpixels0m
              4mPixels24m  specifies  an amount by which the text's baseline should
              be offset vertically from the baseline of the overall  line,  in
              pixels.   For  example, a positive offset can be used for super-
              scripts and a negative offset can be used for subscripts.   4mPix-0m
              4mels24m may have any of the standard forms for screen distances.

       1m-overstrike 4m22mboolean0m
              Specifies  whether  or not to draw a horizontal rule through the
              middle of  characters.   4mBoolean24m  may  have  any  of  the  forms
              accepted by 1mTk_GetBoolean22m.

       1m-relief 4m22mrelief0m
              4mRelief24m  specifies the 3-D relief to use for drawing backgrounds,
              in any of the forms accepted by 1mTk_GetRelief22m.   This  option  is
              used  in  conjunction with the 1m-borderwidth 22moption to give a 3-D
              appearance to the  background  for  characters;  it  is  ignored
              unless the 1m-background 22moption has been set for the tag.

       1m-rmargin 4m22mpixels0m
              If  the  first  character  of a display line has a tag for which
              this option has been specified, then 4mpixels24m specifies how wide a
              margin  to  leave between the end of the line and the right edge
              of the window.  4mPixels24m may have any of the  standard  forms  for
              screen  distances.   This  option  is only used when wrapping is
              enabled.  If a text line wraps, the right margin for  each  line
              on the display is determined by the first character of that dis-
              play line.

       1m-spacing1 4m22mpixels0m
              4mPixels24m specifies how much additional space should be left  above
              each  text line, using any of the standard forms for screen dis-
              tances.  If a line wraps, this option only applies to the  first
              line on the display.

       1m-spacing2 4m22mpixels0m
              For  lines  that wrap, this option specifies how much additional
              space to leave between the display lines for a single text line.
              4mPixels24m  may have any of the standard forms for screen distances.

       1m-spacing3 4m22mpixels0m
              4mPixels24m specifies how much additional space should be left  below
              each  text line, using any of the standard forms for screen dis-
              tances.  If a line wraps, this option only applies to  the  last
              line on the display.

       1m-tabs 4m22mtabList0m
              4mTabList24m specifies a set of tab stops in the same form as for the
              1m-tabs 22moption for the text widget.  This option only applies to a
              display  line  if it applies to the first character on that dis-
              play line.  If this option is specified as an empty  string,  it
              cancels  the  option,  leaving  it  unspecified for the tag (the
              default).  If the option is specified as a non-empty string that
              is  an  empty  list, such as 1m-tags { }22m, then it requests default
              8-character tabs as described for the 1mtags 22mwidget option.

       1m-underline 4m22mboolean0m
              4mBoolean24m specifies whether or not to draw an underline underneath
              characters.   It  may  have any of the forms accepted by 1mTk_Get-0m
              1mBoolean22m.

       1m-wrap 4m22mmode0m
              4mMode24m specifies how to handle  lines  that  are  wider  than  the
              text's window.  It has the same legal values as the 1m-wrap 22moption
              for the text widget:  1mnone22m, 1mchar22m, or 1mword22m.  If this  tag  option
              is specified, it overrides the 1m-wrap 22moption for the text widget.

       If a character has several tags associated with it, and if  their  dis-
       play options conflict, then the options of the highest priority tag are
       used.  If a particular display option hasn't been specified for a  par-
       ticular tag, or if it is specified as an empty string, then that option
       will never be used;  the next-highest-priority tag's option  will  used
       instead.   If  no  tag  specifies a particular display option, then the
       default style for the widget will be used.

       The second purpose for tags is event bindings.  You can associate bind-
       ings  with a tag in much the same way you can associate bindings with a
       widget class:  whenever particular X events occur  on  characters  with
       the  given tag, a given Tcl command will be executed.  Tag bindings can
       be used to give behaviors to ranges of characters; among other  things,
       this  allows  hypertext-like  features to be implemented.  For details,
       see the description of the 1mtag bind 22mwidget command below.

       The third use for tags is in managing the selection.  See THE SELECTION
       below.


1mMARKS0m
       The  second  form  of  annotation in text widgets is a mark.  Marks are
       used for remembering particular places in a text.  They  are  something
       like  tags,  in  that  they  have names and they refer to places in the
       file, but a mark isn't associated with particular characters.  Instead,
       a  mark is associated with the gap between two characters.  Only a sin-
       gle position may be associated with a mark at any given time.   If  the
       characters  around  a  mark are deleted the mark will still remain;  it
       will just have new neighbor characters.  In contrast, if the characters
       containing  a tag are deleted then the tag will no longer have an asso-
       ciation with characters in the file.  Marks may be manipulated with the
       ``4mpathName24m  1mmark22m''  widget  command, and their current locations may be
       determined by using the mark name as an index in widget commands.

       Each mark also has a 4mgravity24m, which is either 1mleft 22mor 1mright22m.  The grav-
       ity for a mark specifies what happens to the mark when text is inserted
       at the point of the mark.  If a mark has left gravity, then the mark is
       treated  as  if  it  were attached to the character on its left, so the
       mark will remain to the left of any text inserted at the mark position.
       If  the  mark has right gravity, new text inserted at the mark position
       will appear to the left of the mark (so that the  mark  remains  right-
       most).  The gravity for a mark defaults to 1mright22m.

       The  name  space  for  marks is different from that for tags:  the same
       name may be used for both a mark and a tag, but they will refer to dif-
       ferent things.

       Two marks have special significance.  First, the mark 1minsert 22mis associ-
       ated with the insertion cursor, as described under THE INSERTION CURSOR
       below.  Second, the mark 1mcurrent 22mis associated with the character clos-
       est to the mouse and is adjusted automatically to track the mouse posi-
       tion and any changes to the text in the widget (one exception:  1mcurrent0m
       is not updated in response to mouse motions if a mouse button is  down;
       the  update  will  be  deferred  until  all  mouse  buttons  have  been
       released).  Neither of these special marks may be deleted.


1mEMBEDDED WINDOWS0m
       The third form of annotation in text widgets  is  an  embedded  window.
       Each  embedded  window  annotation causes a window to be displayed at a
       particular point in  the text.  There may be  any  number  of  embedded
       windows  in  a  text  widget, and any widget may be used as an embedded
       window (subject to the  usual  rules  for  geometry  management,  which
       require  the  text  window to be the parent of the embedded window or a
       descendant of its parent).   The  embedded  window's  position  on  the
       screen will be updated as the text is modified or scrolled, and it will
       be mapped and unmapped as it moves into and out of the visible area  of
       the  text  widget.  Each embedded window occupies one character's worth
       of index space in the text widget, and it may be referred to either  by
       the  name  of  its  embedded  window or by its position in the widget's
       index space.  If the range of text containing the  embedded  window  is
       deleted then the window is destroyed.

       When  an embedded window is added to a text widget with the 1mwindow cre-0m
       1mate 22mwidget command, several configuration  options  may  be  associated
       with  it.  These options may be  modified later with the 1mwindow config-0m
       1mure 22mwidget command.  The following options are currently supported:

       1m-align 4m22mwhere0m
              If the window is not as tall as the line in  which  it  is  dis-
              played,  this option determines where the window is displayed in
              the line.  4mWhere24m must have one of the values 1mtop 22m(align the  top
              of the window with the top of the line), 1mcenter 22m(center the win-
              dow within the range of the line), 1mbottom 22m(align the  bottom  of
              the  window  with  the  bottom  of the line's area), or 1mbaseline0m
              (align the bottom of the window with the baseline of the  line).

       1m-create 4m22mscript0m
              Specifies  a Tcl script that may be evaluated to create the win-
              dow for the annotation.  If no 1m-window 22moption has been specified
              for  the annotation this script will be evaluated when the anno-
              tation is about to be displayed on the screen.  4mScript24m must cre-
              ate a window for the annotation and return the name of that win-
              dow as its result.  If the annotation's window  should  ever  be
              deleted,  4mscript24m will be evaluated again the next time the anno-
              tation is displayed.

       1m-padx 4m22mpixels0m
              4mPixels24m specifies the amount of extra space to leave on each side
              of  the  embedded  window.   It  may have any of the usual forms
              defined for a screen distance.

       1m-pady 4m22mpixels0m
              4mPixels24m specifies the amount of extra space to leave on  the  top
              and  on  the  bottom of the embedded window.  It may have any of
              the usual forms defined for a screen distance.

       1m-stretch 4m22mboolean0m
              If the requested height of the embedded window is less than  the
              height  of the line in which it is displayed, this option can be
              used to specify whether the window should  be  stretched  verti-
              cally  to fill its line.  If the 1m-pady 22moption has been specified
              as well, then the requested padding will be retained even if the
              window is stretched.

       1m-window 4m22mpathName0m
              Specifies the name of a window to display in the annotation.


1mEMBEDDED IMAGES0m
       The  final  form  of  annotation  in text widgets is an embedded image.
       Each embedded image annotation causes an image to  be  displayed  at  a
       particular  point  in   the  text.  There may be any number of embedded
       images in a text widget, and a particular image may be embedded in mul-
       tiple places in the same text widget.  The embedded image's position on
       the screen will be updated as the text is modified or  scrolled.   Each
       embedded  image  occupies  one  character's worth of index space in the
       text widget, and it may be referred to either by its  position  in  the
       widget's  index  space,  or  the  name it is assigned when the image is
       inserted into the text widget widh 1mimage create22m.  If the range of  text
       containing the embedded image is deleted then that copy of the image is
       removed from the screen.

       When an embedded image is added to a text widget with the 1mimage  create0m
       widget  command,  a  name  unique  to  this  instance  of  the image is
       returned.  This name may then be used to refer to this image  instance.
       The  name  is  taken  to  be  the  value of the 1m-name 22moption (described
       below).  If the 1m-name 22moption is not provided, the 1m-image 22mname  is  used
       instead.   If  the 4mimageName24m is already in use in the text widget, then
       1m#4m22mnn24m is added to the end of the 4mimageName24m,  where  4mnn24m  is  an  arbitrary
       integer.   This  insures  the  4mimageName24m  is unique.  Once this name is
       assigned to this instance of the image, it does not change, even though
       the 1m-image 22mor 1m-name 22mvalues can be changed with 1mimage configure22m.

       When  an embedded image is added to a text widget with the 1mimage create0m
       widget command, several configuration options may  be  associated  with
       it.   These options may be modified later with the 1mimage configure 22mwid-
       get command.  The following options are currently supported:

       1m-align 4m22mwhere0m
              If the image is not as tall as the line  in  which  it  is  dis-
              played,  this  option determines where the image is displayed in
              the line.  4mWhere24m must have one of the values 1mtop 22m(align the  top
              of the image with the top of the line), 1mcenter 22m(center the image
              within the range of the line), 1mbottom 22m(align the bottom  of  the
              image  with  the  bottom of the line's area), or 1mbaseline 22m(align
              the bottom of the image with the baseline of the line).

       1m-image 4m22mimage0m
              Specifies the name of the Tk image to display in the annotation.
              If 4mimage24m is not a valid Tk image, then an error is returned.

       1m-name 4m22mImageName0m
              Specifies  the  name  by which this image instance may be refer-
              enced in the text widget. If 4mImageName24m is not supplied, then the
              name  of  the  Tk  image  is  used instead.  If the 4mimageName24m is
              already in use, 4m#nn24m is appended  to  the  end  of  the  name  as
              described above.

       1m-padx 4m22mpixels0m
              4mPixels24m specifies the amount of extra space to leave on each side
              of the embedded image.  It may  have  any  of  the  usual  forms
              defined for a screen distance.

       1m-pady 4m22mpixels0m
              4mPixels24m  specifies  the amount of extra space to leave on the top
              and on the bottom of the embedded image.  It may have any of the
              usual forms defined for a screen distance.


1mTHE SELECTION0m
       Selection  support  is  implemented  via  tags.  If the 1mexportSelection0m
       option for the text widget is true then the 1msel 22mtag will be  associated
       with the selection:

       [1]    Whenever  characters  are  tagged  with 1msel 22mthe text widget will
              claim ownership of the selection.

       [2]    Attempts to retrieve the selection will be serviced by the  text
              widget, returning all the characters with the 1msel 22mtag.

       [3]    If  the  selection  is claimed away by another application or by
              another window within this application, then the 1msel 22mtag will be
              removed from all characters in the text.

       The 1msel 22mtag is automatically defined when a text widget is created, and
       it may not be deleted with the ``4mpathName24m 1mtag delete22m'' widget  command.
       Furthermore,  the  1mselectBackground22m, 1mselectBorderWidth22m, and 1mselectFore-0m
       1mground 22moptions for the text widget are tied to the  1m-background22m,  1m-bor-0m
       1mderwidth22m,  and  1m-foreground 22moptions for the 1msel 22mtag:  changes in either
       will automatically be reflected in the other.


1mTHE INSERTION CURSOR0m
       The mark named 1minsert 22mhas special significance in text widgets.  It  is
       defined  automatically  when a text widget is created and it may not be
       unset with the ``4mpathName24m 1mmark unset22m'' widget command.  The 1minsert 22mmark
       represents the position of the insertion cursor, and the insertion cur-
       sor will automatically be drawn at this point whenever the text  widget
       has the input focus.


1mWIDGET COMMAND0m
       The  1mtext  22mcommand  creates a new Tcl command whose name is the same as
       the path name of the text's window.  This command may be used to invoke
       various operations on the widget.  It has the following general form:
              4mpathName24m 4moption24m ?4marg24m 4marg24m 4m...24m?
       4mPathName24m is the name of the command, which is the same as the text wid-
       get's path name.  4mOption24m and the 4marg24ms determine the exact  behavior  of
       the command.  The following commands are possible for text widgets:

       4mpathName24m 1mbbox 4m22mindex0m
              Returns  a  list  of four elements describing the screen area of
              the character given by 4mindex24m.  The first  two  elements  of  the
              list  give  the  x and y coordinates of the upper-left corner of
              the area occupied by the character, and the  last  two  elements
              give the width and height of the area.  If the character is only
              partially visible on the screen, then the return value  reflects
              just  the  visible part.  If the character is not visible on the
              screen then the return value is an empty list.

       4mpathName24m 1mcget 4m22moption0m
              Returns the current value of the configuration option  given  by
              4moption24m.   4mOption24m may have any of the values accepted by the 1mtext0m
              command.

       4mpathName24m 1mcompare 4m22mindex124m 4mop24m 4mindex20m
              Compares the indices given by 4mindex124m and 4mindex224m according to the
              relational  operator given by 4mop24m, and returns 1 if the relation-
              ship is satisfied and 0 if it isn't.  4mOp24m  must  be  one  of  the
              operators  <,  <=,  ==,  >=,  >,  or  !=.  If 4mop24m is == then 1 is
              returned if the two indices refer to the same character,  if  4mop0m
              is < then 1 is returned if 4mindex124m refers to an earlier character
              in the text than 4mindex224m, and so on.

       4mpathName24m 1mconfigure 22m?4moption24m? 4m?value24m 4moption24m 4mvalue24m 4m...24m?
              Query or modify the configuration options of the widget.  If  no
              4moption24m is specified, returns a list describing all of the avail-
              able options for 4mpathName24m (see 1mTk_ConfigureInfo 22mfor  information
              on  the  format  of  this list).  If 4moption24m is specified with no
              4mvalue24m, then the command returns a list describing the one  named
              option (this list will be identical to the corresponding sublist
              of the value returned if no 4moption24m is  specified).   If  one  or
              more 4moption-value24m pairs are specified, then the command modifies
              the given widget option(s) to have the given value(s);  in  this
              case  the  command returns an empty string.  4mOption24m may have any
              of the values accepted by the 1mtext 22mcommand.

       4mpathName24m 1mdebug 22m?4mboolean24m?
              If 4mboolean24m is specified, then it must have one of  the  true  or
              false values accepted by Tcl_GetBoolean.  If the value is a true
              one then internal consistency checks will be turned on in the B-
              tree  code associated with text widgets.  If 4mboolean24m has a false
              value then the debugging checks will be turned off.   In  either
              case  the  command  returns  an empty string.  If 4mboolean24m is not
              specified then the command returns 1mon 22mor 1moff 22mto indicate whether
              or  not  debugging  is  turned  on.  There is a single debugging
              switch shared by all text widgets:  turning debugging on or  off
              in  any  widget turns it on or off for all widgets.  For widgets
              with large amounts of text, the consistency checks may  cause  a
              noticeable slow-down.

       4mpathName24m 1mdelete 4m22mindex124m ?4mindex224m?
              Delete  a range of characters from the text.  If both 4mindex124m and
              4mindex224m are specified, then delete all  the  characters  starting
              with  the  one  given  by 4mindex124m and stopping just before 4mindex20m
              (i.e. the character  at  4mindex224m  is  not  deleted).   If  4mindex20m
              doesn't specify a position later in the text than 4mindex124m then no
              characters are deleted.  If 4mindex224m isn't specified then the sin-
              gle  character  at  4mindex124m  is  deleted.  It is not allowable to
              delete characters in a way that would leave the text  without  a
              newline  as  the  last  character.  The command returns an empty
              string.

       4mpathName24m 1mdlineinfo 4m22mindex0m
              Returns a list with five elements describing the  area  occupied
              by the display line containing 4mindex24m.  The first two elements of
              the list give the x and y coordinates of the  upper-left  corner
              of  the area occupied by the line, the third and fourth elements
              give the width and height of the area,  and  the  fifth  element
              gives  the  position of the baseline for the line, measured down
              from the top of the area.  All of this information  is  measured
              in  pixels.   If  the  current  wrap  mode  is 1mnone 22mand the line
              extends beyond the boundaries of the window, the  area  returned
              reflects  the  entire  area  of the line, including the portions
              that are out of the window.  If the line  is  shorter  than  the
              full  width  of  the window then the area returned reflects just
              the portion of the line  that  is  occupied  by  characters  and
              embedded  windows.   If the display line containing 4mindex24m is not
              visible on the screen then the return value is an empty list.

       4mpathName24m 1mdump 22m?4mswitches24m? 4mindex124m ?4mindex224m?
              Return the contents of the text widget from 4mindex124m  up  to,  but
              not  including  4mindex224m, including the text and information about
              marks, tags, and embedded windows.  If 4mindex224m is not  specified,
              then  it defaults to one character past 4mindex124m.  The information
              is returned in the following format:

              4mkey124m 4mvalue124m 4mindex124m 4mkey224m 4mvalue224m 4mindex224m ...

              The possible 4mkey24m values are 1mtext22m, 1mmark22m, 1mtagon22m, 1mtagoff22m, and  1mwin-0m
              1mdow22m.   The corresponding 4mvalue24m is the text, mark name, tag name,
              or window name.  The 4mindex24m information is the index of the start
              of  the  text, the mark, the tag transition, or the window.  One
              or more of the following switches (or abbreviations thereof) may
              be specified to control the dump:

              1m-all   22mReturn information about all elements: text, marks, tags,
                     images and windows.  This is the default.

              1m-command 4m22mcommand0m
                     Instead of returning the information as the result of the
                     dump operation, invoke the 4mcommand24m on each element of the
                     text widget within the  range.   The  command  has  three
                     arguments appended to it before it is evaluated: the 4mkey24m,
                     4mvalue24m, and 4mindex24m.

              1m-image 22mInclude information about images in the dump results.

              1m-mark  22mInclude information about marks in the dump results.

              1m-tag   22mInclude information about tag  transitions  in  the  dump
                     results.  Tag information is returned as 1mtagon 22mand 1mtagoff0m
                     elements that indicate the begin and end of each range of
                     each tag, respectively.

              1m-text  22mInclude  information about text in the dump results.  The
                     value is the text up to the next element or  the  end  of
                     range  indicated by 4mindex224m.  A text element does not span
                     newlines.  A multi-line block of text  that  contains  no
                     marks or tag transitions will still be dumped as a set of
                     text seqments that each end with a newline.  The  newline
                     is part of the value.

              1m-window0m
                     Include  information  about  embedded windows in the dump
                     results.  The value of  a  window  is  its  Tk  pathname,
                     unless  the  window  has  not been created yet.  (It must
                     have a create script.)  In this case an empty  string  is
                     returned,  and  you  must  query  the window by its index
                     position to get more information.

       4mpathName24m 1mget 4m22mindex124m ?4mindex224m?
              Return a range of characters from the text.   The  return  value
              will  be  all  the  characters in the text starting with the one
              whose index is 4mindex124m and ending just before the one whose index
              is  4mindex224m  (the  character at 4mindex224m will not be returned).  If
              4mindex224m is  omitted  then  the  single  character  at  4mindex124m  is
              returned.   If  there  are  no characters in the specified range
              (e.g. 4mindex124m is past the end of the file or 4mindex224m is less  than
              or  equal  to  4mindex124m) then an empty string is returned.  If the
              specified range contains embedded windows, no information  about
              them is included in the returned string.

       4mpathName24m 1mimage 4m22moption24m ?4marg24m 4marg24m 4m...24m?
              This  command is used to manipulate embedded images.  The behav-
              ior of the command depends on the 4moption24m argument  that  follows
              the  1mtag  22margument.  The following forms of the command are cur-
              rently supported:

              4mpathName24m 1mimage cget 4m22mindex24m 4moption0m
                     Returns the value of a configuration option for an embed-
                     ded  image.   4mIndex24m  identifies  the  embedded image, and
                     4moption24m specifies a particular configuration option, which
                     must  be  one  of the ones listed in the section EMBEDDED
                     IMAGES.

              4mpathName24m 1mimage configure 4m22mindex24m ?4moption24m 4mvalue24m 4m...24m?
                     Query or modify the configuration options for an embedded
                     image.   If  no  4moption24m  is  specified,  returns  a  list
                     describing all of the available options for the  embedded
                     image  at  4mindex24m (see 1mTk_ConfigureInfo 22mfor information on
                     the format of this list).  If 4moption24m is specified with no
                     4mvalue24m, then the command returns a list describing the one
                     named option (this list will be identical to  the  corre-
                     sponding  sublist  of  the value returned if no 4moption24m is
                     specified).  If one or more 4moption-value24m pairs are speci-
                     fied,  then  the  command modifies the given option(s) to
                     have the  given  value(s);   in  this  case  the  command
                     returns  an empty string.  See EMBEDDED IMAGES for infor-
                     mation on the options that are supported.

              4mpathName24m 1mimage create 4m22mindex24m ?4moption24m 4mvalue24m 4m...24m?
                     This command creates a new image annotation,  which  will
                     appear  in  the text at the position given by 4mindex24m.  Any
                     number of 4moption-value24m pairs may be specified to  config-
                     ure the annotation.  Returns a unique identifier that may
                     be used as an index to refer to this image.  See EMBEDDED
                     IMAGES for information on the options that are supported,
                     and a description of the identifier returned.

              4mpathName24m 1mimage names0m
                     Returns a list whose elements are the names of all  image
                     instances currently embedded in 4mwindow24m.

       4mpathName24m 1mindex 4m22mindex0m
              Returns   the  position  corresponding  to  4mindex24m  in  the  form
              4mline.char24m where 4mline24m is the line number and 4mchar24m is the  charac-
              ter  number.   4mIndex24m  may  have any of the forms described under
              INDICES above.

       4mpathName24m 1minsert 4m22mindex24m 4mchars24m ?4mtagList24m 4mchars24m 4mtagList24m 4m...24m?
              Inserts all of the 4mchars24m arguments just before the character  at
              4mindex24m.   If  4mindex24m  refers to the end of the text (the character
              after the last newline) then  the  new  text  is  inserted  just
              before  the  last  newline  instead.  If there is a single 4mchars0m
              argument and no 4mtagList24m, then the new text will receive any tags
              that  are present on both the character before and the character
              after the insertion point; if a tag is present on  only  one  of
              these  characters  then  it will not be applied to the new text.
              If 4mtagList24m is specified then it consists of a list of tag names;
              the new characters will receive all of the tags in this list and
              no others, regardless of the tags present around  the  insertion
              point.   If  multiple  4mchars24m-4mtagList24m argument pairs are present,
              they produce the same effect as if a separate 1minsert 22mwidget com-
              mand  had been issued for each pair, in order.  The last 4mtagList0m
              argument may be omitted.

       4mpathName24m 1mmark 4m22moption24m ?4marg24m 4marg24m 4m...24m?
              This command is used to manipulate marks.  The exact behavior of
              the command depends on the 4moption24m argument that follows the 1mmark0m
              argument.  The following forms of the command are currently sup-
              ported:

              4mpathName24m 1mmark gravity 4m22mmarkName24m ?4mdirection24m?
                     If  4mdirection24m  is not specified, returns 1mleft 22mor 1mright 22mto
                     indicate which of its  adjacent  characters  4mmarkName24m  is
                     attached  to.  If 4mdirection24m is specified, it must be 1mleft0m
                     or 1mright22m; the gravity of 4mmarkName24m is  set  to  the  given
                     value.

              4mpathName24m 1mmark names0m
                     Returns  a  list  whose elements are the names of all the
                     marks that are currently set.

              4mpathName24m 1mmark next 4m22mindex0m
                     Returns the name of the next mark at or after 4mindex24m.   If
                     4mindex24m is specified in numerical form, then the search for
                     the next mark begins at that index.  If 4mindex24m is the name
                     of a mark, then the search for the next mark begins imme-
                     diately after that mark.  This can still return a mark at
                     the same position if there are multiple marks at the same
                     index.  These semantics mean that the 1mmark next 22moperation
                     can  be used to step through all the marks in a text wid-
                     get in the same order as the mark information returned by
                     the  1mdump  22moperation.  If a mark has been set to the spe-
                     cial 1mend 22mindex, then it appears  to  be  4mafter24m  1mend  22mwith
                     respect  to  the 1mmark next 22moperation.  An empty string is
                     returned if there are no marks after 4mindex24m.

              4mpathName24m 1mmark previous 4m22mindex0m
                     Returns the name of the mark  at  or  before  4mindex24m.   If
                     4mindex24m is specified in numerical form, then the search for
                     the previous mark begins with the character  just  before
                     that  index.   If  4mindex24m  is the name of a mark, then the
                     search for the next mark begins immediately  before  that
                     mark.   This can still return a mark at the same position
                     if there are multiple marks at  the  same  index.   These
                     semantics  mean  that  the 1mmark previous 22moperation can be
                     used to step through all the marks in a  text  widget  in
                     the reverse order as the mark information returned by the
                     1mdump 22moperation.  An empty string is returned if there are
                     no marks before 4mindex24m.

              4mpathName24m 1mmark set 4m22mmarkName24m 4mindex0m
                     Sets  the  mark  named 4mmarkName24m to a position just before
                     the character at 4mindex24m.  If 4mmarkName24m already  exists,  it
                     is  moved  from  its old position; if it doesn't exist, a
                     new mark is  created.   This  command  returns  an  empty
                     string.

              4mpathName24m 1mmark unset 4m22mmarkName24m ?4mmarkName24m 4mmarkName24m 4m...24m?
                     Remove  the  mark  corresponding  to each of the 4mmarkName0m
                     arguments.  The removed  marks  will  not  be  usable  in
                     indices  and  will  not  be  returned  by future calls to
                     ``4mpathName24m 1mmark names22m''.  This command returns  an  empty
                     string.

       4mpathName24m 1mscan 4m22moption24m 4margs0m
              This command is used to implement scanning on texts.  It has two
              forms, depending on 4moption24m:

              4mpathName24m 1mscan mark 4m22mx24m 4my0m
                     Records 4mx24m and 4my24m and the current view in the text  window,
                     for  use  in conjunction with later 1mscan dragto 22mcommands.
                     Typically this command is associated with a mouse  button
                     press in the widget.  It returns an empty string.

              4mpathName24m 1mscan dragto 4m22mx24m 4my0m
                     This  command computes the difference between its 4mx24m and 4my0m
                     arguments and the 4mx24m and 4my24m arguments to the last 1mscan mark0m
                     command  for  the widget.  It then adjusts the view by 10
                     times the difference in  coordinates.   This  command  is
                     typically associated with mouse motion events in the wid-
                     get, to produce the effect of dragging the text  at  high
                     speed  through  the window.  The return value is an empty
                     string.

       4mpathName24m 1msearch 22m?4mswitches24m? 4mpattern24m 4mindex24m ?4mstopIndex24m?
              Searches the text in 4mpathName24m starting at 4mindex24m for a  range  of
              characters that matches 4mpattern24m.  If a match is found, the index
              of the first character in the match is returned as result;  oth-
              erwise  an empty string is returned.  One or more of the follow-
              ing switches (or abbreviations thereof) may be specified to con-
              trol the search:

              1m-forwards0m
                     The search will proceed forward through the text, finding
                     the first matching range starting at or after  the  posi-
                     tion given by 4mindex24m.  This is the default.

              1m-backwards0m
                     The  search will proceed backward through the text, find-
                     ing the matching range closest to 4mindex24m whose first char-
                     acter is before 4mindex24m.

              1m-exact 22mUse exact matching:  the characters in the matching range
                     must be identical to  those  in  4mpattern24m.   This  is  the
                     default.

              1m-regexp0m
                     Treat  4mpattern24m  as  a  regular  expression  and  match it
                     against the text using the rules for regular  expressions
                     (see the 1mregexp 22mcommand for details).

              1m-nocase0m
                     Ignore case differences between the pattern and the text.

              1m-count 4m22mvarName0m
                     The argument following 1m-count 22mgives the name of  a  vari-
                     able;  if a match is found, the number of index positions
                     between beginning and end of the matching range  will  be
                     stored  in the variable.  If there are no embedded images
                     or windows in the matching range, this is  equivalent  to
                     the  number  of  characters matched.  In either case, the
                     range 4mmatchIdx24m to 4mmatchIdx24m 4m+24m 4m$count24m 4mchars24m will return the
                     entire matched text.

              1m-elide 22mFind  elidden (hidden) text as well. By default only dis-
                     played text is searched.

              1m--     22mThis switch has no effect except to terminate the list of
                     switches:  the  next  argument will be treated as 4mpattern0m
                     even if it starts with 1m-22m.

              The matching range must be entirely  within  a  single  line  of
              text.   For regular expression matching the newlines are removed
              from the ends of the lines before matching:  use the  1m$  22mfeature
              in  regular  expressions  to match the end of a line.  For exact
              matching the newlines are retained.  If 4mstopIndex24m is  specified,
              the  search  stops at that index: for forward searches, no match
              at  or  after  4mstopIndex24m  will  be  considered;   for   backward
              searches,  no  match  earlier in the text than 4mstopIndex24m will be
              considered.  If 4mstopIndex24m is omitted, the entire  text  will  be
              searched:  when the beginning or end of the text is reached, the
              search continues at the other end until the starting location is
              reached  again;   if 4mstopIndex24m is specified, no wrap-around will
              occur.

       4mpathName24m 1msee 4m22mindex0m
              Adjusts the view in the window so that the  character  given  by
              4mindex24m  is  completely visible.  If 4mindex24m is already visible then
              the command does nothing.  If 4mindex24m is a short distance  out  of
              view,  the  command  adjusts  the view just enough to make 4mindex0m
              visible at the edge of the window.  If 4mindex24m is far out of view,
              then the command centers 4mindex24m in the window.

       4mpathName24m 1mtag 4m22moption24m ?4marg24m 4marg24m 4m...24m?
              This  command is used to manipulate tags.  The exact behavior of
              the command depends on the 4moption24m argument that follows the  1mtag0m
              argument.  The following forms of the command are currently sup-
              ported:

              4mpathName24m 1mtag add 4m22mtagName24m 4mindex124m ?4mindex224m 4mindex124m 4mindex224m 4m...24m?
                     Associate the tag 4mtagName24m  with  all  of  the  characters
                     starting  with  4mindex124m and ending just before 4mindex224m (the
                     character at 4mindex224m isn't tagged).  A single command  may
                     contain  any  number of 4mindex124m-4mindex224m pairs.  If the last
                     4mindex224m is omitted then the single character at 4mindex124m  is
                     tagged.   If  there  are  no  characters in the specified
                     range (e.g. 4mindex124m is past the end of the file or  4mindex20m
                     is  less than or equal to 4mindex124m) then the command has no
                     effect.

              4mpathName24m 1mtag bind 4m22mtagName24m ?4msequence24m? ?4mscript24m?
                     This command associates 4mscript24m with the tag given by 4mtag-0m
                     4mName24m.   Whenever  the  event  sequence  given by 4msequence0m
                     occurs for a character that has been tagged with 4mtagName24m,
                     the script will be invoked.  This widget command is simi-
                     lar to the 1mbind 22mcommand except that it operates on  char-
                     acters  in  a  text  rather than entire widgets.  See the
                     1mbind 22mmanual entry for complete details on the  syntax  of
                     4msequence24m and the substitutions performed on 4mscript24m before
                     invoking it.  If all arguments are specified then  a  new
                     binding  is  created,  replacing any existing binding for
                     the same 4msequence24m and 4mtagName24m (if the first character  of
                     4mscript24m  is ``+'' then 4mscript24m augments an existing binding
                     rather than replacing it).  In this case the return value
                     is  an  empty string.  If 4mscript24m is omitted then the com-
                     mand returns  the  4mscript24m  associated  with  4mtagName24m  and
                     4msequence24m  (an  error occurs if there is no such binding).
                     If both 4mscript24m and 4msequence24m are omitted then the  command
                     returns  a  list  of all the sequences for which bindings
                     have been defined for 4mtagName24m.

                     The only events for which bindings may be  specified  are
                     those  related  to the mouse and keyboard (such as 1mEnter22m,
                     1mLeave22m, 1mButtonPress22m,  1mMotion22m,  and  1mKeyPress22m)  or  virtual
                     events.  Event bindings for a text widget use the 1mcurrent0m
                     mark described under MARKS above.  An 1mEnter  22mevent  trig-
                     gers  for a tag when the tag first becomes present on the
                     current character, and a 1mLeave 22mevent triggers for  a  tag
                     when  it  ceases  to be present on the current character.
                     1mEnter 22mand 1mLeave 22mevents can happen either because the 1mcur-0m
                     1mrent 22mmark moved or because the character at that position
                     changed.  Note that these events are different than 1mEnter0m
                     and  1mLeave 22mevents for windows.  Mouse and keyboard events
                     are directed to the  current  character.   If  a  virtual
                     event is used in a binding, that binding can trigger only
                     if the virtual event is defined by an  underlying  mouse-
                     related or keyboard-related event.

                     It is possible for the current character to have multiple
                     tags, and for each of them to have a binding for  a  par-
                     ticular event sequence.  When this occurs, one binding is
                     invoked for each tag, in order  from  lowest-priority  to
                     highest  priority.   If there are multiple matching bind-
                     ings for a single tag, then the most specific binding  is
                     chosen  (see  the  manual  entry for the 1mbind 22mcommand for
                     details).  1mcontinue 22mand  1mbreak  22mcommands  within  binding
                     scripts  are  processed  in  the same way as for bindings
                     created with the 1mbind 22mcommand.

                     If bindings are created for the widget as a  whole  using
                     the 1mbind 22mcommand, then those bindings will supplement the
                     tag bindings.  The tag bindings will  be  invoked  first,
                     followed by bindings for the window as a whole.

              4mpathName24m 1mtag cget 4m22mtagName24m 4moption0m
                     This  command  returns  the  current  value of the option
                     named 4moption24m associated with the tag  given  by  4mtagName24m.
                     4mOption24m  may  have  any  of the values accepted by the 1mtag0m
                     1mconfigure 22mwidget command.

              4mpathName24m 1mtag configure 4m22mtagName24m ?4moption24m?  ?4mvalue24m?  ?4moption24m  4mvalue0m
              4m...24m?
                     This command is similar to the 1mconfigure  22mwidget  command
                     except  that  it modifies options associated with the tag
                     given by 4mtagName24m instead of  modifying  options  for  the
                     overall text widget.  If no 4moption24m is specified, the com-
                     mand returns a  list  describing  all  of  the  available
                     options for 4mtagName24m (see 1mTk_ConfigureInfo 22mfor information
                     on the format of this list).  If 4moption24m is specified with
                     no  4mvalue24m, then the command returns a list describing the
                     one named option (this list will be identical to the cor-
                     responding  sublist of the value returned if no 4moption24m is
                     specified).  If one or more 4moption-value24m pairs are speci-
                     fied,  then  the  command modifies the given option(s) to
                     have the given value(s) in 4mtagName24m; in this case the com-
                     mand returns an empty string.  See TAGS above for details
                     on the options available for tags.

              4mpathName24m 1mtag delete 4m22mtagName24m ?4mtagName24m 4m...24m?
                     Deletes all tag information for each of the 4mtagName24m argu-
                     ments.   The command removes the tags from all characters
                     in the file and also deletes any other information  asso-
                     ciated with the tags, such as bindings and display infor-
                     mation.  The command returns an empty string.

              4mpathName24m 1mtag lower 4m22mtagName24m ?4mbelowThis24m?
                     Changes the priority of tag 4mtagName24m so that  it  is  just
                     lower  in  priority than the tag whose name is 4mbelowThis24m.
                     If 4mbelowThis24m  is  omitted,  then  4mtagName24m's  priority  is
                     changed to make it lowest priority of all tags.

              4mpathName24m 1mtag names 22m?4mindex24m?
                     Returns  a  list  whose elements are the names of all the
                     tags that are active at the character position  given  by
                     4mindex24m.   If  4mindex24m is omitted, then the return value will
                     describe all of the tags that exist for  the  text  (this
                     includes  all  tags  that have been named in a ``4mpathName0m
                     1mtag22m'' widget  command  but  haven't  been  deleted  by  a
                     ``4mpathName24m  1mtag delete22m'' widget command, even if no char-
                     acters are currently marked with the tag).  The list will
                     be sorted in order from lowest priority to highest prior-
                     ity.

              4mpathName24m 1mtag nextrange 4m22mtagName24m 4mindex124m ?4mindex224m?
                     This command searches the text for a range of  characters
                     tagged  with  4mtagName24m  where  the  first character of the
                     range is no earlier than the character at 4mindex124m  and  no
                     later  than  the  character  just  before 4mindex224m (a range
                     starting at 4mindex224m will not be considered).   If  several
                     matching ranges exist, the first one is chosen.  The com-
                     mand's return value is a list  containing  two  elements,
                     which  are  the index of the first character of the range
                     and the index of the character just after the last one in
                     the range.  If no matching range is found then the return
                     value is an empty string.  If 4mindex224m is not given then it
                     defaults to the end of the text.

              4mpathName24m 1mtag prevrange 4m22mtagName24m 4mindex124m ?4mindex224m?
                     This  command searches the text for a range of characters
                     tagged with 4mtagName24m where  the  first  character  of  the
                     range  is  before  the character at 4mindex124m and no earlier
                     than the character at 4mindex224m (a range starting at  4mindex20m
                     will  be  considered).  If several matching ranges exist,
                     the one closest  to  4mindex124m  is  chosen.   The  command's
                     return value is a list containing two elements, which are
                     the index of the first character of  the  range  and  the
                     index  of  the  character  just after the last one in the
                     range.  If no matching range is  found  then  the  return
                     value is an empty string.  If 4mindex224m is not given then it
                     defaults to the beginning of the text.

              4mpathName24m 1mtag raise 4m22mtagName24m ?4maboveThis24m?
                     Changes the priority of tag 4mtagName24m so that  it  is  just
                     higher  in priority than the tag whose name is 4maboveThis24m.
                     If 4maboveThis24m  is  omitted,  then  4mtagName24m's  priority  is
                     changed to make it highest priority of all tags.

              4mpathName24m 1mtag ranges 4m22mtagName0m
                     Returns  a list describing all of the ranges of text that
                     have been tagged with 4mtagName24m.  The first two elements of
                     the list describe the first tagged range in the text, the
                     next two elements describe the second range, and  so  on.
                     The  first element of each pair contains the index of the
                     first character of the range, and the second  element  of
                     the  pair  contains the index of the character just after
                     the last one in the range.  If there  are  no  characters
                     tagged with 4mtag24m then an empty string is returned.

              4mpathName24m 1mtag remove 4m22mtagName24m 4mindex124m ?4mindex224m 4mindex124m 4mindex224m 4m...24m?
                     Remove  the tag 4mtagName24m from all of the characters start-
                     ing at 4mindex124m and ending just before 4mindex224m (the  charac-
                     ter at 4mindex224m isn't affected).  A single command may con-
                     tain any number of  4mindex124m-4mindex224m  pairs.   If  the  last
                     4mindex224m  is omitted then the single character at 4mindex124m is
                     tagged.  If there are  no  characters  in  the  specified
                     range  (e.g. 4mindex124m is past the end of the file or 4mindex20m
                     is less than or equal to 4mindex124m) then the command has  no
                     effect.  This command returns an empty string.

       4mpathName24m 1mwindow 4m22moption24m ?4marg24m 4marg24m 4m...24m?
              This command is used to manipulate embedded windows.  The behav-
              ior of the command depends on the 4moption24m argument  that  follows
              the  1mtag  22margument.  The following forms of the command are cur-
              rently supported:

              4mpathName24m 1mwindow cget 4m22mindex24m 4moption0m
                     Returns the value of a configuration option for an embed-
                     ded  window.   4mIndex24m  identifies the embedded window, and
                     4moption24m specifies a particular configuration option, which
                     must  be  one  of the ones listed in the section EMBEDDED
                     WINDOWS.

              4mpathName24m 1mwindow configure 4m22mindex24m ?4moption24m 4mvalue24m 4m...24m?
                     Query or modify the configuration options for an embedded
                     window.   If  no  4moption24m  is  specified,  returns  a list
                     describing all of the available options for the  embedded
                     window  at 4mindex24m (see 1mTk_ConfigureInfo 22mfor information on
                     the format of this list).  If 4moption24m is specified with no
                     4mvalue24m, then the command returns a list describing the one
                     named option (this list will be identical to  the  corre-
                     sponding  sublist  of  the value returned if no 4moption24m is
                     specified).  If one or more 4moption-value24m pairs are speci-
                     fied,  then  the  command modifies the given option(s) to
                     have the  given  value(s);   in  this  case  the  command
                     returns an empty string.  See EMBEDDED WINDOWS for infor-
                     mation on the options that are supported.

              4mpathName24m 1mwindow create 4m22mindex24m ?4moption24m 4mvalue24m 4m...24m?
                     This command creates a new window annotation, which  will
                     appear  in  the text at the position given by 4mindex24m.  Any
                     number of 4moption-value24m pairs may be specified to  config-
                     ure the annotation.  See EMBEDDED WINDOWS for information
                     on the options that  are  supported.   Returns  an  empty
                     string.

              4mpathName24m 1mwindow names0m
                     Returns  a  list whose elements are the names of all win-
                     dows currently embedded in 4mwindow24m.

       4mpathName24m 1mxview 4m22moption24m 4margs0m
              This command is used to query and change the horizontal position
              of the text in the widget's window.  It can take any of the fol-
              lowing forms:

              4mpathName24m 1mxview0m
                     Returns a list containing two elements.  Each element  is
                     a  real fraction between 0 and 1;  together they describe
                     the portion of the document's  horizontal  span  that  is
                     visible in the window.  For example, if the first element
                     is .2 and the second element is .6, 20% of  the  text  is
                     off-screen  to the left, the middle 40% is visible in the
                     window, and 40% of the text is off-screen to  the  right.
                     The  fractions  refer only to the lines that are actually
                     visible in the window:  if the lines in  the  window  are
                     all  very  short,  so that they are entirely visible, the
                     returned fractions will be 0 and 1,  even  if  there  are
                     other lines in the text that are much wider than the win-
                     dow.  These are the same values passed to scrollbars  via
                     the 1m-xscrollcommand 22moption.

              4mpathName24m 1mxview moveto 4m22mfraction0m
                     Adjusts  the  view  in the window so that 4mfraction24m of the
                     horizontal span of the text is off-screen  to  the  left.
                     4mFraction24m is a fraction between 0 and 1.

              4mpathName24m 1mxview scroll 4m22mnumber24m 4mwhat0m
                     This  command shifts the view in the window left or right
                     according to 4mnumber24m and 4mwhat24m.  4mNumber24m must be an integer.
                     4mWhat24m  must be either 1munits 22mor 1mpages 22mor an abbreviation of
                     one of these.  If 4mwhat24m is 1munits22m, the view adjusts left or
                     right  by 4mnumber24m average-width characters on the display;
                     if it is 1mpages 22mthen the view adjusts  by  4mnumber24m  screen-
                     fuls.   If  4mnumber24m is negative then characters farther to
                     the left become visible;  if it is positive then  charac-
                     ters farther to the right become visible.

       4mpathName24m 1myview 4m22m?args24m?
              This  command  is used to query and change the vertical position
              of the text in the widget's window.  It can take any of the fol-
              lowing forms:

              4mpathName24m 1myview0m
                     Returns a list containing two elements, both of which are
                     real fractions between 0 and 1.  The first element  gives
                     the  position  of  the first character in the top line in
                     the window, relative to the text as a whole (0.5 means it
                     is  halfway  through  the text, for example).  The second
                     element gives the position of the  character  just  after
                     the  last  one in the bottom line of the window, relative
                     to the text as a whole.  These are the same values passed
                     to scrollbars via the 1m-yscrollcommand 22moption.

              4mpathName24m 1myview moveto 4m22mfraction0m
                     Adjusts  the  view  in  the  window so that the character
                     given by 4mfraction24m appears on the top line of the  window.
                     4mFraction24m  is a fraction between 0 and 1;  0 indicates the
                     first character in the text, 0.33 indicates the character
                     one-third the way through the text, and so on.

              4mpathName24m 1myview scroll 4m22mnumber24m 4mwhat0m
                     This  command  adjust  the  view in the window up or down
                     according to 4mnumber24m and 4mwhat24m.  4mNumber24m must be an integer.
                     4mWhat24m  must  be  either 1munits 22mor 1mpages22m.  If 4mwhat24m is 1munits22m,
                     the view adjusts up or down by 4mnumber24m lines on  the  dis-
                     play;   if  it  is  1mpages 22mthen the view adjusts by 4mnumber0m
                     screenfuls.  If 4mnumber24m is negative then earlier positions
                     in the text become visible;  if it is positive then later
                     positions in the text become visible.

              4mpathName24m 1myview 22m?1m-pickplace22m? 4mindex0m
                     Changes the view in the widget's  window  to  make  4mindex0m
                     visible.   If  the 1m-pickplace 22moption isn't specified then
                     4mindex24m will appear at the top of the  window.   If  1m-pick-0m
                     1mplace  22mis  specified  then the widget chooses where 4mindex0m
                     appears in the window:

                      [1]    If 4mindex24m is already visible somewhere in the win-
                             dow then the command does nothing.

                      [2]    If 4mindex24m is only a few lines off-screen above the
                             window then it will be positioned at the  top  of
                             the window.

                      [3]    If 4mindex24m is only a few lines off-screen below the
                             window then it will be positioned at  the  bottom
                             of the window.

                      [4]    Otherwise,  4mindex24m will be centered in the window.

                     The 1m-pickplace 22moption has been obsoleted by the 1msee  22mwid-
                     get  command  (1msee 22mhandles both x- and y-motion to make a
                     location visible, whereas 1m-pickplace 22monly handles  motion
                     in y).

              4mpathName24m 1myview 4m22mnumber0m
                     This  command makes the first character on the line after
                     the one given by 4mnumber24m visible at the top of the window.
                     4mNumber24m  must be an integer.  This command used to be used
                     for scrolling, but now it is obsolete.


1mBINDINGS0m
       Tk automatically creates class bindings for texts that  give  them  the
       following  default  behavior.   In  the descriptions below, ``word'' is
       dependent on the value of the 1mtcl_wordchars 22mvariable.  See  tclvars(n).

       [1]    Clicking  mouse  button  1  positions  the insertion cursor just
              before the character underneath the mouse cursor, sets the input
              focus  to  this  widget, and clears any selection in the widget.
              Dragging with mouse button 1 strokes out a selection between the
              insertion cursor and the character under the mouse.

       [2]    Double-clicking  with  mouse button 1 selects the word under the
              mouse and positions the insertion cursor at the beginning of the
              word.  Dragging after a double click will stroke out a selection
              consisting of whole words.

       [3]    Triple-clicking with mouse button 1 selects the line  under  the
              mouse and positions the insertion cursor at the beginning of the
              line.  Dragging after a triple click will stroke out a selection
              consisting of whole lines.

       [4]    The ends of the selection can be adjusted by dragging with mouse
              button 1 while the Shift key is down;  this will adjust the  end
              of  the selection that was nearest to the mouse cursor when but-
              ton 1 was pressed.  If the button is double-clicked before drag-
              ging  then  the  selection  will  be  adjusted in units of whole
              words;  if it is  triple-clicked  then  the  selection  will  be
              adjusted in units of whole lines.

       [5]    Clicking  mouse  button 1 with the Control key down will reposi-
              tion the insertion cursor without affecting the selection.

       [6]    If any normal printing characters are typed, they  are  inserted
              at the point of the insertion cursor.

       [7]    The  view  in  the widget can be adjusted by dragging with mouse
              button 2.  If mouse button  2  is  clicked  without  moving  the
              mouse,  the selection is copied into the text at the position of
              the mouse cursor.  The Insert key also  inserts  the  selection,
              but at the position of the insertion cursor.

       [8]    If  the  mouse  is  dragged  out of the widget while button 1 is
              pressed, the entry will automatically scroll to make  more  text
              visible  (if there is more text off-screen on the side where the
              mouse left the window).

       [9]    The Left and Right keys move the insertion cursor one  character
              to  the  left  or  right;   they also clear any selection in the
              text.  If Left or Right is typed with the Shift key  down,  then
              the  insertion  cursor  moves  and  the selection is extended to
              include the new character.  Control-Left and Control-Right  move
              the  insertion  cursor by words, and Control-Shift-Left and Con-
              trol-Shift-Right move the insertion cursor  by  words  and  also
              extend  the  selection.  Control-b and Control-f behave the same
              as Left and Right, respectively.  Meta-b and Meta-f  behave  the
              same as Control-Left and Control-Right, respectively.

       [10]   The  Up  and  Down keys move the insertion cursor one line up or
              down and clear any selection in the text.  If  Up  or  Right  is
              typed  with  the Shift key down, then the insertion cursor moves
              and the selection is extended  to  include  the  new  character.
              Control-Up  and  Control-Down move the insertion cursor by para-
              graphs (groups of lines separated by blank lines), and  Control-
              Shift-Up  and  Control-Shift-Down  move  the insertion cursor by
              paragraphs and also extend the selection.   Control-p  and  Con-
              trol-n behave the same as Up and Down, respectively.

       [11]   The  Next  and  Prior  keys move the insertion cursor forward or
              backwards by one screenful and clear any selection in the  text.
              If the Shift key is held down while Next or Prior is typed, then
              the selection is extended to include the  new  character.   Con-
              trol-v  moves  the  view  down  one screenful without moving the
              insertion cursor or adjusting the selection.

       [12]   Control-Next and Control-Prior scroll the view right or left  by
              one  page  without  moving the insertion cursor or affecting the
              selection.

       [13]   Home and Control-a move the insertion cursor to the beginning of
              its  line  and  clear  any  selection in the widget.  Shift-Home
              moves the insertion cursor to the beginning of the line and also
              extends the selection to that point.

       [14]   End  and  Control-e  move the insertion cursor to the end of the
              line and clear any selection in the widget.  Shift-End moves the
              cursor  to the end of the line and extends the selection to that
              point.

       [15]   Control-Home and Meta-< move the insertion cursor to the  begin-
              ning  of  the  text and clear any selection in the widget.  Con-
              trol-Shift-Home moves the insertion cursor to the  beginning  of
              the text and also extends the selection to that point.

       [16]   Control-End  and  Meta-> move the insertion cursor to the end of
              the text and clear any selection in the widget.   Control-Shift-
              End  moves  the  cursor  to  the end of the text and extends the
              selection to that point.

       [17]   The Select key and Control-Space set the selection anchor to the
              position of the insertion cursor.  They don't affect the current
              selection.   Shift-Select  and  Control-Shift-Space  adjust  the
              selection  to  the  current  position  of  the insertion cursor,
              selecting from the anchor to the insertion cursor if  there  was
              not any selection previously.

       [18]   Control-/ selects the entire contents of the widget.

       [19]   Control-\ clears any selection in the widget.

       [20]   The  F16  key (labelled Copy on many Sun workstations) or Meta-w
              copies the selection in the widget to the clipboard, if there is
              a selection.

       [21]   The F20 key (labelled Cut on many Sun workstations) or Control-w
              copies the selection in the widget to the clipboard and  deletes
              the  selection.   If  there  is  no selection in the widget then
              these keys have no effect.

       [22]   The F18 key (labelled Paste on many Sun  workstations)  or  Con-
              trol-y  inserts the contents of the clipboard at the position of
              the insertion cursor.

       [23]   The Delete key deletes the selection, if there  is  one  in  the
              widget.   If  there is no selection, it deletes the character to
              the right of the insertion cursor.

       [24]   Backspace and Control-h delete the selection, if there is one in
              the widget.  If there is no selection, they delete the character
              to the left of the insertion cursor.

       [25]   Control-d deletes the character to the right  of  the  insertion
              cursor.

       [26]   Meta-d deletes the word to the right of the insertion cursor.

       [27]   Control-k  deletes  from  the insertion cursor to the end of its
              line; if the insertion cursor is already at the end of  a  line,
              then Control-k deletes the newline character.

       [28]   Control-o  opens  a new line by inserting a newline character in
              front of the insertion cursor without moving the insertion  cur-
              sor.

       [29]   Meta-backspace  and  Meta-Delete  delete the word to the left of
              the insertion cursor.

       [30]   Control-x deletes whatever is selected in the text widget.

       [31]   Control-t reverses the order of the two characters to the  right
              of the insertion cursor.

       If  the  widget  is disabled using the 1m-state 22moption, then its view can
       still be adjusted and text can still be selected, but no insertion cur-
       sor will be displayed and no text modifications will take place.

       The behavior of texts can be changed by defining new bindings for indi-
       vidual widgets or by redefining the class bindings.


1mPERFORMANCE ISSUES0m
       Text widgets should run efficiently under a variety of conditions.  The
       text  widget uses about 2-3 bytes of main memory for each byte of text,
       so texts containing a megabyte or more  should  be  practical  on  most
       workstations.   Text  is  represented internally with a modified B-tree
       structure that makes operations relatively efficient  even  with  large
       texts.   Tags are included in the B-tree structure in a way that allows
       tags to span large ranges or have many disjoint smaller ranges  without
       loss  of  efficiency.   Marks are also implemented in a way that allows
       large numbers of marks.  In most cases it is fine to have large numbers
       of unique tags, or a tag that has many distinct ranges.

       One  performance problem can arise if you have hundreds or thousands of
       different tags that all have the following characteristics:  the  first
       and last ranges of each tag are near the beginning and end of the text,
       respectively, or a single tag range covers most  of  the  text  widget.
       The  cost  of adding and deleting tags like this is proportional to the
       number of other tags with the same properties.  In contrast,  there  is
       no  problem  with  having  thousands  of distinct tags if their overall
       ranges are localized and spread uniformly throughout the text.

       Very long text lines can be expensive, especially  if  they  have  many
       marks and tags within them.

       The display line with the insert cursor is redrawn each time the cursor
       blinks, which causes a steady stream  of  graphics  traffic.   Set  the
       1minsertOffTime 22mattribute to 0 avoid this.

1mKEYWORDS0m
