Bug 451798

Summary: Replace all with escape sequences broken
Product: [Applications] kate Reporter: Daniel Roschka <danielroschka>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 21.12.3   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Daniel Roschka 2022-03-22 16:33:30 UTC
SUMMARY

Recently "Replace All" in the replace dialog broke in certain cases when using the "Escape sequence" mode and only replaces a subset of strings to replace. Clicking "Replace all" multiple times will continue replacing strings until the desired result is eventually reached.

STEPS TO REPRODUCE

1. Open an new document in Kate.
2. Add the following content to the document:

    1\n
    2\n
    3\n
    4\n

3. Open the search replace dialog (CTRL + R)
4. Ensure the search/replace mode is set to "Escape sequences"
5. Enter "\\n" into the "Find" input field and "\n" into the "Replace" input field
6. Click "Replace All"

OBSERVED RESULT

A toast stating "2 replacements made" and the following content in the document now:

    1
    
    2
    
    3\n
    4\n


EXPECTED RESULT

A toast stating "4 replacements made" and the following content in the document now:

    1
    
    2
    
    3
    
    4
    

SOFTWARE/OS VERSIONS

KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Comment 1 Waqar Ahmed 2022-03-22 16:59:58 UTC
was fixed in 5.91