Author Topic: Mixed hard/soft tabs (and adaptive formatting)  (Read 1334 times)

jc44

  • Senior Community Member
  • Posts: 216
  • Hero Points: 15
Mixed hard/soft tabs (and adaptive formatting)
« on: April 08, 2016, 12:40:02 pm »
Hi

Every now and again I have to work with C files that have mixed hard/soft tabs with an indent per level of 4 but a hard tab size of 8.  Personally I hate this formatting and I will beautify it if I have the choice but I often don't.  SlickEdit seems to hate it as much as I do and insists that the hard tabs only indent by 4 which makes the thing rather less readable. (Or I can set tab size to 8 which means that anything I edit goes wrong)

So my question is:
Can I separate hard tab indent size from "tab size"?

And if so then there is the follow up of "why doesn't adaptive format get it right?"

Thanks

John Cox

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: Mixed hard/soft tabs (and adaptive formatting)
« Reply #1 on: April 08, 2016, 01:49:30 pm »
Yes.

To change this for all C/C++ files:  Go to Tools>Beautify>Edit Current Profile>Indent>General. Set the syntax indent to 4 and tab stops to 8 and press OK (not the Beautify button unless you want to beautify the file).

To change tab stops for the current file only: Document>Tabs. Enter +8. I often do this for one off files which don't quite match my default settings.

jc44

  • Senior Community Member
  • Posts: 216
  • Hero Points: 15
Re: Mixed hard/soft tabs (and adaptive formatting)
« Reply #2 on: April 08, 2016, 03:05:16 pm »
Ah! Thanks.  I'm pretty sure that back in the mists of time changing the Document/Tabs setting changed the syntax indent and that was stuck in my mind. (Or maybe I'm just confused)

Either way - can adaptive format be made to do this for me when we have files like this?

Ta

John Cox

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: Mixed hard/soft tabs (and adaptive formatting)
« Reply #3 on: April 08, 2016, 11:03:45 pm »
Probably not well. Hard to say how often it will get it right. That one is tricky.

jc44

  • Senior Community Member
  • Posts: 216
  • Hero Points: 15
Re: Mixed hard/soft tabs (and adaptive formatting)
« Reply #4 on: April 11, 2016, 10:02:36 am »
As I haven't actually tried this (which always makes tasks like this appear to be easy for someone else to implement) I'll jump in and say I'd have thought it could be made to work most of the time for C files. .h files might well be tricky as they often have inadequate indenting to guess correctly.

I assume you already have some method of scoring how good a fit some level of tab spacing is to the source so you can set that correctly.  "Simply" add to each number you try the variation where you assume hard tab counts for 8 and see if the score improves noticeably - in all the cases that I have cared about that would produce the right answer - I think a hard tab size of 8 is the only case I have ever met where syntax indent & hard tab size differ.