Prevent unfolding of nodes without children

This commit is contained in:
Joscha 2020-02-09 11:44:25 +00:00
parent 909d587c53
commit 573a835022
4 changed files with 20 additions and 8 deletions

View file

@ -34,7 +34,7 @@ narrowDrawState nodeId ds = ds
nodeToWidget :: Bool -> Node -> Widget ResourceName
nodeToWidget focused node =
let nodeWidget = txt $ nodeText node
expandStyle = if null (nodeChildren node) then "noexpand" else "expand"
expandStyle = if hasChildren node then "expand" else "noexpand"
focusStyle = if focused then "focus" else "nofocus"
in withDefAttr focusStyle $ withDefAttr expandStyle nodeWidget