Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » Toggle Block Comment macros
Toggle Block Comment macros [message #10006] |
Wed, 13 June 2007 13:54 |
obijohn
Messages: 11 Registered: May 2007
|
Promising Member |
|
|
EDIT: As noted in the second post below, the patch for these features actually had been included (I just didn't know where to look). So I have removed the macros from the original post and replaced them with just one, which I think might still be useful. It will uncomment a block without having to select it first.
Uncomment Block: Place the cursor anywhere in a comment block (which is delimited by /* ... */), and press ALT+* to uncomment it.
/*
Macro for uncommenting a comment block
Author: John Stoneham (no copyright claimed -- do whatever you want
with this code)
Date: June 13, 2007
*/
macro "Comment":"Uncomment Block" Alt+Shift+8
{
curr = GetCursor();
if(Find("*/"))
{
end = GetCursor() - 4;
if(Find("/*", 0))
{
start = GetCursor() - 2;
if(start < curr)
{
ClearSelection();
SetCursor(start);
Remove(2);
SetCursor(end);
Remove(2);
}
}
}
}
[Updated on: Wed, 13 June 2007 16:08] Report message to a moderator
|
|
|
Re: Toggle Block Comment macros [message #10009 is a reply to message #10006] |
Wed, 13 June 2007 15:03 |
|
Check in [ { ( " / * enclose selection in ide options (editor tab). Having this done you can press:
/ to enclose line, block of text with //
if a text is part of one line the selected text is enclosed with /* */
* to enclose block of text with /* */
ctrl + / to enclose block of text in java doc style
each operation is invertable.
|
|
|
Re: Toggle Block Comment macros [message #10011 is a reply to message #10009] |
Wed, 13 June 2007 15:57 |
obijohn
Messages: 11 Registered: May 2007
|
Promising Member |
|
|
unodgs wrote on Wed, 13 June 2007 08:03 | Check in [ { ( " / * enclose selection in ide options (editor tab). Having this done you can press:
/ to enclose line, block of text with //
if a text is part of one line the selected text is enclosed with /* */
* to enclose block of text with /* */
ctrl + / to enclose block of text in java doc style
each operation is invertable.
|
Pffftt. Nice, but I wish this had been documented somewhere before I spent the time on those macros! Oh well, it was good practice learning how to use the macro system.
Anyway, one thing I like about the second macro I wrote above is that you don't have to select the entire block to uncomment it. So what I'll do is take out the first macro from the code in the first post, and leave this one, just in case anyone else finds it useful.
As a matter of fact, I'll clean it up to remove the tilde portion so it will work with the standard block comments. And I'll change it so that it now only removes a block comment (and does so if the cursor is anywhere within the comment block), instead of toggling the comment, since inserting the comment block is built in.
|
|
|
Re: Toggle Block Comment macros [message #10015 is a reply to message #10011] |
Wed, 13 June 2007 22:45 |
|
Quote: | Pffftt. Nice, but I wish this had been documented somewhere before I spent the time on those macros! Oh well, it was good practice learning how to use the macro system.
|
It can be also a good example for others!
|
|
|
Goto Forum:
Current Time: Fri Apr 26 16:12:10 CEST 2024
Total time taken to generate the page: 0.02925 seconds
|