Raxol.Terminal.Scroll.Sync (Raxol v2.0.1)

View Source

Handles scroll synchronization across terminal splits. Tracks recent sync events for analytics and smarter sync strategies.

Summary

Functions

Analyzes recent sync patterns: returns average lines per sync and alternation ratio.

Creates a new sync instance.

Synchronizes scroll operations across splits and records the event.

Types

sync_event()

@type sync_event() :: %{
  direction: :up | :down,
  lines: non_neg_integer(),
  timestamp: integer()
}

t()

@type t() :: %Raxol.Terminal.Scroll.Sync{
  history: [sync_event()],
  last_sync: non_neg_integer(),
  sync_enabled: boolean()
}

Functions

analyze_patterns(sync)

@spec analyze_patterns(t()) :: %{avg_lines: float(), alternation_ratio: float()}

Analyzes recent sync patterns: returns average lines per sync and alternation ratio.

new()

@spec new() :: t()

Creates a new sync instance.

sync(sync, direction, lines)

@spec sync(t(), :up | :down, non_neg_integer()) :: t()

Synchronizes scroll operations across splits and records the event.