From a2d987d58aabe0bf3e15315b2541ee6dfb309608 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 7 Mar 2026 13:35:55 +0100 Subject: add break --- src/Blessings.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/Blessings.hs') diff --git a/src/Blessings.hs b/src/Blessings.hs index 9602bf4..ebf14e2 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -433,6 +433,20 @@ instance (Eq a, Blessable a) => Blessable (Blessings a) where Empty -> (Empty, Empty) + break p = \case + Append t1 t2 -> + both normalizeHead $ + case Bless.break p t1 of + (t1l, t1r) + | t1r == mempty -> first (t1l<>) $ Bless.break p t2 + | otherwise -> (t1l, t1r <> t2) + Plain s -> + both (normalizeHead . Plain) $ Bless.break p s + SGR pm t -> + both (normalizeHead . SGR pm) $ Bless.break p t + Empty -> + (Empty, Empty) + intercalate i = \case [] -> mempty [t] -> t -- cgit v1.2.3