Handle search URLs consistently
View a man page via ctrl-L ctrl-A
Press ctrl-S to open the search bar
Type a search (for something that would work if you searched for it from the main starting page) and press enter
It doesn't work:
Try searching again while viewing that error
That also doesn't work:
Noticed while working on !26 (closed). This will become a more serious problem if !26 (closed) (or any other solution to the same problem) is merged, because users will be viewing man pages more often and therefore more likely to execute searches while viewing them.
It seems that the search code only works if
help:gnome-help, which it isn't in other contexts. To me this suggests that the search bar's queries are treated as context-specific when it gives every impression of being a global "from anywhere to anywhere" tool.
I was not able to find documentation on the breadth and depth of what
xref: URLs are for (or deduce if by auditing the code, instrumenting it with debug prints, and experimenting with various work flows), but clearly they serve some function other than searching if the initial search URL produced by the search box is
xref:search=whatever, so the code for handling non-search
xref: URLs is left unchanged.
resolve_sync has a new block to handle URLs starting with
xref:search=, immediately before the existing block to handle
xref: URLs. This new code calls
resolve_xref_uri, which is the function that is called today when a search works properly, and also sets
help:gnome-help, which is its value today when a search works properly. After these changes, I can execute a search from a man page and it loads as expected.
Obviously it would be better to revamp the URL resolution code more deeply to make it make more sense, but I do not think I have a good enough understanding of it to do that yet. If there is any documentation explaining it or if anyone can summarize, please let me know and I'd be happy to make another attempt.