Bug 402450

Summary: commented code pasted is indented as normal code
Product: [Frameworks and Libraries] frameworks-ktexteditor Reporter: avivb
Component: indentationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: karthik.periagaram, nate
Priority: NOR    
Version First Reported In: 5.58.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description avivb 2018-12-22 08:52:46 UTC
SUMMARY
when commenting a line, '//' is added at the start of the line (column 0)
when cutting and pasting the commented line, it's indented to match the current code, with '//' in column !=0

STEPS TO REPRODUCE
0. work with indentation
if (some_condition)
    something to comment

1. comment an indented line
if (some_condition)
//    something to comment

2. cut that line
3. paste that line

OBSERVED RESULT
if (some_condition)
    //    something to comment

EXPECTED RESULT
if (some_condition)
//    something to comment


SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Karthik Periagaram 2019-05-26 06:45:16 UTC
Cannot reproduce this on latest released packages (Arch linux, Frameworks 5.58.0, Qt 5.12.3, KWrite 19.04.1). Updating version to indicate this.

Start with following code (in empty CPP file):

(. = space, | = cursor, tested with and without vi input mode.)

if (some_condition)
....something_to_comment();|

Use Ctrl+/ to toggle comment line (this seems to append //. in front).

if (some_condition)
//.....something_to_comment();|

Highlight entire line and cut.

if (some_condition)
|

And paste.

if (some_condition)
//.....something_to_comment();

The bug appears to be resolved in the latest released version. Marking bug as resolved/fixed and closing.