Bug 307608 - kate's find and replace with confirmation broken with vi input mode
Summary: kate's find and replace with confirmation broken with vi input mode
Status: RESOLVED DUPLICATE of bug 182508
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: SVN
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-30 10:52 UTC by Simon St James
Modified: 2012-10-20 14:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Allow the search dialog to select matches in vimode when replacing (3.22 KB, patch)
2012-09-30 14:43 UTC, Simon St James
Details

Note You need to log in before you can comment on or make changes to this bug.
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 ***