From 661c233ce1b40863c6433b4e07c3a6eefeff9181 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 19 Feb 2020 23:36:14 +0000 Subject: [PATCH] [client] Fix cursor becoming invisible --- src/Forest/Client/NodeUtil.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Forest/Client/NodeUtil.hs b/src/Forest/Client/NodeUtil.hs index 2ccb332..1f0c031 100644 --- a/src/Forest/Client/NodeUtil.hs +++ b/src/Forest/Client/NodeUtil.hs @@ -33,7 +33,13 @@ foldVisibleNodes = foldVisibleNodes' mempty -- | Keep only those nodes that are visible according to the 'Unfolded' set. applyFolds :: Unfolded -> Node -> Node -applyFolds = foldVisibleNodes (\_ node _ -> node) +applyFolds unfolded node + | mempty `Set.member` unfolded = node {nodeChildren = children} + | otherwise = node {nodeChildren = OMap.empty} + where + children = + OMap.mapWithKey (\nid -> applyFolds $ narrowSet nid unfolded) $ + nodeChildren node -- | Return the 'Path's to a node and its subnodes in the order they would be -- displayed in.