Bug 402450 - commented code pasted is indented as normal code
Summary: commented code pasted is indented as normal code
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: indentation (other bugs)
Version First Reported In: 5.58.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-22 08:52 UTC by avivb
Modified: 2019-05-26 06:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.