Bug 307608

Summary: kate's find and replace with confirmation broken with vi input mode
Product: [Applications] kate Reporter: Simon St James <kdedevel>
Component: Vi Input ModeAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: kdedevel
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Allow the search dialog to select matches in vimode when replacing

Description Simon St James 2012-09-30 10:52:27 UTC
In the latest git version of kate, using Replace instead of Replace all has no effect.

Reproducible: Always

Steps to Reproduce:
1. Create a kate file containing the text bacon scones. Switch to vi mode if not in it already
2. Open up the Replace dialog, and enter 

con

in the Find field, and 

blah

in the Replace field.
3. Press the Replace button repeatedly. 
Actual Results:  
The text remains unchanged: the cursor is positioned at the end of the matching "con" string, but does not select the string, nor replace it.

Expected Results:  
The text should read:

bablah sblahes

Pressing Next/ Previous does not select the matching portion of text, either, which is doubtless the reason why Replace does not work.

In non-vi input mode, the everything works correctly, so this is vi-input-specific.
Replace All does work as expected, even in vi input mode.
Comment 1 Simon St James 2012-09-30 14:43:37 UTC
Created attachment 74246 [details]
Allow the search dialog to select matches in vimode when replacing

Ah - looks like this is deliberate, at least during ordinary searches. I think you can make a good case that during Search & _Replace_, though, that the user would want found matches to be selected.  I've attached a patch to allow this exception.

It's a bit uglier than you'd expect, though, as KateSearchBar::selectRange was static (needed as is accessed externally by KateView via the static KateSearchBar::nextMatchForSelection) :/
Comment 2 Simon St James 2012-10-13 09:33:33 UTC
Hmmm ... actually, I see that isPower() is true even if you just want to find (and not replace), so that patch is not ideal :/ 

Maybe it would be better if I implemented an (optional) vi Ex Mode for searching - then I could have a bit more control over house find/ replace works without treading on anyone's toes :) Plus, I could add some vim-isms like C-c exiting find mode; c-r allowing vim register contents to be incorporated into the search string; etc.  Perhaps I'll send a message to the mailing list :)
Comment 3 Simon St James 2012-10-20 14:22:41 UTC

*** This bug has been marked as a duplicate of bug 182508 ***