text mark
Works on the marks: names for places between characters.
PATHNAME mark gravity MARK ?DIRECTION?
PATHNAME mark names
PATHNAME mark next INDEX
PATHNAME mark previous INDEX
PATHNAME mark set MARK INDEX
PATHNAME mark unset ?MARK ...?
Description
A mark is between two characters, and it moves with the text around it. The marks insert and current always exist.
gravity: gives or sets the side that the mark sticks to when text goes in at the mark:right, the default, orleft.names: gives the name of each mark.nextandprevious: give the first mark at or after INDEX, or before INDEX, or an empty string.set: puts MARK at INDEX, and makes MARK if it does not exist.unset: removes each MARK. A MARK that does not exist is not an error.
Returns
A list, a mark, a direction, or an empty string.
Examples
# The mark moves with the text.
% text .mk
> .mk insert end "hello world"
> .mk mark set start 1.6
> .mk insert 1.0 ">> "
> .mk index start
1.9
% text .mk2
> .mk2 mark set m 1.0
> .mk2 mark gravity m left
> .mk2 mark gravity m
left
Errors
% text .mk3; .mk3 mark bogus
bad mark option "bogus": must be gravity, names, next, previous, set, or unset
-errorcode NONE
% text .mk4; .mk4 mark gravity nosuch
there is no mark named "nosuch"
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1