zeal icon indicating copy to clipboard operation
zeal copied to clipboard

Docset-specific search doesn't work if query begins with colon

Open harrymander opened this issue 6 months ago • 2 comments

When searching within a docset (i.e. with the search term docset:query), the search fails if query begins with colons.

E.g. searching for the ::before CSS pseudo-element with css:::before:

Image

Adding a space before the query works, e.g. css: ::before:

Image

harrymander avatar May 10 '25 02:05 harrymander

Added fix to the search query parsing here: https://github.com/zealdocs/zeal/pull/1700

harrymander avatar May 10 '25 03:05 harrymander

After looking at the search query parsing code, I realised that the current behaviour is needed for searching for items that contain colons e.g. std::string. The workaround is to add a space after the first colon, so css: ::before is needed to search for ::before under the css keyword.

The problem was that I am writing a plugin that uses the zeal CLI to open pages by passing the exact identifier name. E.g. for my plugin to open the page for the ::before selector, it needs to be able to run

zeal "css: ::before"

However, because of the way the CLI parses its arguments, the spaces around the colon are stripped out. This means that the string css:::before is actually passed to the search input. I have added a PR that fixes this: https://github.com/zealdocs/zeal/pull/1701/

harrymander avatar May 10 '25 04:05 harrymander