Raxol.Terminal.Scroll.Predictor (Raxol v2.0.1)
View SourceHandles predictive scrolling operations for the terminal. Tracks recent scrolls and provides pattern analysis for smarter prediction.
Summary
Functions
Analyzes recent scroll patterns: returns average scroll size and alternation ratio.
Creates a new predictor instance.
Adds a scroll event to the history and keeps only the window size worth of history.
Types
@type scroll_event() :: %{ direction: :up | :down, lines: non_neg_integer(), timestamp: integer() }
@type t() :: %Raxol.Terminal.Scroll.Predictor{ history: [scroll_event()], window_size: non_neg_integer() }
Functions
Analyzes recent scroll patterns: returns average scroll size and alternation ratio.
@spec new() :: t()
Creates a new predictor instance.
@spec predict(t(), :up | :down, non_neg_integer()) :: t()
Adds a scroll event to the history and keeps only the window size worth of history.