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

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
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: 6864
  • Hero Points: 528
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: 329
  • Hero Points: 22
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: 6864
  • Hero Points: 528
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: 6864
  • Hero Points: 528
Re: B2: Bad C syntax indent
« Reply #4 on: August 23, 2018, 08:36:42 PM »
Fixed for beta 3