A multiline text editor for code.

Static variables

@:value("textEditor_listView")staticfinalread onlyCHILD_VARIANT_LIST_VIEW:String = "textEditor_listView"

The variant used to style the ListView child component in a theme.

Constructor

@:value({ readOnly : false })new(?text:String, readOnly:Bool = false)

Creates a new TextEditor object.

Variables

@:flash.propertyallowToggleBreakpoints:Bool

Indicates if the user is allowed to toggle breakpoints by clicking inside a line's gutter.

autoClosingPairs:Array<AutoClosingPair>

Defines sets of auto-closing character pairs for the current language.

@:style@:flash.propertybackgroundSkin:DisplayObject

The default background skin to display behind the text editor's content.

@:value(null)blockComment:Array<String> = null

The opening and closing strings that define a block comment. The array must contain exactly two items. The first item is the opening string of the block comment, and the second item is the closing string of the block comment.

brackets:Array<Array<String>>

Defines sets of brackets for the current language.

Each item in the Array must be an Array<String> containing exactly two items. The first item is the opening bracket, and the second item is the closing bracket.

@:flash.propertybreakpoints:Array<Int>

The current set of breakpoints.

@:flash.propertyread onlycaretCharIndex:Int

The character index of the caret.

To set caretCharIndex, use setSelection() with both char values equal

@:flash.propertyread onlycaretLine:TextLineModel

The data displayed for the line where the caret is currently located.

@:flash.propertyread onlycaretLineIndex:Int

The line index of the caret.

To set caretLineIndex, use setSelection() with both char values equal

@:style@:flash.propertycustomTextLineRendererVariant:String

A custom variant to set on the text line renderers.

@:flash.propertydebuggerLineIndex:Int

The line index where the debugger is currently stopped. If the debugger is not currently stopped on a line, the value is -1.

@:value("\n")defaultLineDelimiter:String = "\n"

The default lineDelimeter to use when none can be detected.

@:style@:flash.propertydisabledBackgroundSkin:DisplayObject

The background skin to display behind the text editor's content when the text editor is disabled.

@:flash.propertyread onlyedited:Bool

Indicates if the file has been edited.

@:style@:flash.propertyembedFonts:Bool

Determines if an embedded font is used for the text displayed by the text editor.

@:flash.propertyread onlyexpandedCaretCharIndex:Int

Used by the SelectionManager for smarter caret placement when moving the caret between multiple lines.

@:flash.propertyread onlygutterWidth:Float

The width of the gutter to the left of the lines.

@:style@:flash.propertyhighlightAllFindResults:Bool

Indicates if a special background appears behind all results when find() is called.

@:value(false)insertSpacesForTabs:Bool = false

Determines if the tab key should insert spaces instead of the tab \t character.

See also:

@:value(null)lineComment:String = null

The string that defines the start of a line comment.

@:flash.propertylineDelimiter:String

The string used to indicate line breaks. May be \n, \r, or \r\n.

@:flash.propertyread onlylineHeight:Float

The height of each line, measured in pixels, if wordWrap is false. When wordWrap is true, lines may have different heights.

@:style@:flash.propertylineNumberWidth:Null<Float>

Allows the width of line numbers to be set to an exact value, instead of being calculated dynamically.

@:flash.propertylineScrollY:Int

The current scroll position, as measured in lines.

@:flash.propertyread onlylines:ArrayCollection<TextLineModel>

The text divided into lines, with extra metadata.

macHomeAndEndEnabled:Bool

Determines if Keyboard.HOME and Keyboard.END behave like native macOS text editors (scroll to top or bottom, without changing the cursor position), or if they change the cursor position to the beginning or end of the current line (like most code editors).

@:flash.propertyread onlymaxLineScrollY:Int

The maximum value currently allowed for lineScrollY.

@:flash.propertyread onlymaxScrollX:Float

The maximum value currently allowed for scrollX.

@:flash.propertyread onlymaxScrollY:Float

The maximum value currently allowed for scrollY.

@:style@:flash.propertyminLineNumberCharacters:Int

When the line number widths are calculated automatically, this is the minimum number of characters required for the calculation. This value is ignored if lineNumberWidth is set.

@:flash.propertyread onlyminScrollX:Float

The minimum value currently allowed for scrollX.

@:flash.propertyread onlyminScrollY:Float

The minimum value currently allowed for scrollY.

parser:ILineParser

The code parser used for syntax highlighting.

@:flash.propertyread onlyreadOnly:Bool

