Page 1 of 1

commenting code

Posted: Tue Jul 20, 2004 8:37 pm
by jimmeans
How about a way to select lines of code and have it commented out? The syntax files already define what is commented code, so Textpad already recognizes commented code. It seems like it would be easy to apply the syntax definition to selected text.

(Un)commenting lines of code

Posted: Wed Jul 21, 2004 7:58 am
by skaemper
Hi,

depending on what language you use, you might look for the already existing macros that do just that for you. You might like to look at the TextPad macros page.
If the existing macros don't fit your language, because they don't use the comment character(s) your language uses, just recored your own macro.
It should go something like
  1. Go to the first position in the line
  2. Insert the comment character(s)
  3. Move (the cursor) one line down
And let the macro run through the selected text.
Uncommenting lines of code, being equally useful, works very similar.
Another way you could try to achieve that is to use search & replace, but I haven't tried that and I'm not sure about what exactly TextPad searches for, when searching happenes in a macro (could well be the last search phrase you entered...)
That said, I'd rather not see this added as a default feature in TextPad since it's so easily added with TextPad itself.

Hope that helped

Stephan

Posted: Sat Jul 24, 2004 6:44 pm
by SLerman
Or just use a clip book. Take a look at samples\htmltags.tcl to see how to put stuff around selected text.