Author Topic: B2: Bad C syntax indent  (Read 489 times)

jc44

  • Senior Community Member
  • Posts: 216
  • Hero Points: 15
B2: Bad C syntax indent
« 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


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: B2: Bad C syntax indent
« Reply #1 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.

jc44

  • Senior Community Member
  • Posts: 216
  • Hero Points: 15
Re: B2: Bad C syntax indent
« Reply #2 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.


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: B2: Bad C syntax indent
« Reply #3 on: August 23, 2018, 01:45:56 pm »
That works

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: B2: Bad C syntax indent
« Reply #4 on: August 23, 2018, 08:36:42 pm »
Fixed for beta 3