Package avail.anvil.text

Types

Link copied to clipboard
class AvailEditorKit(val workbench: AvailWorkbench) : CodeKit

An EditorKit that supports editing an Avail source module.

Link copied to clipboard
open class CodeKit(val workbench: AvailWorkbench) : StyledEditorKit

An EditorKit that supports multiline Avail source code, but not necessarily for the purpose of editing an Avail source module.

Link copied to clipboard
class CodePane(    workbench: AvailWorkbench,     isEditable: Boolean = true,     kit: CodeKit = CodeKit(workbench)) : JTextPane

A text suitable for editing Avail source code. It is editable by default, but may be locked down after construction.

Link copied to clipboard
sealed class DocumentPosition : JSONFriendly

An abstract location within a document opened in an AvailEditor.

Link copied to clipboard
data class DotPosition(    val line: Int,     val characterInLine: Int,     val offset: Int) : DocumentPosition

The DocumentPosition of the Caret.getDot; the rightmost position.

Link copied to clipboard
data class MarkPosition(    val line: Int,     val characterInLine: Int,     val offset: Int) : DocumentPosition

The DocumentPosition of the Caret.getMark; the leftmost position.

Link copied to clipboard
data class MarkToDotRange(val markPosition: MarkPosition, val dotPosition: DotPosition) : JSONFriendly

The range between the cursor dot and the cursor caret.

Link copied to clipboard

This class will display line numbers for a related text component. The text component must use the same line height for each line. TextLineNumber supports wrapped lines and will highlight the line number of the current line(s) in the text component.

Functions

Link copied to clipboard
fun JTextComponent.centerCurrentLine()

Center the current line of the receiver in its enclosing viewport by moving the caret. If no viewport encloses the receiver, then do not move the caret.

Link copied to clipboard
fun Document.codePointAt(position: Int): Int

Interrogate the code point at the specified position.

Link copied to clipboard
fun Document.codePointOrNullAt(position: Int): Int?

Interrogate the code point at the specified position.

Link copied to clipboard
fun JTextComponent.dotPosition(): DotPosition
Link copied to clipboard
fun JTextComponent.goTo(line: Int, characterInLine: Int = 0)

Move the caret to the specified line and optional intra-line position. Normalize the positions, to ensure that the document and line limits are not exceeded.

Link copied to clipboard
fun Document.indentationAt(position: Int): Int

Tally the indentation at position. Only horizontal tabulation (U+0009) is considered indentation.

Link copied to clipboard
fun Document.indentationBefore(position: Int): Int

Tally the indentation for the line enclosing position. Only leading horizontal tabulation (U+0009) is considered indentation.

Link copied to clipboard
fun Document.lineStartBefore(position: Int): Int

Locate the beginning of the line enclosing position.

Link copied to clipboard
fun JTextComponent.lineStartsInSelection(): List<Int>

Locate the beginnings of all lines enclosing the active selection. If no text is selected, then locate the beginning of the line containing the caret.

Link copied to clipboard
fun JTextComponent.markPosition(): MarkPosition
Link copied to clipboard
fun JTextComponent.markToDotRange(): MarkToDotRange
Link copied to clipboard
fun JTextComponent.setCaretFrom(range: MarkToDotRange)

Set the caret dot and caret mark from the given MarkToDotRange.

Properties

Link copied to clipboard
val JTextComponent.canEdit: Boolean

Whether the receiver can really be edited.