Utility functions for manipulating text in a code editor.

Static methods

staticcharIdx2LineCharIdx(str:String, charIdx:Int, lineDelim:String):TextEditorPosition

Return line and character index from absolute character index.

staticendOfWord(line:String, charIndex:Int, ?nonWordCharacters:Array<String>):Int

Returns the character index of the end of the current word (exclusive).

@:value({ includePartial : false })staticgetFirstIndentAtStartOfLine(line:String, tabSize:Int, includePartial:Bool = false):String

Return the first indent (either a tab or a set of spaces with the specified tab size) at the start of a line.

@:value({ includePartial : false })staticgetIndentAtStartOfLine(line:String, tabSize:Int, includePartial:Bool = false):String

Gets the full string of whitespace indents (tabs and spaces) at the start of a line.

@:value({ includePartial : false })staticgetIndentCountAtStartOfLine(line:String, tabSize:Int, includePartial:Bool = false):Int

Gets the number of whitespace indents (tabs and spaces) at the start of a line.

staticindentAmount(line:String):Int

Determines the amount of tabs at the start of a line.

staticindentAmountBySpaceAndTab(line:String):Dynamic

Determines the amount of indentation combining space and tabs on a line.

staticisWordCharacter(char:String, ?nonWordCharacters:Array<String>):Bool

Determines if a character is a word character or not.

staticlineCharIdx2charIdx(str:String, lineIdx:Int, charIdx:Int, lineDelim:String):Int

Return absolute character index from line and character index.

staticrepeatStr(str:String, count:UInt):String

Repeats a string N times.

staticstartOfWord(line:String, charIndex:Int, ?nonWordCharacters:Array<String>):Int

Returns the character index of the beginning of the current word (inclusive).

staticwordBoundaryBackward(line:String):Int

Finds a word boundary from the end of a line.

staticwordBoundaryForward(line:String):Int

Finds a word boundary from the beginning of a line.