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

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
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: 6680
  • Hero Points: 513
Re: C99 Compound Literal indent
« Reply #1 on: September 27, 2018, 06:51:54 PM »
Fixed in beta 5

jc44

  • Senior Community Member
  • Posts: 329
  • Hero Points: 22
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: 6680
  • Hero Points: 513
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: 329
  • Hero Points: 22
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: 6680
  • Hero Points: 513
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: 6680
  • Hero Points: 513
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: 329
  • Hero Points: 22
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: 329
  • Hero Points: 22
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: 1818
  • Hero Points: 151
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: 1818
  • Hero Points: 151
Re: C99 Compound Literal indent
« Reply #10 on: October 24, 2018, 09:17:14 PM »
Fixed for the first hotfix.