mirror of
https://github.com/chshersh/github-tui.git
synced 2024-09-11 10:35:35 +03:00
22 lines
475 B
OCaml
22 lines
475 B
OCaml
type t = {
|
|
height : int;
|
|
span : int;
|
|
lines : int;
|
|
offset : int;
|
|
}
|
|
|
|
type sections = {
|
|
before : int;
|
|
scroll : int;
|
|
after : int;
|
|
}
|
|
|
|
let make ~height ~span ~lines ~offset =
|
|
if lines <= height then None else Some { height; span; lines; offset }
|
|
|
|
let to_sections { height; span; lines; offset } =
|
|
let before = offset * height / lines in
|
|
let scroll = span * height / lines in
|
|
let after = (lines - span - offset) * height / lines in
|
|
{ before; scroll; after }
|