Bug 413182

Summary: [KTextEditor]: "Replace" (instead of "Replace All") breaks "in selection only"
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: RJVB <rjvbertin>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: jpmbatrina01
Priority: NOR    
Version First Reported In: 5.60.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description RJVB 2019-10-19 11:22:49 UTC
SUMMARY
Using the individual "Replace" button on a search & replace limited to the current selection breaks scope of application.

STEPS TO REPRODUCE
1. Select a region of tet
2. Bring up the search & replace interface, enter a pattern and replacement
3. Select "Search in the selection only"
4. (optional?) Hit "Find All"
5. Hit Replace

OBSERVED RESULT
The 1st pattern is replaced, which changes (limits) the current selection to the replacement text. Further replacements are impossible.

EXPECTED RESULT
Hitting "Replace" repeatedly until the end of the selected region is attained should give the same result as hitting "Replace All"

SOFTWARE/OS VERSIONS
KDE Frameworks Version: 5.60.0
Qt Version: 5.9.8

ADDITIONAL INFORMATION
I observed this in KDevelop but presume the S&R functionality comes from KTextEditor.

I realise this may be tricky to implement...
Comment 1 Jan Paul Batrina 2021-04-15 07:39:54 UTC
Hello, this has been fixed with https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/128, albeit there's still a tricky problem with undo (see PR for details)

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