diff options
Diffstat (limited to '')
-rw-r--r-- | lib/compontent.ml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/compontent.ml b/lib/compontent.ml new file mode 100644 index 0000000..ecdce4b --- /dev/null +++ b/lib/compontent.ml @@ -0,0 +1,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 |