Readline

Line editing, history, and tab completion.

class ref Readline is
  ANSINotify ref

Implements


Constructors

create

new iso create(
  notify: ReadlineNotify iso,
  out: OutStream tag,
  path: (FilePath val | None val) = seq,
  maxlen: USize val = seq)
: Readline iso^

Parameters

Returns


Public Functions

apply

Receives input.

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

Parameters

Returns


prompt

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

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

Parameters

Returns


closed

No more input is available.

fun ref closed()
: None val

Returns


up

Previous line.

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

Parameters

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

Returns


down

Next line.

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

Parameters

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

Returns


left

Move left.

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

Parameters

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

Returns


Move right.

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

Parameters

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

Returns


home

Beginning of the line.

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

Parameters

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

Returns


end_key

End of the line.

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

Parameters

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

Returns


delete

Forward delete.

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

Parameters

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

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

Backward delete.

fun ref _backspace()
: None val

Returns


_clear

Clear the screen.

fun ref _clear()
: None val

Returns


_swap

Swap the previous character with the current one.

fun ref _swap()
: None val

Returns


_delete_prev_word

Delete the previous word.

fun ref _delete_prev_word()
: None val

Returns


_tab

Tab completion.

TODO: Improve this.

fun ref _tab()
: None val

Returns


_dispatch

Send a finished line to the notifier.

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

Parameters

Returns


_handle_line

Dispatch a single line.

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

Parameters

Returns


_refresh_line

Refresh the line on screen.

fun ref _refresh_line()
: None val

Returns


_add_history

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

Load the history from a file.

fun ref _load_history()
: None val

Returns


_save_history

Write the history back to a file.

fun box _save_history()
: None val

Returns