TextView
public class TextView : View
Multi-line text editing view
The text view provides a multi-line text view. Users interact with it with the standard Emacs commands for movement or the arrow keys.
Navigation:
- Move left: left cursor, or Control-B
- Move right: right cursor key, or Control-F
- Move one page down: Page Down or Control-V
- Move one page up: Page Up or Alt-V
- Move to the beginning of the line: Home key or Control-A
- Move to the end of the line: End key or Control-E
Editing:
- Backspace key: removes the previous character
- Delete character: Delete Key or Control-D
- Delete to the end-of-line: Control-K, appends contents to the clipboard
- Delete line at the end of the line: Control-K, appends content to the clipboard
- Paste contents of copy buffer: Control-Y
Selection:
- Start selectrion: Control-Space
- Copy selection to clipboard: Alt-W
- Cut selection to clipboard: Control-W
-
Indicates readonly attribute of TextView, defaults to false
Declaration
Swift
public var isReadOnly: Bool
-
Declaration
Swift
public override init(frame: Rect)
-
Declaration
Swift
public override init()
-
Sets or gets the text in the view, this returns
nil
if there are any invalid UTF8 sequences in the buffer, usebyteBuffer
property if you do not need the stringDeclaration
Swift
public var text: String? { get set }
-
Provides access to the TextView content as a byte array
Declaration
Swift
public var byteBuffer: [UInt8] { get set }
-
Loads the contents of the file into the TextView.
This can throw an IO error if there is a problem accessing the file
Declaration
Swift
public func loadFile(path: String) throws
Parameters
path
the path for the file to load
-
Returns the current cursor position inside the buffer
Declaration
Swift
public var cursorPosition: Point { get }
-
Declaration
Swift
public override func positionCursor()
-
Will scroll the view to display the specified row at the top
Declaration
Swift
public func scrollTo(row: Int)
Parameters
row
Row that should be displayed at the top, if the value is negative it will be reset to zero
-
Declaration
Swift
public override func processKey(event: KeyEvent) -> Bool
-
Declaration
Swift
public override func mouseEvent(event: MouseEvent) -> Bool