Drafter.Prompt.Frame (drafter v0.6.0)

Copy Markdown View Source

What a prompt shows at one moment: lines of styled text and the text cursor's place.

lines is a list of Drafter.Draw.Strip, top to bottom. cursor is {row, column} counted from the frame's first line and first column, or nil to hide the cursor.

iex> alias Drafter.Draw.Strip
iex> frame = Drafter.Prompt.Frame.new([Strip.from_text("Name: ada")], {0, 9})
iex> Drafter.Prompt.Frame.text(frame)
"Name: ada"

Summary

Functions

A frame of lines with the cursor at cursor, hidden when cursor is nil.

The frame's text without styling, its lines joined by newlines.

Types

cursor()

@type cursor() :: {non_neg_integer(), non_neg_integer()} | nil

t()

@type t() :: %Drafter.Prompt.Frame{cursor: cursor(), lines: [Drafter.Draw.Strip.t()]}

Functions

new(lines, cursor \\ nil)

@spec new([Drafter.Draw.Strip.t()], cursor()) :: t()

A frame of lines with the cursor at cursor, hidden when cursor is nil.

text(frame)

@spec text(t()) :: String.t()

The frame's text without styling, its lines joined by newlines.