What I’m looking for is really well explained in this thread I found. From it:
// This is my comment. But it has been edited
// so now
// some lines are long and others are
// very short.
// Personally, I find this exceedingly ugly and I really
// can't tolerate it. However, having to manual fix this
// sort
// of thing is undesirable.
In the thread they say that emacs has this feature called M-q, where it would reformat comments while preserving the starting //.
Does Qt Creator have a similar feature? Or if not, is there a (free) standalone program that would allow me to copy and paste the comments in Qt Creator once I write them?
Press
Ctrl+E,Rwhile the cursor is in the comment block. This adds and removes//as necessary.It has a quirk though – if it is a single line comment, it will not add
//for the new lines. The workaround is to add a//line below before pressingCtrl+E,R.You also need to make sure there is a blank line separating the comment from code, otherwise it will wrap the code as well.
This is bad:
It will be wrapped incorrectly to
This is good: