* language * NEdit Macro $rangeset $rangeset_list rangeset $rangeset_list r = rangeset_create() array = rangeset_create(n) rangeset_destroy(r) rangeset_destroy(array) index = rangeset_add(r, [start, end]) rangeset_add(r, r0) rangeset_subtract(r, [start, end]) rangeset_subtract(r, r0) rangeset_invert(r) r = rangeset_get_by_name(name) array = rangeset_info(r) array = rangeset_range(r, [index]) index = rangeset_includes(r, pos) rangeset_set_color(r, color) rangeset_set_name(r, name) $rangeset_list $rangeset_list . Array of active rangeset identifiers, with integer keys starting at 0, in the order the rangesets were defined. rangeset_create r = rangeset_create() array = rangeset_create(n) . Creates one or more new range sets. The first form creates a single range set 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. rangeset_destroy rangeset_destroy(r) rangeset_destroy(array) . Deletes all information about a range set or a number of range sets. The first 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 the range sets appearing in the array. If any of the range sets do not exist, the function continues without errors. Does not return a value. rangeset_add index = rangeset_add(r, [start, end]) rangeset_add(r, r0) . Adds to the range set r. The first form adds the range identified by the current 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 all ranges in the range set r0 to the range set r. Returns the index of the newly-added range within the rangeset. rangeset_subtract rangeset_subtract(r, [start, end]) rangeset_subtract(r, r0) . Removes from the range set r. The first form removes the range identified by the current primary selection from the range set, unless start and end are defined, in which case the range they define is removed. The second form removes all ranges in the range set r0 from the range set r. Does not return a value. rangeset_invert rangeset_invert(r) . Changes the range set r so that it contains all ranges not in r. Does not return a value. rangeset_get_by_name r = rangeset_get_by_name(name) . Returns an array of active rangeset identifiers, with integer keys starting at 0, whose name matches name. rangeset_info array = rangeset_info(r) . Returns an array containing information about the range set r. The array has the following keys: "defined" - whether a range set with identifier r is defined "count" - the number of ranges in the range set "color" - the current background color of the range set, or empty "name" - the user supplied name of the range set or empty "mode" - the name of the modify-response mode of the range set rangeset_range array = rangeset_range(r, [index]) . 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), where n is the number of ranges in the range set. The return value is an array containing the keys "start" - the start position of the range "end" (the end position of the range). If index is not supplied, the region returned is the span of the entire range set (the region starting at the start of the first range and ending atthe end of the last). If index is outside the correct range of values, the function returns an empty array. rangeset_includes index = rangeset_includes(r, pos) . Returns the index of the range in range set r which includes pos; returns 0 if pos is not contained in any of the ranges of r. This can also be used as a simple true/false function which returns true if pos is contained in the range set. rangeset_set_color rangeset_set_color(r, color) . Attempts to apply the color as a background color to the ranges of r. If color 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. rangeset_set_name rangeset_set_name(r, name) . Apply the name to the range set r. Use rangeset_get_by_name(name) to obtain the range set identifier given a name. rangeset_set_mode rangeset_set_mode(r, type) . Changes the behaviour of the range set r when modifications to the text buffer occur. type can be one of the following: "maintain" - the default: inserts within or at the end of a range extend the range "break" - any inserts within a range split the range "include" - like "maintain" but inserts at the start of a range are included also "exclude" - like "maintain" but does not add inserted text at the end of a range to that range "ins_del" "del_ins" (The differences are fairly subtle.)