TermUI.Clipboard.PasteAccumulator (TermUI v0.2.0)

View Source

Accumulates bracketed paste content.

Handles the state machine for collecting paste content between paste start and end markers. Supports timeout for incomplete pastes.

Summary

Functions

Checks if currently accumulating.

Adds content to the accumulator.

Completes accumulation and returns the content.

Creates a new paste accumulator.

Resets the accumulator, discarding any partial content.

Starts accumulating paste content.

Checks if paste has timed out.

Types

t()

@type t() :: %TermUI.Clipboard.PasteAccumulator{
  accumulating: boolean(),
  content: String.t(),
  started_at: integer() | nil
}

Functions

accumulating?(paste_accumulator)

@spec accumulating?(t()) :: boolean()

Checks if currently accumulating.

add(acc, content)

@spec add(t(), String.t()) :: t()

Adds content to the accumulator.

complete(acc)

@spec complete(t()) :: {String.t(), t()}

Completes accumulation and returns the content.

new()

@spec new() :: t()

Creates a new paste accumulator.

reset(acc)

@spec reset(t()) :: t()

Resets the accumulator, discarding any partial content.

start(acc)

@spec start(t()) :: t()

Starts accumulating paste content.

timed_out?(paste_accumulator, timeout)

@spec timed_out?(t(), integer()) :: boolean()

Checks if paste has timed out.

Default timeout is 5000ms.