'Insert Spaces for TABs' being ignored


#1

I have checked the ‘Insert Spaces for TABs’ option, but TABs are still being inserted. :angry:

It seemed extremely convoluted to find the option at all, so I wouldn’t be surprised if I’ve not found the right place and/or not found all the places where it has to be set to actually be effective… :confused:

So, How do I get M2MStudio to actually insert spaces for TABs??


#2

Update:

If I create a brand new file, from scratch, within M2MStudio TABs are inserted in it as spaces.

But, in other files, it continues to insert TABs.

So M2MStudio must be remembering something from somewhere for these existing files, and using that to override the setting?

So the question becomes: How do I force it to apply the ‘Insert Spaces for TABs’ setting to these files?


#3

I the case of using “old” files, if you introduce new text, the tabs are introduced as a tab or as spaces? Maybe it convert the tabs into spaces when you type them.


#4

As TABs - that is the problem.

That’s what it should do - but it doesn’t. :angry:

ie, when you press the ‘TAB’ button, it should insert the appropriate number of spaces, but it doesn’t - it inserts TAB characters. :angry: :angry:

The fact that it is inserting TAB characters is clearly seen by enabling ‘Show Whitespace Characters’ (which also shows the spaces being inserted in the “new” files where the setting is working correctly)


#5

A further update:

I did that using File > New > Other > Untitled Text File.

If I choose ‘Header File’ or ‘Source File’, then TAB characters are used.
These options use the “Templates” - so I guess it must be something to do with those templates…?

SO:

  1. How to change the templates?
  2. How to fix the existing files?

#6

Seems that the C editor is not inheriting the global editor settings about space/tabs management, but uses its own settings…
And that’s well hidden: go to Window > Preferences > C/C++ > Code Style > Edit…
Change the tab policy, save to a new profile name, and it should be OK


#7

Yes, that’s it - thanks!! :smiley:

I suppose it’s not an unreasonable place to put it, but I really think that there needs to be a note by the more “obvious” setting to point out what it does & doesn’t affect.

Actually, you have to create a new profile first, then edit it.

This is a really bad interface feature - you get an ‘edit’ button for the built-in profiles, and it will let you change the settings as much as you like, but you can’t save them! :angry:

If the ‘Edit’ button isn’t really going to allow you to properly edit a built-in profile (which must include saving the changes), then it should either be greyed-out or have a different name.
(It manages to grey-out ‘Remove’ - so the basic functionality is already there…)

Or there should be a ‘Save as…’ within the Profile Editor.


#8

I succeeded to edit the profile with the following steps:

  • Click the edit button on an existing profile
  • Modify settings --> the OK button is grayed
  • Change the profile name in the same dialog box --> the OK button is enabled again
  • save! :wink: