In practice it is possible to be in a parent of the Favorites folder and expand items so that the symbolic links in favorites can be selected, this commit does not handle that case, as we would then also need to handle the case where items both inside and outside the Favorites folder were selected (at the same time).
Users who do these things are probably aware of how symbolic links work, and can use “Move to Trash”.
Closes#1089
If we have multiple overlapping captures and define rules for one of these, the scopes would not be stacked correctly.
Unfortunately the fix (for this rare edge case) does degrade parser speed, as we need to switch to an alternative way of keeping track of scopes, yet for injection grammars, we need to also keep the old system (to have the “current” scope available as a scope_t instance), so while the new system is almost as fast as the old, using both is not.
There should be a few ways to optimize scope_t construction, so that this part will add less overhead in the future (I think it’s roughly 5-10% of parsing time spent to scope_t related stuff).
Since parsing is done in a separate thread, and it works with pointers, we need to ensure that the grammar is retained for at least as long as the thread lives.
It seems to be a general trend with network file systems to return wrong errors when they do not support a certain feature (like extended attributes and atomic swap).
A grammar_t instance now deep-copies potential grammars it includes and each call to parse_grammar() returns a new unique instance.
The latter allows mutating the grammar (by the parser) and the former ensures that grammars are not left with expired pointers (to other grammars) when bundle items are updated.
Using GCD actually makes the code slower — it might have to do with locking overhead from std::shared_ptr and onig_region_new/region_free.
Worth trying again once use of std::shared_ptr has been removed from the parser, and oniguruma regions are preallocated.
Previously we had to test if the patterns contained \A, \G, or \z, and if so, rewrite those anchors based on wether or not the current line/match position could match them.