summaryrefslogtreecommitdiff
path: root/lib/text.ml
diff options
context:
space:
mode:
authorFederico Igne <undyamon@disroot.org>2024-01-11 19:31:31 +0100
committerFederico Igne <undyamon@disroot.org>2024-01-11 19:31:31 +0100
commit055c743c55bde27f4475d3434c26d8383c0c3ea1 (patch)
treeaabf2173a9995f5795da86d5676181b62fee0e9e /lib/text.ml
parent416c56656af65d656f637dc8c8fdb62d0ba03e29 (diff)
downloadsandy-055c743c55bde27f4475d3434c26d8383c0c3ea1.tar.gz
sandy-055c743c55bde27f4475d3434c26d8383c0c3ea1.zip
bulk: add PoC of vim-like modular editor
Diffstat (limited to 'lib/text.ml')
-rw-r--r--lib/text.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/text.ml b/lib/text.ml
new file mode 100644
index 0000000..ff1f727
--- /dev/null
+++ b/lib/text.ml
@@ -0,0 +1,10 @@
1open Base
2open Sequence
3open Sequence.Infix
4
5let center ~fill n text =
6 let padding = repeat fill and len_t = length text in
7 let len_p = (n - len_t) / 2 in
8 take (take padding len_p @ text @ padding) n
9
10let extend ~fill n text = take (text @ repeat fill) n