module

Bubbles::Viewport

Constants

DEFAULT_HORIZONTAL_STEP = 6
NoGutter = ->(_ctx : GutterContext) do "" end

Constructors

new(*opts : Option) : Model
Source

Class methods

default_key_map
Source
make_highlight_ranges(highlights : Array(HighlightInfo), line : Int32, style : Lipgloss::Style) : Array(Lipgloss::Range)

make_highlight_ranges returns lipgloss ranges for the given line.

Source
parse_matches(content : String, matches : Array(Array(Int32))) : Array(HighlightInfo)

parse_matches converts the given matches into highlight ranges.

Assumptions:

  • matches are measured in bytes, e.g. what regex.FindAllStringIndex would return
  • matches were made against the given content
  • matches are in order
  • matches do not overlap
  • content is line terminated with \n only

We'll then convert the ranges into HighlightInfos, which hold the starting line and the grapheme positions.

Source
with_height(h : Int32) : Option
Source
with_width(w : Int32) : Option
Source

Nested types