Author Topic: Search in diff?  (Read 264 times)

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Search in diff?
« on: April 07, 2017, 03:46:05 pm »
Am I missing something, or is there no way to search in a Diff window?
To me, this is a crucial feature.

SE 21.0.2
Windows 7/64-bit
Vim emulation

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1787
  • Hero Points: 70
Re: Search in diff?
« Reply #1 on: April 07, 2017, 03:48:53 pm »
There is a Find button on the diff dialog.  Usually you can use Alt+F, but I'm not sure if that will work for you in Vim emulation.

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Re: Search in diff?
« Reply #2 on: April 07, 2017, 04:58:00 pm »
Dan, I'm going blind :-).
I was trying my vim search and also Ctrl-F for normal searching, as well as right-click to find it in a menu.
Good thing it wasn't a snake.
Sorry for the noise.

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Re: Search in diff?
« Reply #3 on: April 07, 2017, 05:01:01 pm »
I will say, however, that it would be nice if diff obeyed the same keys as editing.
Is there a plan for this?
What can I do for find next other than having to bring up the find dialog again?

Tim Kemp

  • Senior Community Member
  • Posts: 503
  • Hero Points: 83
Re: Search in diff?
« Reply #4 on: April 07, 2017, 06:22:56 pm »
I'm not using vim mapping, but in CUA, it's the same key as in the normal gui (Ctrl-G) to go to the next match.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1787
  • Hero Points: 70
Re: Search in diff?
« Reply #5 on: April 07, 2017, 06:51:00 pm »
I looked into this a little bit.

In the difference editor, what we're really looking for is what command the key runs.  In this case, the command to bring up the Find dialog is gui-find, and the commands find-next and find-prev are the commands you would want to do another find (or find backwards).

But in Vim mode it only seems to be bound for on the Mac.  So if you bind the commands gui-find, find-next and/or find-prev to a key in insert mode, they will work in the diff.

Just in case you don't know how to bind a key ;) https://youtu.be/22xlHPMc46w

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Re: Search in diff?
« Reply #6 on: April 07, 2017, 07:31:37 pm »
Yep, I've bound many keys. However, I'm not sure what you're referring to with "insert mode". There is a command called vi-insert-mode which I definitely know about, but there is no insert mode.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1787
  • Hero Points: 70
Re: Search in diff?
« Reply #7 on: April 07, 2017, 08:11:03 pm »
I was thinking of our old key bindings dialog (or maybe I'm just confused).  I think you used to specify Insert mode or Command mode when you bound a key in vi emulation.

It looks like you can just bind the key(s) and they should work.

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Re: Search in diff?
« Reply #8 on: April 13, 2017, 01:23:35 pm »
Sorry, deadlines got in the way.

Interestingly, it appears that gui-find is already mapped to '/' for "diff" mode. However, if I press '/', it just inserts a '/'. This is because diff has no concept of a command or insert mode like vim does.

I guess I'll just use the different key sequences supported by diff mode. But again, it would be nice if the emulation mode chosen by the user was also supported in the diff mode.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1787
  • Hero Points: 70
Re: Search in diff?
« Reply #9 on: April 13, 2017, 03:05:52 pm »
Yes, we've never really cracked doing vi's (Or Vim's) command mode in the difference editor.  For one thing, you get into command mode by pressing Esc, which closes the dialog by default, but that's just the start.  For each command you run, it gets mapped to a special diff version. This is for a number of reasons, not the least of which is trying to keep undo in sync between the buffers (which still isn't perfect).

But it would mean mapping all the command mode vi keys to diff versions, and some may not have equivalents (for example using "2D" to delete two lines).  Plus, there really hasn't been a lot of demand for this over the last 21 years that we've shipped DIFFzilla (although it was just "diff" for a while ;))  And this doesn't even mention the ex command line, which SlickEdit does a very good job emulating and includes another set of things that would have to be re-written for diff.

I'd be happy to try to figure out a tweak for you so you could use '/' to search, but A) it would probably have to launch the gui_find dialog, and B) I'm not sure how you would insert a '/' if you needed to (you can keep typing in our diff output).

I know it's not the same, but it looks like ctrl+alt+/ is not bound in Vim mode.  You could bind that to gui_find.

davew

  • Senior Community Member
  • Posts: 195
  • Hero Points: 5
Re: Search in diff?
« Reply #10 on: April 18, 2017, 11:48:07 am »
Understand Dan. I'll make due with the Ctrl-F, Ctrl-P, and Ctrl-N in diff mode. Thanks for the help!