From db4e445ee0f29c1179b5d0746217e5b5525ff3e2 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Wed, 15 May 2024 11:17:48 -0500 Subject: State handling done --- lib/compontent.ml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/compontent.ml (limited to 'lib/compontent.ml') 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 -- cgit v1.2.3