Where a prompt is shown and where its keys come from.
Three implementations ship with Drafter:
Drafter.Prompt.Terminal.Local— the terminal the program runs inDrafter.Prompt.Terminal.Piped— standard input and output when they are not a terminalDrafter.Prompt.Terminal.Scripted— keys from a list, for tests
Functions that change what the terminal remembers return the terminal to keep using.
Summary
Types
A key or paste event as Drafter.Terminal.ANSI decodes it.
All the types that implement this protocol.
Functions
Give the terminal back. The terminal must not be used afterwards.
Show frame as the last frame and move below it, so later output follows it.
Show frame in place of the frame drawn before it.
Whether the terminal redraws frames and delivers keys one at a time.
Wait up to timeout for the next event.
Write text where the current frame is, pushing the frame out of the way.
The terminal's size as {columns, rows}.
Types
@type event() :: Drafter.Terminal.ANSI.event()
A key or paste event as Drafter.Terminal.ANSI decodes it.
@type t() :: term()
All the types that implement this protocol.
Functions
@spec close(t()) :: :ok
Give the terminal back. The terminal must not be used afterwards.
@spec commit(t(), Drafter.Prompt.Frame.t()) :: t()
Show frame as the last frame and move below it, so later output follows it.
@spec draw(t(), Drafter.Prompt.Frame.t()) :: t()
Show frame in place of the frame drawn before it.
Whether the terminal redraws frames and delivers keys one at a time.
Wait up to timeout for the next event.
Returns the event, :timeout, or :closed when no more input can arrive.
Write text where the current frame is, pushing the frame out of the way.
The frame is erased; draw it again afterwards.
@spec size(t()) :: {pos_integer(), pos_integer()}
The terminal's size as {columns, rows}.