GLBasic forum

Main forum => GLBasic - en => Topic started by: Ian Price on 2008-Apr-01

Title: Remark blocks
Post by: Ian Price on 2008-Apr-01
Am I missing REMark/comment blocks in GLBasic?

Eg

Rather then typing // for every line that I want a comment in - like this
Code (glbasic) Select
// This is a comment/remark
// So is this
// And this
Other languages allow
Code (glbasic) Select
/* This is a comment/remark
   So is this
  And this
*/
It makes commenting out whole functions etc a doddle.

Does GLB offer this already?
Title: Remark blocks
Post by: Moru on 2008-Apr-01
If you just select the whole function you want commented out you can press ctrl+K to comment out those lines.
Title: Remark blocks
Post by: PeeJay on 2008-Apr-01
or right click - Toggle Block Comment ....
Title: Remark blocks
Post by: Ian Price on 2008-Apr-01
That'll make functions easier, but it doesn't help for a block of comments that aren't in functions (I suppose I could make them functions, but that's excessive). I'd rather /* */ than do that.
Title: Remark blocks
Post by: bigsofty on 2008-Apr-01
Quote from: PeeJayor right click - Toggle Block Comment ....
http://www.glbasic.com/forum/viewtopic.php?id=1560

Just a reminder... from Feb. ;)
Title: Remark blocks
Post by: Ian Price on 2008-Apr-01
Yes but that's still not what I requested - my required text may not be in a function - besides "Toggle Block Comment" doesn't appear to be working...

Code (glbasic) Select
If 1=0
 comment here
EndIf
This is more like it, but still not as elegant or quick as /* */ and doesn't work for whole functions, just bits of code.

We need my example, so that we can do this to short (long) comments as well as whole functions/sections of code.
Title: Remark blocks
Post by: Moru on 2008-Apr-01
Works for me, and it is not restricted to only functions, you can do it to any line in your code, just make sure you select some lines first before pressing ctrl+K

Thankfully you don't have to type:

Code (glbasic) Select
50 REM print this or that
60 REM if blah=bleh then exit sub
70 REM gosub 110
80 REM
Needless to say you got very fast at pressing arrow up and arrow left at the same time as R or E or M or something, for editing several lines at the same time. And then you where cursing because you forgot to press enter on one of the lines before typing "RUN" :-)
Title: Remark blocks
Post by: Ian Price on 2008-Apr-02
Bizzarro - Toggle block code is working now. Strange.

Cheers for the heads up and boy do i remember days of the REM statement and numbered code! :D

Case closed. Sorted. You can go about your business. Move along. Move along.
Title: Re: Remark blocks
Post by: sf-in-sf on 2012-Dec-12
Quote from: Ian Price on 2008-Apr-01
That'll make functions easier, but it doesn't help for a block of comments that aren't in functions (I suppose I could make them functions, but that's excessive). I'd rather /* */ than do that.

Here is a way to get it:

Code (glbasic) Select

inline
/*
here your out-commented code, many lines
...
and then
*/
endinline
Title: Re: Remark blocks
Post by: spicypixel on 2012-Dec-12
Having /* and */ would be cool though :) Also a + - around functions and subs to fold the code :P
Title: Re: Remark blocks
Post by: kanonet on 2012-Dec-12
To remark a big block, just select the whole block and press Ctrl+K.
You already can fold functions and subs. just double click on that blue bar in front of a function.
Title: Re: Remark blocks
Post by: Ian Price on 2012-Dec-12
This thread was created 4 and a half years ago! Talk about bring things up from the dead!

As for /* and */ I'd still prefer those to the CTRL+K (and Yes Kanonet - that was mentioned, but at the time wasn't working).
Title: Re: Remark blocks
Post by: mentalthink on 2012-Dec-12
I prefer use the K key... than put /* and */... when I do something in Arduino, for me it's very confusing, sometimes I don't know where I started or where I finished the comment...

Perhaps this can be added, and using the both options...
Title: Re: Remark blocks
Post by: spicypixel on 2012-Dec-12
Quote from: kanonet on 2012-Dec-12
To remark a big block, just select the whole block and press Ctrl+K.
You already can fold functions and subs. just double click on that blue bar in front of a function.

Aha my block is green but I have found it, thank you. I thought it was just to highlight the function itself. Would be nicer with a [-] to see that it can be folded though but glad it's there :)

One reason I want the /* */ delimiters is because in PHP I use them to do this...
Code (glbasic) Select

/*
    // start of huge code block
    // end of huge code block
/* */


Using the above example I can amend the first delimiter "/*" to comment/uncomment a block of code (because my second /* is commented out too) without having to waste time highlighting large sections and then CTRL+K'ing it. This is why I want the /* */ delimiters :D
Title: Re: Remark blocks
Post by: Kitty Hello on 2012-Dec-14
Code (glbasic) Select

?IF 0
...
?ENDIF


;)