📄 text.n
字号:
the available options for the embedded image at \fIindex\fR(see \fBTk_ConfigureInfo\fR for information on the format of this list).If \fIoption\fR is specified with no \fIvalue\fR, then the commandreturns a list describing the one named option (this list will beidentical to the corresponding sublist of the value returned if no\fIoption\fR is specified).If one or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given option(s) to have the given value(s); inthis case the command returns an empty string.See EMBEDDED IMAGES for information on the options thatare supported..TP\fIpathName \fBimage create \fIindex\fR ?\fIoption value ...\fR?This command creates a new image annotation, which will appearin the text at the position given by \fIindex\fR.Any number of \fIoption\-value\fR pairs may be specified toconfigure the annotation.Returns a unique identifier that may be used as an index to refer tothis image.See EMBEDDED IMAGES for information on the options thatare supported, and a description of the identifier returned..TP\fIpathName \fBimage names\fRReturns a list whose elements are the names of all image instances currentlyembedded in \fIwindow\fR..RE.TP\fIpathName \fBindex \fIindex\fRReturns the position corresponding to \fIindex\fR in the form\fIline.char\fR where \fIline\fR is the line number and \fIchar\fRis the character number.\fIIndex\fR may have any of the forms described under INDICES above..TP\fIpathName \fBinsert \fIindex chars \fR?\fItagList chars tagList ...\fR?Inserts all of the \fIchars\fR arguments just before the character at\fIindex\fR.If \fIindex\fR refers to the end of the text (the character afterthe last newline) then the new text is inserted just before thelast newline instead.If there is a single \fIchars\fR argument and no \fItagList\fR, thenthe new text will receive any tags that are present on both thecharacter before and the character after the insertion point; if a tagis present on only one of these characters then it will not beapplied to the new text.If \fItagList\fR is specified then it consists of a list oftag names; the new characters will receive all of the tags inthis list and no others, regardless of the tags present aroundthe insertion point.If multiple \fIchars\fR\-\fItagList\fR argument pairs are present,they produce the same effect as if a separate \fBinsert\fR widgetcommand had been issued for each pair, in order.The last \fItagList\fR argument may be omitted..TP\fIpathName \fBmark \fIoption \fR?\fIarg arg ...\fR?This command is used to manipulate marks. The exact behavior ofthe command depends on the \fIoption\fR argument that followsthe \fBmark\fR argument. The following forms of the commandare currently supported:.RS.TP\fIpathName \fBmark gravity \fImarkName\fR ?\fIdirection\fR?If \fIdirection\fR is not specified, returns \fBleft\fR or \fBright\fRto indicate which of its adjacent characters \fImarkName\fR is attachedto.If \fIdirection\fR is specified, it must be \fBleft\fR or \fBright\fR;the gravity of \fImarkName\fR is set to the given value..TP\fIpathName \fBmark names\fRReturns a list whose elements are the names of all the marks thatare currently set..TP\fIpathName \fBmark next \fIindex\fRReturns the name of the next mark at or after \fIindex\fR.If \fIindex\fR is specified in numerical form, then the search forthe next mark begins at that index.If \fIindex\fR is the name of a mark, then the search forthe next mark begins immediately after that mark.This can still return a mark at the same position ifthere are multiple marks at the same index.These semantics mean that the \fBmark next\fP operation can be used tostep through all the marks in a text widget in the same orderas the mark information returned by the \fBdump\fP operation.If a mark has been set to the special \fBend\fP index,then it appears to be \fIafter\fP \fBend\fP with respect to the \fBmark next\fP operation.An empty string is returned if there are no marks after \fIindex\fR..TP\fIpathName \fBmark previous \fIindex\fRReturns the name of the mark at or before \fIindex\fR.If \fIindex\fR is specified in numerical form, then the search forthe previous mark begins with the character just before that index.If \fIindex\fR is the name of a mark, then the search forthe next mark begins immediately before that mark.This can still return a mark at the same position ifthere are multiple marks at the same index.These semantics mean that the \fBmark previous\fP operation can be used tostep through all the marks in a text widget in the reverse orderas the mark information returned by the \fBdump\fP operation.An empty string is returned if there are no marks before \fIindex\fR..TP\fIpathName \fBmark set \fImarkName index\fRSets the mark named \fImarkName\fR to a position just before thecharacter at \fIindex\fR.If \fImarkName\fR 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..TP\fIpathName \fBmark unset \fImarkName \fR?\fImarkName markName ...\fR?Remove the mark corresponding to each of the \fImarkName\fR arguments.The removed marks will not be usable in indices and will not bereturned by future calls to ``\fIpathName \fBmark names\fR''.This command returns an empty string..RE.TP\fIpathName \fBscan\fR \fIoption args\fRThis command is used to implement scanning on texts. It hastwo forms, depending on \fIoption\fR:.RS.TP\fIpathName \fBscan mark \fIx y\fRRecords \fIx\fR and \fIy\fR and the current view in the text window,for use in conjunction with later \fBscan dragto\fR commands.Typically this command is associated with a mouse button press inthe widget. It returns an empty string..TP\fIpathName \fBscan dragto \fIx y\fRThis command computes the difference between its \fIx\fR and \fIy\fRarguments and the \fIx\fR and \fIy\fR arguments to the last\fBscan mark\fR command for the widget.It then adjusts the view by 10 times the difference in coordinates.This command is typically associatedwith mouse motion events in the widget, to produce the effect ofdragging the text at high speed through the window. The returnvalue is an empty string..RE.TP\fIpathName \fBsearch \fR?\fIswitches\fR? \fIpattern index \fR?\fIstopIndex\fR?Searches the text in \fIpathName\fR starting at \fIindex\fR for a rangeof characters that matches \fIpattern\fR.If a match is found, the index of the first character in the match isreturned as result; otherwise an empty string is returned.One or more of the following switches (or abbreviations thereof)may be specified to control the search:.RS.TP\fB\-forwards\fRThe search will proceed forward through the text, finding the firstmatching range starting at or after the position given by \fIindex\fR.This is the default..TP\fB\-backwards\fRThe search will proceed backward through the text, finding thematching range closest to \fIindex\fR whose first characteris before \fIindex\fR..TP\fB\-exact\fRUse exact matching: the characters in the matching range must beidentical to those in \fIpattern\fR.This is the default..TP\fB\-regexp\fRTreat \fIpattern\fR as a regular expression and match it againstthe text using the rules for regular expressions (see the \fBregexp\fRcommand for details)..TP\fB\-nocase\fRIgnore case differences between the pattern and the text..TP\fB\-count\fI varName\fRThe argument following \fB\-count\fR gives the name of a variable;if a match is found, the number of characters in the matchingrange will be stored in the variable..TP\fB\-\|\-\fRThis switch has no effect except to terminate the list of switches:the next argument will be treated as \fIpattern\fR even if it startswith \fB\-\fR..LPThe matching range must be entirely within a single line of text.For regular expression matching the newlines are removed from the endsof the lines before matching: use the \fB$\fR feature in regularexpressions to match the end of a line.For exact matching the newlines are retained.If \fIstopIndex\fR is specified, the search stops at that index:for forward searches, no match at or after \fIstopIndex\fR willbe considered; for backward searches, no match earlier in thetext than \fIstopIndex\fR will be considered.If \fIstopIndex\fR is omitted, the entire text will be searched:when the beginning or end of the text is reached, the searchcontinues at the other end until the starting location is reachedagain; if \fIstopIndex\fR is specified, no wrap-around will occur..RE.TP\fIpathName \fBsee \fIindex\fRAdjusts the view in the window so that the character given by \fIindex\fRis completely visible.If \fIindex\fR is already visible then the command does nothing.If \fIindex\fR is a short distance out of view, the commandadjusts the view just enough to make \fIindex\fR visible at theedge of the window.If \fIindex\fR is far out of view, then the command centers\fIindex\fR in the window..TP\fIpathName \fBtag \fIoption \fR?\fIarg arg ...\fR?This command is used to manipulate tags. The exact behavior of thecommand depends on the \fIoption\fR argument that follows the\fBtag\fR argument. The following forms of the command are currentlysupported:.RS.TP\fIpathName \fBtag add \fItagName index1 \fR?\fIindex2 index1 index2 ...\fR?Associate the tag \fItagName\fR with all of the characters startingwith \fIindex1\fR and ending just before\fIindex2\fR (the character at \fIindex2\fR isn't tagged).A single command may contain any number of \fIindex1\fR\-\fIindex2\fRpairs.If the last \fIindex2\fR is omitted then the single character at\fIindex1\fR is tagged.If there are no characters in the specified range (e.g. \fIindex1\fRis past the end of the file or \fIindex2\fR is less than or equalto \fIindex1\fR) then the command has no effect..TP\fIpathName \fBtag bind \fItagName\fR ?\fIsequence\fR? ?\fIscript\fR?This command associates \fIscript\fR with the tag given by\fItagName\fR.Whenever the event sequence given by \fIsequence\fR occurs for acharacter that has been tagged with \fItagName\fR,the script will be invoked.This widget command is similar to the \fBbind\fR command except thatit operates on characters in a text rather than entire widgets.See the \fBbind\fR manual entry for complete detailson the syntax of \fIsequence\fR and the substitutions performedon \fIscript\fR before invoking it.If all arguments are specified then a new binding is created, replacingany existing binding for the same \fIsequence\fR and \fItagName\fR(if the first character of \fIscript\fR is ``+'' then \fIscript\fRaugments an existing binding rather than replacing it).In this case the return value is an empty string.If \fIscript\fR is omitted then the command returns the \fIscript\fRassociated with \fItagName\fR and \fIsequence\fR (an error occursif there is no such binding).If both \fIscript\fR and \fIsequence\fR are omitted then the commandreturns a list of all the sequences for which bindings have beendefined for \fItagName\fR..RS.PP.VSThe only events for which bindings may be specified are those relatedto the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, \fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.Event bindings for a text widget use the \fBcurrent\fR mark describedunder MARKS above. An \fBEnter\fR event triggers for a tag when the tagfirst becomes present on the current character, and a \fBLeave\fR eventtriggers for a tag when it ceases to be present on the current character.\fBEnter\fR and \fBLeave\fR events can happen either because the\fBcurrent\fR mark moved or because the character at that positionchanged. Note that these events are different than \fBEnter\fR and\fBLeave\fR events for windows. Mouse and keyboard events are directedto the current character. If a virtual event is used in a binding, thatbinding can trigger only if the virtual event is defined by an underlyingmouse-related or keyboard-related event..VE.PPIt is possible for the current character to have multiple tags,and for each of them to have a binding for a particular eventsequence.When this occurs, one binding is invoked for each tag, in orderfrom lowest-priority to highest priority.If there are multiple matching bindings for a single tag, thenthe most specific binding is chosen (see the manual entry forthe \fBbind\fR command for details).\fBcontinue\fR and \fBbreak\fR commands within binding scriptsare processed in the same way as for bindings created withthe \fBbind\fR command..PPIf bindings are created for the widget as a whole using the\fBbind\fR command, then those bindings will supplement thetag bindings.The tag bindings will be invoked first, followed by bindingsfor the window as a whole..RE.TP\fIpathName \fBtag cget\fR \fItagName option\fRThis command returns the current value of the option named \fIoption\fRassociated with the tag given by \fItagName\fR.\fIOption\fR may have any of the values accepted by the \fBtag configure\fRwidget command..TP\fIpathName \fBtag configure \fItagName\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?This command is similar to the \fBconfigure\fR widget command exceptthat it modifies options associated with the tag given by \fItagName\fRinstead of modifying options for the overall text widget.If no \fIoption\fR is specified, the command returns a list describingall of the available options for \fItagName\fR (see \fBTk_ConfigureInfo\fRfor information on the format of this list).If \fIoption\fR is specified with no \fIvalue\fR, then the command returns
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -