GNOME Bugzilla – Bug 724273
If caret navigation support enabled, CTRL+HOME, CTRL+END, CTRL+SHIFT+HOME, CTRL+SHIFT+END, PAGEUP, PAGEDOWN keys doesn't doing the proper cursor movement operations
Last modified: 2014-07-25 08:37:40 UTC
Dear Developers, If caret navigation support enabled, CTRL+HOME, CTRL+END, CTRL+SHIFT+HOME, CTRL+SHIFT+END, PAGEUP, PAGEDOWN keys doesn't doing the proper cursor movement operations. Reproducation steps: 1. Launch Evince, and open a PDF file. 2. Enable caret navigation support with F7 key, and click enable button. 3. Try using general cursor movement operations, the list: CTRL+HOME: jump top of the document. CTRL+END: jump end of the document. CTRL+SHIFT+HOME: select from cursor to top of the document. CTRL+SHIFT+END: select from cursor to end of the document. PAGEUP: large scroll caret up. PAGEDOWN: large scroll caret down. Expected result: this general cursor movement operations need doing general tasks, similar for example the Gedit or Libreoffice Writer applications. Actual result: this general cursor movement key combinations now nothing doing. I experience similar issue with CTRL+SHIFT+UP and CTRL+SHIFT+DOWN keystrokes (select paragraph the proper direction). I reproduced this issue both Evince 3.11.3 version and Evince 3.10.3 version in my Ubuntu 14.04 system. Attila
Yesterday reported this issue downstream level in Launchpad.net, bugreport link is following: https://bugs.launchpad.net/bugs/1279387 Attila
With evince 3.10.3 on my Fedora 20 system, whether caret navigation is on makes no difference: If the evince window is narrower than the document (i.e., a horizontal scroll bar is showing), then Ctrl+Home and Ctrl+End shift the document to the extreme left and extreme right, respectively, rather than to the extreme top and extreme bottom like they should. However, Ctrl+Home and Ctrl+End work properly when there is no horizontal scroll bar, and First Page and Last Page in the "gear" work properly in all cases. Here's the downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1068323
Created attachment 275354 [details] [review] Proposed patch for Ctrl+Home/End This patch just address Ctrl+Home/End, though it does it both for caret browsing (what this bug is about) and for scrolling (the subsequent comment). An additional fix will be needed for selection with Ctrl+Home/End. Ditto for caret navigation with Page Up/Down.
Review of attachment 275354 [details] [review]: If the view is now handling CTRL+Home/end I think we should remove the accelerators from the window, since they are inconsistent now (they go to first/last page, not begin/end document). I think you could split this patch. ::: libview/ev-view.c @@ +5318,3 @@ + return FALSE; + + ev_page_cache_ensure_page (view->page_cache, 0); This doesn't work, because it's async, it just schedules the job. I'm not sure how to solve this, though. @@ +5333,3 @@ + + last_page = ev_document_get_n_pages (view->document) - 1; + ev_page_cache_ensure_page (view->page_cache, last_page); Ditto. @@ +8480,3 @@ + +gboolean +ev_view_document_start (EvView *view) Why is this boolean? This should probably be called ev_view_first_page instead. @@ +8490,3 @@ + +gboolean +ev_view_document_end (EvView *view) Same here. CTRL + End goes to the document end, but this method jumps to the last page of the document. @@ +8494,3 @@ + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + ev_document_model_set_page (view->model, ev_document_get_n_pages (view->document) - 1); You should check there's a document already, maybe that justifies these methods to be boolean and return FALSE when view->document is NULL.
Created attachment 281564 [details] [review] Scroll to the start/end of the document when pressing <Ctrl>Home/End Scroll to the beggining/end of the doc instead of scrolling to the first/last page. In other words, <Ctrl>End goes to the end of the last page, instead of going to the beggining of that page. The <Ctrl>Home/End keyboard shortcuts are now managed by the view, instead of by the window.
Created attachment 281565 [details] [review] Move the caret to the beggining/end of the doc when pressing <Ctr>Home/end
Both patches are based on Joanie's work in her attached patch. The second patch early caches the first and last page because this info should be available to be able to move to beggining/end of the document.
Review of attachment 281564 [details] [review]: LGTM, thanks!. Please remember to add the bug URL in the commit message before pushing.
Review of attachment 281565 [details] [review]: Ok ::: libview/ev-view.c @@ +7289,3 @@ + because <Ctr>Home/End need that information */ + ev_page_cache_ensure_page (view->page_cache, 0); + ev_page_cache_ensure_page (view->page_cache, n_pages - 1); This is a bit hacky but I don't see any other solution, so let's do this for now.
Comment on attachment 281564 [details] [review] Scroll to the start/end of the document when pressing <Ctrl>Home/End Pushed to git master
Created attachment 281616 [details] [review] Move the caret to the beggining/end of the doc when pressing <Ctr>Home/end
(In reply to comment #9) > Review of attachment 281565 [details] [review]: > > Ok > > ::: libview/ev-view.c > @@ +7289,3 @@ > + because <Ctr>Home/End need that information */ > + ev_page_cache_ensure_page (view->page_cache, 0); > + ev_page_cache_ensure_page (view->page_cache, n_pages - 1); > > This is a bit hacky but I don't see any other solution, so let's do this for > now. I have updated the patch to load the first and last pages only in case the caret navigation is enabled ( attachment 281616 [details] [review] )
Comment on attachment 281616 [details] [review] Move the caret to the beggining/end of the doc when pressing <Ctr>Home/end Pushed with some minor changes.