Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » Toggle Block Comment macros
Toggle Block Comment macros [message #10006] Wed, 13 June 2007 13:54 Go to next message
obijohn is currently offline  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 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1355
Registered: November 2005
Location: Poland
Senior Contributor

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 Go to previous messageGo to next message
obijohn is currently offline  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. Embarassed 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 Go to previous message
unodgs is currently offline  unodgs
Messages: 1355
Registered: November 2005
Location: Poland
Senior Contributor

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!
Previous Topic: Export to PDF more than 1 page?
Next Topic: more key shortcuts
Goto Forum:
  


Current Time: Fri Nov 22 17:23:45 CET 2019

Total time taken to generate the page: 0.01354 seconds