Author Topic: C99 Compound Literal indent  (Read 2859 times)

jc44

  • Senior Community Member
  • Posts: 286
  • Hero Points: 18
C99 Compound Literal indent
« on: September 26, 2018, 03:00:29 pm »
Hi

When typing the following compound literal the .pitch line ends up 1 tab further indented than it should be:

            buf->type->video = (MMAL_BUFFER_HEADER_VIDEO_SPECIFIC_T){
                .planes = 1,
                    .pitch = { subpic->p[0].i_pitch }
            };

Ta

John Cox

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5784
  • Hero Points: 461
Re: C99 Compound Literal indent
« Reply #1 on: September 27, 2018, 06:51:54 pm »
Fixed in beta 5

jc44

  • Senior Community Member
  • Posts: 286
  • Hero Points: 18
Re: C99 Compound Literal indent
« Reply #2 on: October 24, 2018, 01:15:08 pm »
This seems to still happen in RC3 if you choose the structure element from the suggestion dropdown rather than typing it (you start off at the right place, but it ends up over-indented after selecting the element)

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5784
  • Hero Points: 461
Re: C99 Compound Literal indent
« Reply #3 on: October 24, 2018, 01:17:47 pm »
Please post your user.cfg.xml

jc44

  • Senior Community Member
  • Posts: 286
  • Hero Points: 18
Re: C99 Compound Literal indent
« Reply #4 on: October 24, 2018, 01:26:31 pm »
Here you go

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5784
  • Hero Points: 461
Re: C99 Compound Literal indent
« Reply #5 on: October 24, 2018, 01:35:06 pm »
I still can't reproduce this. I don't know what's different. Double check your editor version. Also, try a clean config (vs +new -sc <temp-config-directory>).

Code: [Select]
void main(int argc, char *argv[]) {
buf->type->video = (MMAL_BUFFER_HEADER_VIDEO_SPECIFIC_T){
.planes = 1,
.pitch = { subpic->p[0].i_pitch }
}
buf-type->video=(WHATEVER){
.planes=1,
.pitch={subpic-p[0].i_pitch}
}
}
« Last Edit: October 24, 2018, 01:52:24 pm by Clark »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5784
  • Hero Points: 461
Re: C99 Compound Literal indent
« Reply #6 on: October 24, 2018, 01:50:54 pm »
I think I'm not using the same steps. I typed all these manually. I never got prompted for anything.

The problem that got fixed was that the Enter key (and tab key indenting), wouldn't indent properly for this.

jc44

  • Senior Community Member
  • Posts: 286
  • Hero Points: 18
Re: C99 Compound Literal indent
« Reply #7 on: October 24, 2018, 02:02:43 pm »
Hmmm... The issue is still reliable in the source file where I observed it, but doesn't happen in the trivial file I was building for you to test with.  I'll continue to see if I can nail it down.

jc44

  • Senior Community Member
  • Posts: 286
  • Hero Points: 18
Re: C99 Compound Literal indent
« Reply #8 on: October 24, 2018, 02:11:40 pm »
OK I can reproduce in a trivial file (enclosed).

Put your cursor at the end of the ".x = 1," line, type return, type '.', hit down-arrow to select ".height", hit return to use it, .height is now indented one tab stop too many.

Oddly this doesn't occur if I attempt to assign the RECT to a local RECT variable, it only occurs when assigning to a structure member.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1527
  • Hero Points: 139
Re: C99 Compound Literal indent
« Reply #9 on: October 24, 2018, 02:32:49 pm »
Reproduced.  We'll take a look at it.  I'm pretty sure this is hot-fixable.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1527
  • Hero Points: 139
Re: C99 Compound Literal indent
« Reply #10 on: October 24, 2018, 09:17:14 pm »
Fixed for the first hotfix.