classpetanque::Editor

sys::Obj
  fwt::Widget
    fwt::Canvas
      petanque::Panel
        petanque::Editor

Editor is the canvas used to display and edit syntax color coded text.

caret

Source

Pos caret()

Get current caret position

colCount

Source

virtual override Int colCount()

Number of columns

colw

Source

virtual const override Int colw

Width of each column

docEndPos

Source

Pos docEndPos()

Position of document end

findNext

Source

Pos? findNext(Str s, Pos? last, Bool matchCase)

Find the specified string in the document starting the search at the document offset and looking forward. Return null is not found. Note we don't currently support searching across multiple lines.

goto

Source

Void goto(Pos pos)

Move caret and scroll to the given position and ensure editor is focused

highlights

Source

Span[] highlights := Span[,]

List of spans to highligh in the document

line

Source

Str line(Int lineNum)

Get line string for given zero based line number

lineCount

Source

virtual override Int lineCount()

Number of lines

lineh

Source

virtual const override Int lineh

Height of each line

load

Source

Void load(InStream in)

Load the document from the given input stream

loadLines

Source

Void loadLines(Str[] lines)

Load from lines already parsed into memory

make

Source

new make(|This? f := null)

It-block constructor

modify

Source

Void modify(Span span, Str newText)

Remove text between span and/or insert new given text at that position. Return new position of end of inserted text.

onCaret

Source

EventListeners onCaret()

Callback when the caret position is modified.

onModify

Source

EventListeners onModify()

Callback when the text is modified.

onPaintBackground

Source

virtual override Void onPaintBackground(Graphics g)

onPaintLines

Source

virtual override Void onPaintLines(Graphics g, Range lines)

options

Source

const EditorOptions options := EditorOptions.<ctor>()

Options defines alll the colors, styling, key bindings

ro

Source

const Bool ro := false

Is editor read only

rules

Source

const SyntaxRules rules := ...

Syntax rules to use for color coding

save

Source

Void save(OutStream out)

Save the document to the given output stream

selection

Source

Span? selection

Current selection or null for no selection

textForSpan

Source

Str textForSpan(Span span)

Get text for the given span