diff options
author | Marc Coquand <marc@mccd.space> | 2024-05-15 11:17:48 -0500 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2024-05-15 11:17:48 -0500 |
commit | db4e445ee0f29c1179b5d0746217e5b5525ff3e2 (patch) | |
tree | 1f30d6f7d3305d7f8becbed3297b033899d9251f /lib/compontent.ml | |
parent | 47be0ea3eeb774102f02b5f85ee974afe6a8170e (diff) | |
download | stitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.tar.gz stitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.tar.bz2 stitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.zip |
State handling done
Diffstat (limited to 'lib/compontent.ml')
-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 |