📄 rangeset.html
字号:
<HTML><HEAD><TITLE> Macro/Shell Extensions </TITLE></HEAD><BODY><A NAME="Range_Sets"></A><H2> Range Sets </H2><P>The user can create range sets, identified by opaque integers. A range setcontains ranges, defined by start and end positions in the text buffer.These ranges are adjusted when modifications are made to the text buffer:they shuffle around when characters are added or deleted. However, rangeswithin a set will coalesce if the characters between them are removed, ora new range is added to the set which bridges or overlaps others.</P><P>Using range sets allows non-contiguous bits of the text to be identified as agroup.</P><P>Range sets can be assigned a background color: characters within a range of arange set will have the background color of the range set. If more than onerangeset includes a given character, its background color will be that of themost recently created range set which has a color defined.</P><P>Range sets must be created using the rangeset_create() function, which will return an identifier for the newly-created rangeset. This identifieris then passed to the other rangeset functions to manipulate the range set.</P><P>There is a limit to the number of range sets which can exist at any time -up to 63 in each text buffer. Care should be taken to destroy any rangesetswhich are no longer needed, by using the rangeset_destroy() function.</P><P>Warnings: A range set is manipulated ONLY through macro routines. Range setscan easily become very large, and may exceed the capacity of the runningprocess. Coloring relies on proper color names or specifications (such asthe "#rrggbb" hexadecimal digit strings), and appropriate hardware support. Behaviours set using rangeset_set_mode() are still experimental.</P><P><H3>Range set read-only variables</H3></P><P><PRE><B>$rangeset_list</B></PRE>array of active rangeset identifiers, with integer keys starting at 0,in the order the rangesets were defined.</P><P><H3>Range set functions</H3></P><P><PRE><B>rangeset_create()</B><B>rangeset_create( n )</B></PRE>Creates one or more new range sets. The first form creates a single rangeset and returns its identifier; if there are no range sets available it returns 0. The second form creates n new range sets, and returns an array of the range set identifiers with keys beginning at 0. If the requested number of range sets is not available it returns an empty array.</P><P><PRE><B>rangeset_destroy( r )</B><B>rangeset_destroy( array )</B></PRE>Deletes all information about a range set or a number of range sets. Thefirst form destroys the range set identified by r. The second form should be passed an array of rangeset identifiers with keys beginning at 0 (i.e.the same form of array returned by rangeset_create(n); it destroys all therange sets appearing in the array. If any of the range sets do not exist,the function continues without errors. Does not return a value.</P><P><PRE><B>rangeset_add( r, [start, end] )</B><B>rangeset_add( r, r0 )</B></PRE>Adds to the range set r. The first form adds the range identified by thecurrent primary selection to the range set, unless start and end are defined,in which case the range they define is added. The second form adds allranges in the range set r0 to the range set r. Returns the index of the newly-added range within the rangeset.</P><P><PRE><B>rangeset_subtract( r, [start, end] )</B><B>rangeset_subtract( r, r0 )</B></PRE>Removes from the range set r. The first form removes the range identified bythe current primary selection from the range set, unless start and end aredefined, in which case the range they define is removed. The second formremoves all ranges in the range set r0 from the range set r. Does not returna value.</P><P><PRE><B>rangeset_invert( r )</B></PRE>Changes the range set r so that it contains all ranges not in r. Does notreturn a value.</P><P><PRE><B>rangeset_get_by_name( name )</B></PRE>Returns an array of active rangeset identifiers, with integer keys starting at 0,whose name matches name.</P><P><PRE><B>rangeset_info( r )</B></PRE>Returns an array containing information about the range set r. The arrayhas the following keys: <B>defined</B> (whether a range set with identifierr is defined), <B>count</B> (the number of ranges in the range set), <B>color</B>(the current background color of the range set, an empty string if therange set has no color), <B>name</B> (the user supplied name of the range set,an empty string if the range set has no name), and <B>mode</B> (the name of themodify-response mode of the range set).</P><P><PRE><B>rangeset_range( r, [index] )</B></PRE>Returns details of a specific range in the range set r. The range is specified by index, which should be between 1 and n (inclusive), wheren is the number of ranges in the range set. The return value is an arraycontaining the keys <B>start</B> (the start position of the range) and <B>end</B>(the end position of the range). If index is not supplied, the regionreturned is the span of the entire range set (the region starting at the start of the first range and ending at the end of the last). If indexis outside the correct range of values, the function returns an empty array.</P><P><PRE><B>rangeset_includes( r, pos )</B></PRE>Returns the index of the range in range set r which includes pos; returns0 if pos is not contained in any of the ranges of r. This can also be usedas a simple true/false function which returns true if pos is contained inthe range set.</P><P><PRE><B>rangeset_set_color( r, color )</B></PRE>Attempts to apply the color as a background color to the ranges of r. Ifcolor is at empty string, removes the coloring of r. No check is made regarding the validity of color: if the color is invalid (a bad name,or not supported by the hardware) this has unpredictable effects.</P><P><PRE><B>rangeset_set_name( r, name )</B></PRE>Apply the name to the range set r.</P><P><PRE><B>rangeset_set_mode( r, type )</B></PRE>Changes the behaviour of the range set r when modifications to the textbuffer occur. type can be one of the following: "maintain" (the default),"break", "include", "exclude", "ins_del" or "del_ins". (The differences arefairly subtle.)</P><P></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -