aboutsummaryrefslogtreecommitdiff
path: root/lib/compontent.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-05-15 11:17:48 -0500
committerMarc Coquand <marc@mccd.space>2024-05-15 11:17:48 -0500
commitdb4e445ee0f29c1179b5d0746217e5b5525ff3e2 (patch)
tree1f30d6f7d3305d7f8becbed3297b033899d9251f /lib/compontent.ml
parent47be0ea3eeb774102f02b5f85ee974afe6a8170e (diff)
downloadstitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.tar.gz
stitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.tar.bz2
stitch-db4e445ee0f29c1179b5d0746217e5b5525ff3e2.zip
State handling done
Diffstat (limited to 'lib/compontent.ml')
-rw-r--r--lib/compontent.ml16
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