After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 625225 - Ctrl+G (find next) shortcut doesn't work when search bar is closed
Ctrl+G (find next) shortcut doesn't work when search bar is closed
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.0.x
Other Linux
: Normal minor
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-25 11:16 UTC by gbz
Modified: 2013-05-18 08:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for making find next/prev shortcuts work when find bar is closed (1.70 KB, patch)
2013-05-15 11:29 UTC, Jonas Danielsson
needs-work Details | Review
This one checks if the find bar was visible (3.38 KB, patch)
2013-05-16 06:33 UTC, Jonas Danielsson
committed Details | Review
This one always use an idle (3.01 KB, patch)
2013-05-16 06:34 UTC, Jonas Danielsson
none Details | Review

Description gbz 2010-07-25 11:16:59 UTC
The keyboard shortcuts Ctrl+G (find next) and its reverse Ctrl+Shift+G currently onyl works when the search bar is visible, otherwise it does nothing, even though the search string is retained. Shouldn't this work regardless of search bar visibility? At least that's how it works in most other applications like web browsers, text editors.
Comment 1 gbz 2011-01-15 17:07:28 UTC
Any comments?
Comment 2 Germán Poo-Caamaño 2013-03-19 16:22:50 UTC
If the search bar is not present and there is a text to search, Ctrl+G could show the search bar again and go to the next item.
Comment 3 Jonas Danielsson 2013-05-15 11:29:05 UTC
Created attachment 244304 [details] [review]
Patch for making find next/prev shortcuts work when find bar is closed

This simple patch makes sure we do not clear or cancel the find job when we close
the find bar.

And also make sure that find bar going visible do not cancel previous job.
Comment 4 Carlos Garcia Campos 2013-05-15 18:04:54 UTC
Review of attachment 244304 [details] [review]:

I like this patch, thanks! There's only one small problem. 

1.- CRTl+F and search something
2.- CRTl+G until you are in the last match of the current page
3.- Close the find bar
4.- CTRL+G

It jumps to the right page but the current match is not visible. This happens because the view hasn't been allocated yet after the findbar is made visible again, and ensure_rectangle_is_visible in ev-view.c is using the previous allocation. A possible solution would be to show the find bar as soon as CTRL+G is pressed, but if it was hidden do the ev_view_find_next in an idle that will happen after the allocation because it has lower priority. And of course the same for find previous.
Comment 5 Jonas Danielsson 2013-05-16 06:33:22 UTC
Thanks for review and comments! And nice catch!

Using an idle seem to work. I have two patches as suggestions. One checks if the find bar was hidden and then uses an idle and otherwise just calls the ev_view_find_{next|previous} the other always uses an idle and sidesteps the conditional logic. It looks nicer, I think.

What do you think? Posting the two different patches as attachments.
Comment 6 Jonas Danielsson 2013-05-16 06:33:53 UTC
Created attachment 244373 [details] [review]
This one checks if the find bar was visible
Comment 7 Jonas Danielsson 2013-05-16 06:34:25 UTC
Created attachment 244374 [details] [review]
This one always use an idle
Comment 8 Carlos Garcia Campos 2013-05-18 08:29:50 UTC
Review of attachment 244373 [details] [review]:

I agree the other one is cleaner, but there's no reason to wait when the find bar visibility doesn't change. I've just pushed this with a couple of minor modifications. Thank you very much.

::: shell/ev-window.c
@@ +3867,3 @@
+find_next_idle_cb (EvView *view)
+{
+	ev_view_find_next (EV_VIEW (view));

No need to cast here, it's a EvView *

@@ +3892,3 @@
+find_previous_idle_cb (EvView *view)
+{
+	ev_view_find_previous (EV_VIEW (view));

Ditto.