Package avail.anvil.text

Types

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

A CodeKit that supports editing files in a FileEditor.

Link copied to clipboard
open class BlockComment(prefix: String, suffix: String) : CommentSyntax

The syntax that represents a multi-line comment (block comment).

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
interface CommentSyntax

Therepresentation of comment syntax that can be used to comment text.

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
object DoubleForwardSlashLineComment : LineComment

The LineComment that uses // to indicate a line comment.

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

An EditorKit that supports editing an Avail source module.

Link copied to clipboard
enum FileExtensionCommentSyntax : Enum<FileExtensionCommentSyntax>

The enumeration of file extensions and their associated comment syntax.

Link copied to clipboard
object ForwardSlashAsteriskBlockComment : BlockComment

The BlockComment with a prefix of forward slash (/) followed by an asterisk (*) ("\u002F\u002A") and a suffix of an asterisk (*) followed by a forward slash ("\u002A\u002F").

Link copied to clipboard
object HashTagLineComment : LineComment

The LineComment that uses # to indicate a line comment.

Link copied to clipboard
object HTMLBlockComment : BlockComment

The HTML-style BlockComment with prefix, <!--`, and suffix, `-->.

Link copied to clipboard
open class LineComment(prefix: String) : CommentSyntax

The String line prefix, first non-whitespace characters of the first line of the file or the first non-whitespace that represents the start of a line comment.

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
abstract class RestrictableEditAction(actionName: String) : TextAction

An text edit TextAction that may be prevented based on whether the JTextPane.canEdit flag is set to false. If false the action will be prevented and the UIManager will provide some kind of appropriate error feedback.

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.firstLineStartInSelection(): Int

Locate the position of the beginning of the first line enclosing the active selection.

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 JTextComponent.lastLineEndInSelection(): Int

Locate the position of the end of the last line enclosing the active selection.

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

Locate the end of the line enclosing position.

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

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

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 minTabCount(text: String): Int

Count the number of tabs that prefix each line (after a \n character) in each line in the provided text and answer the lowest tab count amongst the lines.

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

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

Link copied to clipboard
fun toCamelCase(textToTransform: String): String

Transform the following text to camel case.

Link copied to clipboard
fun toKebabCase(textToTransform: String): String

Transform the following text to kebab case.

Link copied to clipboard
fun toPascalCase(textToTransform: String): String

Transform the following text to pascal case.

Link copied to clipboard
fun toSnakeCase(textToTransform: String): String

Transform the following text to snake case.

Properties

Link copied to clipboard
val JTextComponent.canEdit: Boolean

Whether the receiver can really be edited.