SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: jc44 on September 26, 2018, 03:00:29 pm

Title: C99 Compound Literal indent
Post by: jc44 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
Title: Re: C99 Compound Literal indent
Post by: Clark on September 27, 2018, 06:51:54 pm
Fixed in beta 5
Title: Re: C99 Compound Literal indent
Post by: jc44 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)
Title: Re: C99 Compound Literal indent
Post by: Clark on October 24, 2018, 01:17:47 pm
Please post your user.cfg.xml
Title: Re: C99 Compound Literal indent
Post by: jc44 on October 24, 2018, 01:26:31 pm
Here you go
Title: Re: C99 Compound Literal indent
Post by: Clark 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}
}
}
Title: Re: C99 Compound Literal indent
Post by: Clark 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.
Title: Re: C99 Compound Literal indent
Post by: jc44 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.
Title: Re: C99 Compound Literal indent
Post by: jc44 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.
Title: Re: C99 Compound Literal indent
Post by: patrick on October 24, 2018, 02:32:49 pm
Reproduced.  We'll take a look at it.  I'm pretty sure this is hot-fixable.
Title: Re: C99 Compound Literal indent
Post by: patrick on October 24, 2018, 09:17:14 pm
Fixed for the first hotfix.