aboutsummaryrefslogtreecommitdiff
path: root/lib/compontent.ml
blob: ecdce4b87f926f9b91940caba54d8951e5e5fa5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
open Notty

let current_line size_x y scroll (el : Grep.display_type) i =
  match el with
  | Bold el ->
    if i == y - scroll
    then (
      let fill = String.make (max (size_x - String.length el) 0) ' ' in
      I.strf "%s%s" ~attr:A.(st bold ++ st reverse) el fill |> I.pad ~l:0 ~t:i)
    else I.strf "%s" ~attr:A.(st bold) el |> I.pad ~l:0 ~t:i
  | Normal el ->
    if i == y - scroll
    then (
      let fill = String.make (max (size_x - String.length el) 0) ' ' in
      I.strf "%s%s" ~attr:A.(st reverse) el fill |> I.pad ~l:0 ~t:i)
    else I.strf "%s" el |> I.pad ~l:0 ~t:i