SlickEdit Community

Archived Read Only Forums => SlickEdit 2018 v23 Beta Discussion => Topic started by: jc44 on August 22, 2018, 02:20:06 pm

Title: B2: Bad C syntax indent
Post by: jc44 on August 22, 2018, 02:20:06 pm
If I have multilevel braceless blocks then the syntax indent only goes back one level at then end rather than going back all levels, thus:

void fn()
{
   int i,j;
   for (i = 0; i != 4; ++i)
      for (j = 0; j != 4; ++j)
         printf("Hello world\n");
      // Bad indent
}

Pretty sure this worked previously

Thanks

John Cox

Title: Re: B2: Bad C syntax indent
Post by: Clark on August 23, 2018, 12:37:44 pm
I think we can fix this.

There are some other cases which are much harder but not this one. An if then clause may be followed by an else and there there's no way to know whether the user plan's to type an else or not.
Title: Re: B2: Bad C syntax indent
Post by: jc44 on August 23, 2018, 01:01:40 pm
> An if then clause may be followed by an else and there there's no way to know whether the user plan's to type an else or not.

True but I think I would expect you to deal with that in a similar way to the way you deal with case statements in switches - assume no "else" and reindent after the user has typed it.

Title: Re: B2: Bad C syntax indent
Post by: Clark on August 23, 2018, 01:45:56 pm
That works
Title: Re: B2: Bad C syntax indent
Post by: Clark on August 23, 2018, 08:36:42 pm
Fixed for beta 3