Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: rogeriodec on March 21, 2018, 11:50:45 pm

Title: Toggle comment not working very well
Post by: rogeriodec on March 21, 2018, 11:50:45 pm
Windows 8.1.
svn 11313
----------
Selecting 2 contiguous lines, the first one being marked as a comment and the second not, the Edit-> Toggle comment command does not reverse the first line as it should, but only comments the two lines.

Ex:
Code
//                    yant = yfrc;
                    xant = intersection.first;

After selecting the two lines and apply Toggle comment:

Code
////                    yant = yfrc;
//                    xant = intersection.first;

Is it a bug?
Title: Re: Toggle comment not working very well
Post by: oBFusCATed on March 22, 2018, 12:29:25 am
This looks like the sane behaviour in this case.
Title: Re: Toggle comment not working very well
Post by: rogeriodec on March 22, 2018, 01:11:56 am
Sorry, but I have to disagree.
Toggle means to reverse the situation of the lines.
That is, a line that is a comment, becomes a normal line and the line that is normal, becomes comment.
See Notepad ++, for example.
Code
	aaaaaaaaaaaaaaa
// xxxxxxxxxxxxxx

Select both line and press Ctrl+Q:

Code
	aaaaaaaaaaaaaaa
// xxxxxxxxxxxxxx
Title: Re: Toggle comment not working very well
Post by: oBFusCATed on March 22, 2018, 01:13:42 am
So notepad++ does nothing in this case?
Title: Re: Toggle comment not working very well
Post by: rogeriodec on March 22, 2018, 01:16:26 am
Sorry, mistyped.

After pressing Ctrl+Q (on Notepad++):

Code
	// aaaaaaaaaaaaaaa
xxxxxxxxxxxxxx
Title: Re: Toggle comment not working very well
Post by: raynebc on March 22, 2018, 08:55:39 am
I agree that toggle should work the way rogeriodec suggests, unless it's specifically intended not to toggle per-line.  Otherwise the function is of limited usefulness, such as if you had a long block of code that toggles between two different test configurations of code by swapping which part is commented.
Title: Re: Toggle comment not working very well
Post by: oBFusCATed on March 22, 2018, 11:12:47 am
Patches welcome...
Title: Re: Toggle comment not working very well
Post by: BlueHazzard on March 22, 2018, 07:28:53 pm
please open a ticket on sf, so this won't get lost....
Title: Re: Toggle comment not working very well
Post by: raynebc on March 22, 2018, 08:08:35 pm
I created ticket #650 describing some issues with the various comment functions.
Title: Re: Toggle comment not working very well
Post by: rogeriodec on March 22, 2018, 09:34:07 pm
Thank you!