 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Mar 16, 2009 4:41 am
[3.05] Reformat Script is adding a '{' erroneously under certain conditions |
Start with this in an alias/trigger:
Do Reformat Script, it adds an '{' and becomes:
Code: |
#if (1)
{
{
//
//
}
|
Do Reformat Script again, it adds another '{' and becomes:
Code: |
#if (1)
{
{
{
//
//
}
|
You can do this over and over again and it will keep adding more and more brackets. It happening is dependent upon the blank line right before the '//' comment characters. |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Mar 16, 2009 6:10 am |
Weird but confirmed. Although technically it's an invalid script. Hopefully this can be fixed without too much low-level changes, but I'm sure we both know parser level changes are very tricky.
|
|
_________________ Asati di tempari! |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Mar 16, 2009 6:59 am |
Fairly sure this has been reported before. It might be on the bug list, but the idea is that you don't use Reformat Script on scripts that have errors :P
Perhaps Reformat Script should do a syntax check first, ala Ctrl+K, and if that comes up with an error, just display it instead of reformatting? |
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Mar 16, 2009 2:26 pm |
Why is the first one an invalid script? It just has a few extra blank lines here and there.
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Mar 16, 2009 5:56 pm |
Because a blank line is not allowed between the start of a block and the initial {
If you do a Ctrl-K syntax check, you will see the syntax error.
The reformat command will *only* work properly if there are NO ERRORS in the script. The reformat command uses the script parser to do the reformatting, and with a script error, the script parser cannot process your script correctly. |
|
|
 |
|
|