Bug 394545

Summary: katepart find/replace does not recognize \n in some contexts
Product: [Applications] kate Reporter: Shriramana Sharma <samjnaa>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: 17.12.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.50
Sentry Crash Report:

Description Shriramana Sharma 2018-05-22 05:40:43 UTC
I am using Kate/KWrite on a fresh install of Kubuntu Bionic.
 
I was trying to manually convert a plaintext file to HTML so tried to replace '\n' (without quotes of course) to '<br />\n' but I found that <br /> isn't added to empty lines or lines with pure whitespace (line below ddf in following example has a space) and the last line:

BEFORE FIND/REPLACE:

sadfasdf
asdfas

asdfl
asdfflsdflasd
ddf
 

adflkasf
asflkaflkasf

AFTER FIND/REPLACE:

sadfasdf<br />
asdfas

asdfl<br />
asdfflsdflasd<br />
ddf<br />
 

adflkasf<br />
asflkaflkasf
Comment 1 Shriramana Sharma 2018-05-22 06:02:53 UTC
Sorry for the multiple posts but on closer examination I find the behaviour is much more curious. For an input file such as below (ignore the dashed lines):

---

a
b
---

... having a newline before the 'a', after the 'b' and between them, only the one between them is recognized.

But go to the line after 'b', type one letter and immediately backspace and try the find/replace again, presto the newline after 'b' is recognized, but only once. Try that again and it is no longer recognized!

Likewise go to the line before 'a', type one letter and immediately backspace and try the find/replace again, presto the newline before 'a' is recognized.

This is very strange to say the least…

I should also note that the same behaviour is seen in KDevelop as well presumably because it uses the same Katepart.
Comment 2 Dominik Haumann 2018-08-15 09:13:16 UTC
This is fixed for KDE Frameworks 5.50, see bug #381080.

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