beamtea_cursor (beamtea v0.1.2)

View Source

A bubble: a blinking cursor, mirroring the cursor package in charmbracelet/bubbles.

Self-ticking like the spinner. Start it with blink/1, forward messages to update/2, and wrap the character under the cursor with view/2 — it alternates between reverse-video (shown) and plain (hidden) on each blink.

Summary

Functions

The command that starts blinking. Return it from init/1.

Equivalent to new(#{}).

Options: mode (blink | static | hidden, default blink), blink_ms (default 530, matching most terminals).

Toggle visibility on the cursor's own tick; ignore other messages.

Render Char according to the cursor's current state.

Types

model/0

-opaque model()

Functions

blink(M)

-spec blink(model()) -> beamtea:cmd().

The command that starts blinking. Return it from init/1.

blur(M)

-spec blur(model()) -> model().

focus(M)

-spec focus(model()) -> model().

new()

-spec new() -> model().

Equivalent to new(#{}).

new(Opts)

-spec new(map()) -> model().

Options: mode (blink | static | hidden, default blink), blink_ms (default 530, matching most terminals).

set_mode(Mode, M)

-spec set_mode(blink | static | hidden, model()) -> model().

update(Msg, M)

-spec update(term(), model()) -> {model(), beamtea:cmd()}.

Toggle visibility on the cursor's own tick; ignore other messages.

view(_, Char)

-spec view(model(), iodata()) -> iodata().

Render Char according to the cursor's current state.

visible(_)

-spec visible(model()) -> boolean().