Skip to content

RangeMark#

Keeps track of a range within a text document. More...

import Knut

Properties#

Name
bool isValid
bool start
bool text

Methods#

Name
RangeMark join(RangeMark other)
remove()
replace(string text)
select()
string textExcept(RangeMark other)

Detailed Description#

The RangeMark object helps you track a logical range within a file. It's start and end properties will change as text is deleted or inserted before or even within the range.

A RangeMark is always created by a TextDocument.

Property Documentation#

bool isValid#

This read-only property indicates if the RangeMark is valid.

bool start#

These read-only properties holds the start, end and length of the range. They will be updated as the text of the TextDocument changes.

bool text#

This read-only property returns the text covered by the range.

Method Documentation#

RangeMark join(RangeMark other)#

Joins the two RangeMark and creates a new one.

The new RangeMark is spanning from the minimum of the start to the maximum of the end.

remove()#

Deletes the text defined by this range in the source document.

replace(string text)#

Replaces the text defined by this range with the text string in the source document.

select()#

Selects the text defined by this range in the source document.

string textExcept(RangeMark other)#

Returns the text of this range without the text of the other range. This assumes that both ranges overlap.

Otherwise, the entire text is returned.