Bug 46438 - EasyHack: ctrl-g to re-search in the search bar ...
Summary: EasyHack: ctrl-g to re-search in the search bar ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.6.0
Keywords: difficultyInteresting, easyHack, skillCpp, topicCleanup
: 36887 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-22 03:23 UTC by Michael Meeks
Modified: 2015-12-16 00:25 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
add ctrl-g to re-search (922 bytes, patch)
2012-02-24 12:01 UTC, Cameron Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2012-02-22 03:23:53 UTC
If you do: ctrl-f you get a nice search popup in writer, that is lovely ...

As all right thinking people know, ctrl-g should give you the next search hit :-) but this doesn't work ...

The code for this lurks in:

svx/source/tbxctrls/tbunosearchcontrollers.cxx

If we want to hard-code the keybindings, we could perhaps do that by hooking into the PreNotify method, might work nicely.

An ideal solution would also add a "case-sensitive" check-box to the toolbar, and (in a nutshell) make it as sexy as the mozilla one - but perhaps that should be a separate easy hack.

Thanks ! :-)
Comment 1 Cameron Paul 2012-02-24 12:01:33 UTC
Created attachment 57606 [details]
add ctrl-g to re-search
Comment 2 Cameron Paul 2012-02-24 12:06:34 UTC
Addendum to my attachment (because I apparently don't know how to use bugzilla). This is my first attempt at contributing to libreoffice so it might not be the ideal solution, but it appears to work.
Comment 3 Michael Meeks 2012-02-25 04:31:43 UTC
Ooh - looks nice ! :-)

Any chance of a reverse search ? I forget what the binding is for that ?

Otherwise will merge Monday ... Thanks !
Comment 4 Cameron Paul 2012-02-25 19:23:06 UTC
ctrl-shift-g is the sequence to search backwards. The code that searches when you hit enter already had a condition in it to search backwards when you hold shift. Since I only added on to the if statement surrounding that code, you get ctrl-shift-g to search backwards for free.

There is one possible problem, however. When you change the direction you are searching, the first input is ignored. For example, if you try to advance forward, reverse, reverse, the first reverse will be ignored. This applies to using enter/ctrl-g as well as the up and down arrow buttons on the search popup. I don't know if this is a bug or desired behavior, but it seems inconsistent with other applications.

In the event that it is considered a bug, I've started looking in to how to change it. Also working on the case-sensitive check box you asked for.
Comment 5 Michael Meeks 2012-02-27 07:58:59 UTC
Hi Paul - silly me, thanks for the explanation (and the nice patch) :-)

Any chance you can mail the developers list libreoffice@lists.freedesktop.org with an MPL/LGPLv3+ license statement, and link yourself into here:

http://wiki.documentfoundation.org/Development/Developers

Pushed it to master, will be in 3.6 - thanks !
Comment 6 Not Assigned 2012-02-27 08:04:19 UTC
Cameron Paul committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d281971d62cc52c496487933ec699605f1a9b209

fdo#46438 - add ctrl-g / ctrl-shift-g binding for find again fwd/back
Comment 7 Jan Holesovsky 2012-03-01 03:26:11 UTC
Cameron: This is great, thanks a lot for the patch!  Unfortunately it may conflict with Ctrl-g in other locales than en-US; would you be able to update your patch so that instead of hardcoding it in svx/source/tbxctrls/tbunosearchcontrollers.cxx, you'd change:

officecfg/registry/data/org/openoffice/Office/Accelerators.xcu

so that:

1) you remove .uno:RepeatSearch from "F_SHIFT_MOD1", and instead use

<value xml:lang="en-US">.uno:RepeatSearch</value>

in <node oor:name="G_MOD1" oor:op="replace">

2) actually, to implement also the search backward, I'd try to change the '.uno:RepeatSearch' to '.uno:DownSearch', and also introduce G_SHIFT_MOD1 that would be bound to '.uno:UpSearch'

Can you please try that?  Thank you a lot!

[I am reopening this bug so that we can track this, but your patch is already in, and will be in the release, unless you can dive into the above mentioned config, and move the fix there :-)]
Comment 8 Cameron Paul 2012-03-01 17:55:50 UTC
Jan,

I should be able to take care of that. Thanks for providing the pointers on how to improve this.
Comment 9 Cameron Paul 2012-03-01 18:35:50 UTC
Jan,

After doing a little testing it seems your suggestions might not work (At least not on linux, I can't say for sure on other systems). The shortcuts defined in Accelerators.xcu seem to only apply when the document is selected. When a text field in a toolbar is selected, they have no effect. This means when the find bar has focus ctrl-g would be ignored.

If the toolbars are eating key events as I suspect they are, then ctrl-g will be ignored anyway when the find bar is selected and the hard coded solution wouldn't interfere with anything defined in Accelerators.xcu. Unfortunately I can't guarantee that is consistent behavior.
Comment 10 Michael Meeks 2012-05-08 13:17:34 UTC
lets close this out then to tidy up - thanks Cameron :-)
Comment 11 Korrawit Pruegsanusak 2012-05-09 04:10:11 UTC
For a record, Jan Holesovsky added F3 for find next as well. (and of course Shift+F3 still do find previous)

http://cgit.freedesktop.org/libreoffice/core/commit/?id=c6ec7ed43b0861e1c96d62aa75b594b1dd81e315
Comment 12 Rainer Bielefeld Retired 2012-07-18 13:13:57 UTC
*** Bug 36887 has been marked as a duplicate of this bug. ***
Comment 13 Robinson Tryon (qubit) 2015-12-16 00:25:14 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyInteresting,SkillCpp,TopicCleanup )
[NinjaEdit]