Recaf
Recaf copied to clipboard
Folder loses expandability when deleting one of the two remaining children

// In BaseTreeItem
if (item.isUnfilteredLeaf()) {
// It is a terminal node, can remove
parent.removeChild(item);
} else if (item.isCandidateForHiding()) {
// The item is not a true leaf, but visibly due to the filter
// it may be treated as one visually. So rather than delete
// we only want to hide the item.
parent.hideChild(item);
}
The isCandidateForHiding() method will always be true if a tree-item only has one sub-item. This becomes the case when deleting the one of the two leaves of a tree-item that has only two items.