Drafter.Terminal.Reports (drafter v0.5.0)

Copy Markdown View Source

Replies to the questions a driver asks a terminal at startup, other than the graphics and keyboard ones.

cell_size_query/0 asks for the size of one cell in pixels; the reply CSI 6 ; height ; width t parses to {:cell_size, {width, height}}.

pixel_mouse_query/0 asks whether pixel mouse reporting (mode 1016) is set; the reply CSI ? 1016 ; status $ y parses to {:pixel_mouse, true} when the status is 1 (set) or 3 (permanently set), and {:pixel_mouse, false} for any other status, including 0 from a terminal that does not know the mode.

iex> Drafter.Terminal.Reports.parse("\e[?1016;1$y")
{[{:pixel_mouse, true}], ""}

iex> Drafter.Terminal.Reports.parse("\e[?1016;0$y")
{[{:pixel_mouse, false}], ""}

Summary

Types

An event a report parses to.

Functions

The sequence that asks the terminal how many pixels one cell is.

Parse a report at the head of buffer, or :no_match.

The sequence that asks the terminal whether pixel mouse reporting is set.

Types

report()

@type report() ::
  {:cell_size, {pos_integer(), pos_integer()}} | {:pixel_mouse, boolean()}

An event a report parses to.

Functions

cell_size_query()

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

The sequence that asks the terminal how many pixels one cell is.

parse(arg1)

@spec parse(binary()) :: {[report()], binary()} | :no_match

Parse a report at the head of buffer, or :no_match.

pixel_mouse_query()

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

The sequence that asks the terminal whether pixel mouse reporting is set.