Bug? B4A v5.00 Block Commenting Works Differently ... ?

Andris

Active Member
Licensed User
Longtime User
It seems to me that block commenting works differently in v5.00 (both release and BETA) than it did in previous versions. Previously, I'm sure that I was able to take an entire block of code, including existing comments, and with the block command, add another layer of comment apostrophes in the first character position of each line, keeping the existing comment structure intact. Now, when I block comment, it first takes out all the existing comment apostrophes, making all lines "code," instead of just adding apostrophes in the first column. In other words the new version acts on comment apostrophes that occur anywhere, whereas before I think it acted only on apostrophes that existed in the first column.

I like the previous way it worked much better. The new way can easily lead to coding errors.
 

thedesolatesoul

Expert
Licensed User
Longtime User
I'm not sure if that is the best way to do it?

Imagine you have a sub like this:
B4X:
'This sub will create activity stuff
Sub CreateActivityStuff
  'Generate Toolbar
  Toolbar.Generate
  'Generate Drawer
  Drawer.Generate
End Sub

Doing a block comment on this small sub:
- If the first line selected is the comment line above the sub then:
The first time all comments apostrophes will be removed and then it becomes an irreversible operation as all lines will either be comments or non-comments.​
- If the first line selected is the Sub line then:
It works pretty normally, i.e. it adds another apostrophe to the comment line essentially double commenting it, so it is a reversible operation​
 

thedesolatesoul

Expert
Licensed User
Longtime User
Everything is reversible as you can always undo the change.

I understand the issue. However I think that we need to wait awhile to see whether this is a real issue or not. Personally I prefer the single shortcut option.
I agree. I also prefer the single shortcut option.
 

klaus

Expert
Licensed User
Longtime User
I prefer the two button mode.
We know exactly what it does, one does commenting and the other uncommenting.
With the new mode we need to look first at the top lines of the block to change and choose the correct line to get the result we want.
 

Andris

Active Member
Licensed User
Longtime User
It toggles the comment state based on the state of the first line. If the first line is commented then all lines will be uncommented and vice versa.

Ah I see. OK, I can live with that. I can't believe I didn't figure that out myself! Am I wrong that this is different than pre-5.0 though? (Actually, from the above discussion, I guess it was 2-button before ... and single now). I think I prefer 2-button as well - unless the toggling worked just on the first column, in which case 1 button would be fine.
 

Troberg

Well-Known Member
Licensed User
Longtime User
I agree, I prefer the old method as well.

Even better, however, would be some kind of block comments, for example:

<'This
is
all
comments
now'>
 

sorex

Expert
Licensed User
Longtime User
but then it's a pain to uncomment 1 line inthere.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
I noticed this behaviour in the Beta but realised what was happening and thought it was by design. I soon got used to selecting a blank line above any existing comments when wanting to block comment sections out. But I admit that you do need to exercise far more care than was needed with the old system. Personally I too prefer the old way.
 
Top