Reindent Selection buggie?

Syntax highlighting, code folding, brace matching, code indenting, and function list

Reindent Selection buggie?

Postby dburgess » Mon Aug 11, 2008 6:43 pm

I just upgraded from UE ver 13.? to ver 14.10.0.1024 I understand stuff changed, yada yada yada. That all said, I reduced my issues to the lowest common denominator, and this is what I have.

New language file added to WORDFILE.UEW
Code: Select all
/L15"MyTest" Line Comment = # File Extensions = TCL TK
/Indent Strings = "{"
/Unindent Strings = "}"

(Yes it's only three lines long)

As I type an "if/else" statement with a nested "if" under the "else" the auto indents work perfectly. The code shows up as:
Code: Select all
if {$x == 100} {
    puts "Line 1"
} else {
    if {$x == 200} {
        puts "Line 2"
    }
}

Now I highlight the text, select "Format"->"ReIndent Selection", the code converts to:
Code: Select all
if {$x == 100} {
    puts "Line 1"
} else {
if {$x == 200} {
    puts "Line 2"
}
}

Why does it work correctly when typing, but not with "ReIndent Selection"?

I've tried everything I can think of to get the proper indentation, but nothing works. Can anyone please help? I'm totaly anal about proper indentation, and this is slowing sapping my will to live.

I promised I did look around the forum for a solution, but couldn't find the exact problem I'm seeing. If I missed it, please reply with the proper link. Thanks in advance for your time and consideration!
dburgess
Newbie
 
Posts: 5
Joined: Mon Aug 11, 2008 6:16 pm

Re: Reindent Selection buggie?

Postby Mofi » Tue Aug 12, 2008 3:22 am

It looks like this is a bug of the ReIndent Selection function. I have run a re-indent on your piece of code with UE v13.00a+2, v13.10a+2, v13.20a+1, v14.00b+1 and v14.10.0.1024 and the re-indent was not correct for your piece of code with any of these versions. There was definitely a change between v13.10a+2 and v13.20 because the result of the re-indentation is different between pre v13.20 versions and the later versions.

Code: Select all
if {$x == 100}
{
puts "Line 1"
} else {
if {$x == 200}
{
puts "Line 2"
}
}

re-indents perfect to

Code: Select all
if {$x == 100}
{
  puts "Line 1"
} else {
  if {$x == 200}
  {
    puts "Line 2"
  }
}


It looks like the problem are the { } around the if condition in combination with an additional opening { in the same line. UltraEdit does not recognize the matching } in the same line for the first { in the line.

Please report this bug to IDM support by email with all the additional informations written here.

In the meantime you can try if the Artistic Style Formatter produces a better result. Artistic Style is installed with UltraEdit too. But you have to configure all the options with the help page about "Artistic Style Formatter dialog" before you will get any useful output.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Reindent Selection buggie?

Postby dburgess » Tue Aug 12, 2008 3:59 pm

Mofi,

Thank you for the reply. At my first opportunity I will email suport to report the bug. Your version research should be extremly helpful to them. I know it will be for me. (Now I know how old a version I have to go back too until they create a fix.) :) I'll give the Artistic Style Formatter a go before I give up on the new version.

Thanks again for the help!!
dburgess
Newbie
 
Posts: 5
Joined: Mon Aug 11, 2008 6:16 pm


Return to Syntax Highlighting