Code Folding Bug?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Code Folding Bug?

Post by fightcancer » Sun Jun 08, 2014 2:21 am

Code folding doesn't seem to work right when there's a dialog with a label object, all contained in a SRT. The folding seems to stop where the label object "end" tag occurs. Maybe it's working as intended.

User avatar
Marcus Tettmar
Site Admin
Posts: 7393
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Code Folding Bug?

Post by Marcus Tettmar » Mon Jun 09, 2014 2:40 pm

Probably just stretching the limits of the parsing. While we could spend time on that it is not really advisable to put a dialog inside a subroutine. Subroutines imply something that is reused, whereas dialogs should only be created once.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Re: Code Folding Bug?

Post by fightcancer » Mon Jun 16, 2014 5:21 pm

Understood. Perhaps something could be added to the help file(s).

Another bug?
When I fold my SRT, save, close and re-open the macro, the SRT is magically unfolded which makes navigating more difficult. Interestingly, the commented block of code (/* ... */) doesn't automatically unfold--only the SRT.

MS 14.1.04

fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Re: Code Folding Bug?

Post by fightcancer » Sat Jun 21, 2014 5:05 pm

This issue (the unfolding upon re-opening a macro) has existed for me in the last several versions of MS. Fixing it would make navigation significantly easier.

Also, large comments blocks (/* ... */) are also magically unfolding upon re-opening the macro.

Thanks!

fightcancer
Macro Veteran
Posts: 247
Joined: Fri Apr 15, 2005 8:32 am

Re: Code Folding Bug?

Post by fightcancer » Sat Apr 24, 2021 1:43 am

After years of consternation, I finally managed to reproduce the Folding Bug.

Create a new macro.
Paste these 6 lines of code below into it.
Fold All.
Close and save.

Upon re-opening, the top line will be distorted but can be fixed with another Fold All.

Code: Select all

/*
*/
If>a=b
/*
*/
EndIf
Using /* and */ within an If statement seems to break the folding feature.

What makes it really troublesome is that each use of /* */ inside an IF> statement delays the ability to open the topmost line (by clicking the "+" to the left) by one. So in the code below, you'd have to click the plus twice more than once (3x total) to open the first line of commented text, i.e. with /* ... */.

Code: Select all

/*
*/
If>a=b
/*
*/
/*
*/
EndIf
So after a few hundred lines of highly documented code, one must click the topmost line dozens of times to see the commented text, or Unfold All--which then requires a Fold All if you want to reduce the clutter later.

There are other spinoffs of this bug that I've noticed repeatedly over the years including 1) not being able to open some folded code (e.g. IF> statements) unless the topmost commented block is finally opened by clicking dozens of times, and 2) the cursor will appear to be on one line but actually edit code on a line above or below.

Navigation would be easier if MS would fix this bug, or at least have a KB shortcut for Fold/Unfold All. Thanks for your consideration.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts