GNOME Bugzilla – Bug 694143
Command line option --find does not update the searchbox contents if document already open
Last modified: 2013-05-08 19:52:15 UTC
_Summary_: The command line switch --find can be used to trigger a search on opening the document (or currently on manually engaging a search therafter, as described here: https://bugzilla.gnome.org/show_bug.cgi?id=694056 and https://bugzilla.gnome.org/show_bug.cgi?id=604327). However, if a document is open already the search string is not passed to evince. _Steps to reproduce_: 1. open a sample pdf file from the CLI with the --find switch set to a common expression, e.g.: evince sample.pdf --find=the (1.5. As of the writing of this post the search function is not automatically activated on opening the document (see the reports above for more information). To trigger the search you will have to hit CTRL+F after the document opens up) 2. leave the document open and perform the same command again, this time replacing the search string with a different common expression, e.g.: evince sample.pdf --find=and (2.5. Again, you will have to activate the search via CTRL+F) _Expected behaviour_: Search string in search field is replaced by newly set string _Actual behaviour_: Search string in search field remains unchanged or unset if no previous string was entered. _Importance_: The CLI interface is crucial for the integration of evince into other applications suites such as recoll (see here for an example of how the --find switch can be utilized to immediately jump to seach hits with Recoll: https://www.youtube.com/watch?v=GeeIBP8PbGE)
Created attachment 243138 [details] [review] Proposed patch to do updation of find bar string in case of reload The problem is occurring because when an already open document is loaded, the windows is 'reloaded'. Now, when the window is reloaded, the new search string is not being passed to it. Also, the reload function is not even updating the search string if it has changed. I have made a patch for this. It's working on my machine. However, the issue where the search functionality needs to be invoked manually, is still there. I hope somebody can review and comment on it.
Created attachment 243142 [details] [review] Proposed patch to do updation of find bar string in case of reload Based on gpoo's recommendation on #evince, I have updated the commit message and made sure it does not go beyond column 72.
Review of attachment 243142 [details] [review]: Thanks!, I've pushed a slightly different patch (without the code duplication and using g_clear_pointer) to git master and gnome-3-8 branch. ::: shell/ev-window.c @@ +1726,3 @@ + + g_free (ev_window->priv->search_string); + ev_window->priv->search_string = NULL; This is not needed that I've fixed bug #604327.
Created attachment 243614 [details] [review] Patch to enable automatic search when --find is used I have made another patch. This patch fixes the issue where the search needs to be triggered manually. The find bar was not appearing because on loading, focus was being transferred to the view. When this happened, the find bar was getting hidden. I have rectified the problem by making sure that on load, focus is transferred to the view only if the search was invisible. If the search bar is visible, then focus is not given to the view.
Sorry for the redundant patch, I didn't know that this problem was already solved. Just somehow missed Carlos' comment.