Sublime Forum

C++ reindent not working for me

#1

This is a sample of the file. Tab stop is set to 4. It doesn’t reindent to 4 spaces, and does some other weird things

namespace
{

#ifdef WIN32
char * strchrnul(const char *s, int c)
{
char *ptr;

    ptr = (char *)strchr(s, c);
    if(ptr != NULL)
        return ptr;
    return (char *)(s+strlen(s));
}

#endif

void advanceRec( const char ** ptr)
{
*ptr = strchr( (*ptr), ‘,’ );
if( *ptr != NULL)
(*ptr)++;
}
void advanceField( const char ** ptr)
{
*ptr = strchr( (*ptr), ‘:’ );
if( *ptr != NULL)
(*ptr)++;
}

0 Likes

#2

I turned off indentation detection which helped. I also downloaded a package called SublimeAStyleFormatter which seems good so far.

0 Likes

#3

You should format something like this as code so that the issue is more clearly visible. Use triple backticks on single lines:

```
int func()
{
    return 4;
}
```
0 Likes