Bug 342466

Summary: autobrace extension adds trailing quotation mark when pasting content with line break within quoted text (min. testcase inside!)
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: Andreas Sturmlechner <asturm>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph, nb64367, zanetu
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: kwriterc

Description Andreas Sturmlechner 2015-01-03 23:00:26 UTC
This happens a lot in Gentoo ebuilds so I noticed when I was working with them. Quite nasty when you think of how this could sneak bogus quotation marks into your code.

Reproducible: Always

Steps to Reproduce:
1. Enable AutoBrace extension
2. [X] (Check) Automatically add closing quotation marks in its extension settings
3. Copy the following content (_between_ the dash lines) and insert into kwrite/kate (empty file, existing file, anything):
-------
a"b
"
c
-------

Actual Results:  
This is what you get:
-------
a"b
"
c"
-------


Actually, the absolute minimum test case is the following:
-------
a"
"
-------
Notice the remaining >a< - for this to reproduce, there must be at least one other character in the same line with a quote, no matter if in- or outside. That means the error happens also when removing all letters but >b<, however not if you remove all except >c<.
Comment 1 Andreas Sturmlechner 2015-01-03 23:04:15 UTC
The same applies to apostrophes.
Comment 2 bunu 2015-01-04 17:40:16 UTC
[I am a GCI student]

I was not able to reproduce this  for kate 3.14.2 on Ubuntu 14.10. It happened once (not in the beginning of testing). This behaviour might need further conditions to reproduce.
Comment 3 Andreas Sturmlechner 2015-01-04 18:23:54 UTC
Sorry, my version actually is 3.14.3, it just wasn't available for the report. I was able to reproduce this bug on 3 out of 3 Gentoo systems, all running KDE SC 4.14.3, on the last one I made sure that I started with a clean sheet and deleted any existing configs of kate/kwrite.

Make sure that 'closing quotation marks' is _actually_ enabled in your texteditor component. Immediately after enabling the extension, when you enter the settings, it appears to be checked by default, though it isn't. Re-opening the settings dialog is required to really enable the option.
Comment 4 bunu 2015-01-04 19:09:20 UTC
I actually did check for the 'closing quotation mark' multiple times. 
I'll make another bug report about the problem in the settings.
Comment 5 Andreas Sturmlechner 2015-01-04 20:59:08 UTC
Created attachment 90223 [details]
kwriterc

Default kwriterc with all extensions but autobrace disabled - bug reproducable.
Comment 6 bunu 2015-01-04 21:28:46 UTC
It is very nice that you post your configuration. I still can't reproduce it. Perhaps it is something about the newer kate version or to a less degree probable gentoo. Somebody else should try to look at it.
Comment 7 Zane Tu 2015-07-17 08:29:06 UTC
Reproducible with Kate 4.14.2-2 on Debian sid (amd64).
Comment 8 Christoph Cullmann 2018-08-17 20:11:36 UTC
Works in KF5 version of Kate/KWrite
Comment 9 Andreas Sturmlechner 2018-08-18 12:56:48 UTC
And this bug was reported for KF5. But I just checked, and I was not able to reproduce it with kate-18.08.0/kf-5.49.