The caret and mark
Factor handbook » UI framework » Building user interfaces » Pre-made UI gadgets » Editor gadgets

Prev:Getting and setting editor contents
Next:<multiline-editor> ( -- editor )


If there is no selection, the caret and the mark are at the same location; otherwise the mark delimits the end-point of the selection opposite the caret.
editor-caret ( editor -- loc )

editor-mark ( editor -- loc )

change-caret ( editor quot: ( loc document -- newloc ) -- )

change-caret&mark ( editor quot: ( loc document -- newloc ) -- )

mark>caret ( editor -- )


Getting the selected text:
gadget-selection? ( gadget -- ? )

gadget-selection ( gadget -- string/f )


Removing selected text:
remove-selection ( editor -- )


Scrolling to the caret location:
scroll>caret ( editor -- )


Use user-input* to change selected text.