#10772

JohnQSmith
Participant

Hmmm! IMHO, the most desirable functionality is a single, toggle command which can be assigned a keyboard shortcut, working on the current line if none is selected or on all selected lines is. If any of these are already commented out, uncomment it!

Toggle, because obviously if it is already commented out, why would you want to comment it out again?

Because the code I’m editing already has comments that I want to keep. For example,

... 
for(int i=0;i<10;i++) {
// the following line prints incremented variable
printf("\%d",i);
}
...

Using your idea, if I wanted to comment out that loop, I’d end up with

...
//for(int i=0;i<10;i++) {
the following line prints incremented variable
// printf("\%d",i);
//}
...

which would be wrong. 🙁

If I comment out that block, it should add additional comments on previously commented lines like

...
//for(int i=0;i<10;i++) {
//// the following line prints incremented variable
// printf("\%d",i);
//}
...

that way when I later uncomment it, it will be back the way it was when I started.