pwmt / zathura

Document viewer
https://pwmt.org/projects/zathura
zlib License
2.14k stars 147 forks source link

search once #648

Closed ldwgchen closed 3 months ago

ldwgchen commented 3 months ago

Instead of searching the whole document in one go, search and stop at the nearest page that produces a hit.

Fixes #132. UX won't be much different, besides that when the user views a page that hasn't been searched before, they will no longer see highlighted results in this page.

ldwgchen commented 3 months ago

Possible conflict with #450 (see also PR #644) since not all results are obtained at once. However, the proposed implementation does retain results in previously searched pages.

alerque commented 3 months ago

I would consider this a UX regression. I regularly use the search as a way to view the total instances of a key word across book length texts and see the dispersion.

image

If search results were only incremental this would be much clumsier to achieve. Returning the first result and letting the UI unlock would be nice, but the remaining instances should probably be found and highlighted in the background (and an "N of X" counter in the status bar wouldn't be a bad idea either.

laomuon commented 3 months ago

With the Vim-like command (/), I expect more or less it works like in Vim, i.e. search the whole document and have a counter for it. I agree with @alerque that this could be an UX regression.

ldwgchen commented 3 months ago

I'm personally using zathura-pdf-mupdf. I tried opening a problematic document with mupdf and found the resulting memory usage to be quite similar to what I'd get with zathura-pdf-mupdf. Thus, I believe that the root cause of #132 likely lies upstream. Since search-once is disruptive to the common use cases mentioned by @alerque and @laomuon, it's best to look for an alternative solution and close this PR for now.