SlickEdit Community

Archived Read Only Forums => SlickEdit 2018 v23 Beta Discussion => Topic started by: jc44 on October 10, 2018, 10:29:41 am

Title: B6: Syntax expansion & tabs
Post by: jc44 on October 10, 2018, 10:29:41 am
Hi

I was writing a new C file. My default C style has hard tabs, but for this file I wanted spaces so I turned off tabs for this document. This worked fine for ordinary lines but when I typed "for (" I suddenly ended up with hard tabs again (the indent was spaces until the syntax expansion), see attached screenshot.  I have adaptive formatting on but it claims (rightly) that it has insufficient data to do anything.

Ta

JC
Title: Re: B6: Syntax expansion & tabs
Post by: patrick on October 10, 2018, 01:31:29 pm
It looks like toggling the tab for the document doesn't communicate that setting to the beautifier.  So whenever a syntax expansion consults the beautifier, the profile's tab setting is used.  We'll take a look at it.
Title: Re: B6: Syntax expansion & tabs
Post by: jc44 on October 15, 2018, 11:36:22 am
Now in RC1 I have a similar and arguably stranger version of the same thing - again a header file with not enough spaces for adaptive formatting to override hard tabs, gain with tabs turned off by document.  I enclose the entire file and a couple of screenshots as I try to add an "if".  Now I understand that this is a bit of an odd file but the behaviour is still strange.

So starting where I've typed if in the 1st image (if0) then I type space (if1) and then down-arrow (if2).  Now all of this may be by design but it isn't what I was hoping for!

P.S. How is insert image meant to work in this comment editor? Poking the button didn't seem to do anything
Title: Re: B6: Syntax expansion & tabs
Post by: patrick on October 15, 2018, 01:16:48 pm
That just looks like a bug where the syntax expansion doesn't realize it's in preprocessing.  We'll look into that as well.
Title: Re: B6: Syntax expansion & tabs
Post by: Clark on October 15, 2018, 06:50:30 pm
In this case beautify while typing should be automatically disabled for syntax expansion in preprocessing. That's what's causing the lines before and after to be indented weirdly.

The syntax expansion still seems useful even if it doesn't put \ at the end of each line as long as beautify while typing does mess up all the indenting.
Title: Re: B6: Syntax expansion & tabs
Post by: jc44 on October 16, 2018, 10:04:02 am
"Beautify while typing" is off (or at least it isn't ticked in the Document drop down menu) and should be off by default.

A further point of interest is that the #define is indented with a hard tab (you should just be able to see that in the screenshot) but everything else is getting spaces though I imagine that this is just a repeat of my original bug?

Title: Re: B6: Syntax expansion & tabs
Post by: Clark on October 16, 2018, 12:16:46 pm
Do you have "Beautify alias expansions" on? That's actually the problem (Tools>Options>Languages>Application Languages>C/C++>General).
Title: Re: B6: Syntax expansion & tabs
Post by: jc44 on October 16, 2018, 12:40:30 pm
It's a fair cop! Yes, I have "Beautify syntax expansions" and "Beautify alias expansions" on. I had forgotten their existence.
Title: Re: B6: Syntax expansion & tabs
Post by: jc44 on October 18, 2018, 02:54:58 pm
There are still issues in RC2 (sorry). Once again if0 is before I type space and if1 is after.  This happened in RC1 too but I sort of hoped it was part of one of the bugs you were already fixing.  The problem is caused by the "#if VLC_VER_3"; the problem goes away if I replace it with a "#if 0".  The issue is actually quite annoying as it applies to all code in the source file after this point (code before is OK).
Title: Re: B6: Syntax expansion & tabs
Post by: patrick on October 18, 2018, 03:01:04 pm
In a nice instance of serendipity, I made a fix for this from a related java report on the forums.  This will either be in the next build or the first hotfix.
Title: Re: B6: Syntax expansion & tabs
Post by: patrick on October 23, 2018, 01:23:24 pm
Forgot to update this, the fix for the tab bug described in the first post will be fixed in a hotfix after the release. 
Title: Re: B6: Syntax expansion & tabs
Post by: jc44 on October 23, 2018, 01:30:05 pm
Ta - The very odd "if" indent looks like it is fixed in RC3.