Bug 447972

Summary: RegExp replace broken with replace as "\n"
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Eduardo <edzis>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: grizzlyuser, MrChristopherJacobs, rockmen1, th_k, waqar.17a, woroof
Priority: NOR    
Version First Reported In: 5.90.0   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: RegExp replace broken

Description Eduardo 2022-01-05 12:57:18 UTC
SUMMARY
RegExp replace is broken when replace string contains \n

STEPS TO REPRODUCE
Search smbols and try to replace then with \n (newline).
Please see attached video -  in the video I replaced , with |- works, then with \t (tab) - works, then with \n (newline) - does not properly.

OBSERVED RESULT
When replace contains \n, kate replaces only so much search symbols as there are lines in the editor.

EXPECTED RESULT
Everything what is searched is replaced when using RegExp.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro
KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Replace is working when replace does not contain \n (newline).
Comment 1 Eduardo 2022-01-05 13:01:32 UTC
Created attachment 145129 [details]
RegExp replace broken
Comment 2 Eduardo 2022-01-10 23:25:16 UTC
The same in 21.12.1
Comment 3 Bug Janitor Service 2022-01-11 15:05:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/247
Comment 4 Waqar Ahmed 2022-01-12 14:47:30 UTC
*** Bug 448320 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Cullmann 2022-01-13 19:34:24 UTC
Git commit 863f606b1fcf3b91b256d9167a00539289246188 by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 13/01/2022 at 19:28.
Pushed by cullmann into branch 'master'.

Find: Update working range when replacing

M  +2    -0    src/search/katesearchbar.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/863f606b1fcf3b91b256d9167a00539289246188
Comment 6 Eduardo 2022-01-14 10:51:17 UTC
thanks for quick resolution.
Comment 7 Jan Paul Batrina 2022-02-08 06:16:38 UTC
*** Bug 449767 has been marked as a duplicate of this bug. ***
Comment 8 Waqar Ahmed 2022-04-27 09:42:39 UTC
*** Bug 449767 has been marked as a duplicate of this bug. ***
Comment 9 Waqar Ahmed 2022-08-29 07:23:51 UTC
*** Bug 458236 has been marked as a duplicate of this bug. ***