Search does not respect last-show-hidden correctly
Context
Thunar usually ensures that hidden files, meaning files named .*
or *~
, are not shown in simple folder listings. Similarly, it ensures that hidden folders (those named .*
) are not shown. This is controlled by the last-show-hidden
setting, and a toggle for this feature is bound to Ctrl+H.
I'm testing from git as of 61ee3b83.
Observations
Hidden files and folders logic should be applied during search, and it kind of is already. But incompletely. The result is only hidden from view if its own filename would make it hidden in an ordinary, non-search, listing.
I think that in a recursive search, the usual hidden folder logic should be applied to all parent folders up to the search root, but not including it. Thunar should not show files and folders inside hidden folders if Show Hidden is switched off.
Right now, even if you have Show Hidden switched off, Thunar will still apparently search through .git
folders and show all the matching results in there (providing the results are not themselves naturally hidden). Thunar should respect the context too.
Example
In this example, Thunar is showing files and folders matching *HEAD*
inside a search of the Thunar source. Show Hidden is switched off. However, these search results are inside the repo's .git
subfolder, and as such they should be hidden because one of their parent directories under the search root is hidden.
How to fix it?
I've tried a dubious fix already in https://gitlab.xfce.org/achadwick/thunar/-/commit/83ae0cc55399753df62eb3242739f5d6b7769056, but as noted I think this breaks more than it fixes. In particular, the user should be able to press Ctrl+H in a search result list and be able to inspect hidden files, folders, and subtrees.
I'm not sure what is the best way of fixing this.