Page 1 of 1

Single key Comment/uncomment

Posted: Wed Feb 18, 2004 9:46 pm
by Roger
Hi

I am new to programming with textpad. Is it possible to set bookmarks at multiple single lines and using a single keystroke comment lines in with a single apostrophe ' at the beginning of each bookmarked line. Same again for uncommenting. Macros are no good as they have to be re-recorded if a bookmark is changed.

TIA
Roger

Posted: Thu Feb 19, 2004 2:00 am
by CyberSlug
a collection of tools I need to update which included "Bookmark replace" It limits a replace operation to bookmarked lines. If regular expressions are used, something like this might achieve your goal (untested):
Find What: ^
Replace with: ' &

I'll keep your request in mind when I get around to updating the tools (soon I hope).

Posted: Thu Feb 19, 2004 10:49 am
by Roger
I will try your tools, many thanks.

The single keystroke comment/uncomment ( ' ) for bookmarked lines would be a boon for switching between realtime compiling and simulation (debugging) compiling. I hope you can update this tool at least in the near future.

Posted: Wed Feb 25, 2004 1:55 am
by Pbufs
I did this by using recording a macro.

1) Select a block of text.
2) Start recording the macro.
3) Hit F8 (or whatever your replace keystroke is set to).
4) Type "^" (without the double quotes) in the Find what: field.
5) Hit Tab to select the Replace with: field.
6) Type "--" in the Replace with: field.
7) Make sure Regular Expression is checked and Selected text is selected.
8) Hit Alt-A to Replace All.
9) Stop recording the macro.
10) Save, blah, whatever, and map it to a keystroke.

Sadly, I haven't figured out a way to make it uncomment with the same keystroke, so I have a second macro to uncomment that uses Find what: "^--" and Replace with: "".

I hope that is useful.