W3cubDocs

/Pony

Readline

[Source]

Line editing, history, and tab completion.

class ref Readline is
  ANSINotify ref

Implements

Constructors

create

[Source]

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^

Parameters

Returns

Public Functions

apply

[Source]

Receives input.

fun ref apply(
  term: ANSITerm ref,
  input: U8 val)
: None val

Parameters

Returns

prompt

[Source]

Set a new prompt, unblock, and handle the pending queue.

fun ref prompt(
  term: ANSITerm ref,
  value: String val)
: None val

Parameters

Returns

closed

[Source]

No more input is available.

fun ref closed()
: None val

Returns

up

[Source]

Previous line.

fun ref up(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

down

[Source]

Next line.

fun ref down(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

left

[Source]

Move left.

fun ref left(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

[Source]

Move right.

fun ref right(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

home

[Source]

Beginning of the line.

fun ref home(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

end_key

[Source]

End of the line.

fun ref end_key(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

delete

[Source]

Forward delete.

fun ref delete(
  ctrl: Bool val = false,
  alt: Bool val = false,
  shift: Bool val = false)
: None val

Parameters

  • ctrl: Bool val = false
  • alt: Bool val = false
  • shift: Bool val = false

Returns

insert

fun ref insert(
  ctrl: Bool val,
  alt: Bool val,
  shift: Bool val)
: None val

Parameters

Returns

page_up

fun ref page_up(
  ctrl: Bool val,
  alt: Bool val,
  shift: Bool val)
: None val

Parameters

Returns

page_down

fun ref page_down(
  ctrl: Bool val,
  alt: Bool val,
  shift: Bool val)
: None val

Parameters

Returns

fn_key

fun ref fn_key(
  i: U8 val,
  ctrl: Bool val,
  alt: Bool val,
  shift: Bool val)
: None val

Parameters

Returns

size

fun ref size(
  rows: U16 val,
  cols: U16 val)
: None val

Parameters

Returns

Private Functions

_backspace

[Source]

Backward delete.

fun ref _backspace()
: None val

Returns

_clear

[Source]

Clear the screen.

fun ref _clear()
: None val

Returns

_swap

[Source]

Swap the previous character with the current one.

fun ref _swap()
: None val

Returns

_delete_prev_word

[Source]

Delete the previous word.

fun ref _delete_prev_word()
: None val

Returns

_tab

[Source]

Tab completion.

TODO: Improve this.

fun ref _tab()
: None val

Returns

_dispatch

[Source]

Send a finished line to the notifier.

fun ref _dispatch(
  term: ANSITerm tag)
: None val

Parameters

Returns

_handle_line

[Source]

Dispatch a single line.

fun ref _handle_line(
  term: ANSITerm tag,
  line: String val)
: None val

Parameters

Returns

_refresh_line

[Source]

Refresh the line on screen.

fun ref _refresh_line()
: None val

Returns

_add_history

[Source]

Add a line to the history, trimming an earlier line if necessary.

fun ref _add_history(
  line: String val)
: None val

Parameters

Returns

_load_history

[Source]

Load the history from a file.

fun ref _load_history()
: None val

Returns

_save_history

[Source]

Write the history back to a file.

fun box _save_history()
: None val

Returns

© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/term-Readline