Line editing, history, and tab completion.
class ref Readline is ANSINotify ref
Create a readline handler to be passed to stdin. It begins blocked. Set an initial prompt on the ANSITerm to begin processing.
new iso create( notify: ReadlineNotify iso, out: OutStream tag, path: (FilePath val | None val) = reference, maxlen: USize val = 0) : Readline iso^
Receives input.
fun ref apply( term: ANSITerm ref, input: U8 val) : None val
Set a new prompt, unblock, and handle the pending queue.
fun ref prompt( term: ANSITerm ref, value: String val) : None val
No more input is available.
fun ref closed() : None val
Previous line.
fun ref up( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
Next line.
fun ref down( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
Move left.
fun ref left( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
Move right.
fun ref right( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
Beginning of the line.
fun ref home( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
End of the line.
fun ref end_key( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
Forward delete.
fun ref delete( ctrl: Bool val = false, alt: Bool val = false, shift: Bool val = false) : None val
fun ref insert( ctrl: Bool val, alt: Bool val, shift: Bool val) : None val
fun ref page_up( ctrl: Bool val, alt: Bool val, shift: Bool val) : None val
fun ref page_down( ctrl: Bool val, alt: Bool val, shift: Bool val) : None val
fun ref fn_key( i: U8 val, ctrl: Bool val, alt: Bool val, shift: Bool val) : None val
fun ref size( rows: U16 val, cols: U16 val) : None val
Backward delete.
fun ref _backspace() : None val
Clear the screen.
fun ref _clear() : None val
Swap the previous character with the current one.
fun ref _swap() : None val
Delete the previous word.
fun ref _delete_prev_word() : None val
Tab completion.
TODO: Improve this.
fun ref _tab() : None val
Send a finished line to the notifier.
fun ref _dispatch( term: ANSITerm tag) : None val
Dispatch a single line.
fun ref _handle_line( term: ANSITerm tag, line: String val) : None val
Refresh the line on screen.
fun ref _refresh_line() : None val
Add a line to the history, trimming an earlier line if necessary.
fun ref _add_history( line: String val) : None val
Load the history from a file.
fun ref _load_history() : None val
Write the history back to a file.
fun box _save_history() : None val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/term-Readline