Indicates if the editor allows editing or not.

@:flash.propertyscrollX:Float

The current horizontal scroll position, as measured in pixels.

@:flash.propertyscrollY:Float

The current vertical scroll position, as measured in pixels.

@:flash.propertyread onlyselectedText:String

The currently selected text. If no text is selected, returns an empty string.

@:flash.propertyread onlyselectionEndCharIndex:Int

The character index of the end of the selection.

To set selectionEndCharIndex, call setSelection().

@:flash.propertyread onlyselectionEndLineIndex:Int

The line index of the end of the selection.

To set selectionEndLineIndex, call setSelection().

@:flash.propertyread onlyselectionStartCharIndex:Int

The character index of the start of the selection.

To set selectionStartCharIndex, call setSelection().

@:flash.propertyread onlyselectionStartLineIndex:Int

The line index of the start of the selection.

To set selectionStartLineIndex, call setSelection().

@:flash.propertyshowLineNumbers:Bool

Determines if line numbers are displayed or not.

@:flash.propertytabWidth:Int

The number of spaces that make up a tab character.

@:flash.propertytext:String

The text to be displayed by the editor.

textLineRendererFactory:AbstractDisplayObjectFactory<Dynamic, TextLineRenderer>

textStyles:Map<Int, TextFormat>

The text styles used for syntax highlighting. The key corresponds to the syntax identifiers from the parser.

@:flash.propertyread onlyvisibleLines:Int

The number of lines that are currently visible.

@:flash.propertywordWrap:Bool

Determines if the lines wrap or scroll horizontally.

Warning: The wordWrap property is currently supported only when the readOnly property is true.

@:flash.propertytextLineModelFactory:(String, Int) ‑> TextLineModel

Used to customize how new TextLineModel objects are created.

Methods

clearFind():Void

Clears any result of find().

@:value({ allowWrap : true, backwards : false })find(search:Any, backwards:Bool = false, allowWrap:Bool = true):TextEditorSearchResult

Searches for the specified String or EReg in the editor's text.

@:value({ allowWrap : true, backwards : false })findNext(backwards:Bool = false, allowWrap:Bool = true):TextEditorSearchResult

Makes the next find() result into the current result.

Must be called after find()

getDefaultTextStyle():TextFormat

Returns the TextFormat for the parser's default context.

getTextEditorPositionBoundaries(pos:TextEditorPosition):Rectangle

Returns the boundaries of the specified character index.

Similar to TextField.getCharBoundaries()

getTextStyle(id:Int):TextFormat

Gets the TextFormat for the specified text style id.

@:value({ result : null })getViewPortVisibleBounds(?result:Rectangle):Rectangle

Returns the visible bounds of the view port.

@:value({ forSelection : false })localToTextEditorPosition(localXY:Point, forSelection:Bool = false):TextEditorPosition

Converts a Point in the local coordinate system to a TextEditorPosition object.

removeSelection():Void

Removes the current selection.

replaceAll(newText:String):TextEditorSearchResult

Replaces all find() results with the specified text.

Must be called after find()

@:value({ allowWrap : true })replaceOne(newText:String, allowWrap:Bool = true):TextEditorSearchResult

Replaces the current find() result with the specified text.

Must be called after find()

save():Void

To be called when the file is saved. Updates the undo/redo manager appropriately.

scrollToCaret():Void

Scrolls the view to display the caret, if it is not currently visible.

selectAll():Void

Selects the entire text.

setParserAndTextStyles(parser:ILineParser, textStyles:Map<Int, TextFormat>):Void

Updates the code parser used for syntax highlighting.

setSelection(startLine:Int, startChar:Int, endLine:Int, endChar:Int):Void

Selects the specified range. If the start and end positions are the same, nothing will be selected, but the caret will move.

setSelectionAdvanced(startLine:Int, startChar:Int, endLine:Int, endChar:Int, expandCaret:Bool):Void

Used by SelectionManager to preserve the expanded caret char index.

textEditorPositionToLocal(pos:TextEditorPosition):Point

Converts a TextEditorPosition object to a Point in the local coordinate sytem.

toggleBlockComment():Void

Toggles line comments for the currently selected lines (or the line with the caret, if no lines are selected).

toggleBreakpoint(?lineIndex:Int):Void

Toggles a breakpoint at the specified line index. If no line index is specified, toggles a breakpoint at the current caret line index.

toggleLineComment():Void

Toggles line comments for the currently selected lines (or the line with the caret, if no lines are selected).