Author Topic: Help, SE 17.0.1 Stopped inserting { } for c++  (Read 743 times)

lwb78750

  • Community Member
  • Posts: 52
  • Hero Points: 1
  • Senior Software Engineer, C++, Qt, C, etc...
Help, SE 17.0.1 Stopped inserting { } for c++
« on: July 23, 2012, 04:56:45 PM »
This may be a stupid question, but...

In SE 16 if I had the following syntax:
    if(foo)
       bar = 10;

I could just enter (I think it was) crtrl-shift-{ in front of the "bar = 10;" and the result would be this:
    if(foo)
    {
        bar = 10;
    }

Now, that doesn't seem to work anymore (or I can't figure out how to get it to work.)

Does anyone know how to get this to work in 17.0.1?

Thanks!

patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #1 on: July 23, 2012, 06:38:40 PM »
Is this C/C++?  If so, just hitting "{" there should do what you want, assuming the "{" key hasn't been rebound to something other than c-begin.  Let me know if that doesn't work for you.
--Patrick

lwb78750

  • Community Member
  • Posts: 52
  • Hero Points: 1
  • Senior Software Engineer, C++, Qt, C, etc...
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #2 on: July 23, 2012, 08:02:09 PM »
Yes, it's not ctrl-shift-{, its just {, but that doesn't work either.
I installed 17.0.1 and I get this:

    if(foo)
    {}
    bar = 20;

thanks,

davehohl

  • Community Member
  • Posts: 132
  • Hero Points: 6
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #3 on: July 23, 2012, 08:19:23 PM »
I've noticed this problem also, although I am not sure if it happened when I installed 17.0.0 or 17.0.1.

patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #4 on: July 23, 2012, 09:25:28 PM »
Strange.  There is a fix that will be in the first 17.0.1 hotfix that takes care of the problem where both of the braces get put on the same line.  But the only way I can reproduce your problem is line below the if isn't indented past the 'if' column  ie,

Code: [Select]
if (foo)
bar=20;

When "bar=20" is indented, it works for me in 17.0.1.  Maybe I'm missing something in the configuration that triggers it, I'll take another look through the code.
--Patrick

davehohl

  • Community Member
  • Posts: 132
  • Hero Points: 6
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #5 on: July 23, 2012, 11:42:09 PM »
I tried to reproduce the problem, but it seems to be working for me now, as long as I am writing "normal" code. However, I discovered a case where the problem does occur -- when the 'if' is within a block that is not part of a function. The following sample code illustrates 3 scenarios, 2 of which work and 1 which does not. Perhaps this can help you track down the source of the issue.


int u;

// *** frestanding if (not inside any function or block) works
    if(1)
        ++u;
// becomes
    if(1)
    {
        ++u;
    }

// *** if within a freestanding block does not work
{
    if(1)
        ++u;
}
// becomes
{
    if(1)
{}        ++u;
}

// *** if within a function works
void x(void)
{
    if(1)
        ++u;
}
// becomes
void x(void)
{
    if(1)
    {
        ++u;
    }
}

patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #6 on: July 24, 2012, 01:20:35 PM »
Ok, I can reproduce that, in both 16 and 17.  I'll take a look at it.
--Patrick

lwb78750

  • Community Member
  • Posts: 52
  • Hero Points: 1
  • Senior Software Engineer, C++, Qt, C, etc...
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #7 on: July 25, 2012, 03:09:13 PM »
This is the results I get.  Is there some sort of config option3I have set/not set?

// *** frestanding if (not inside any function or block) works
    if(1)
        ++u;
// becomes
    if(1)
        {}++u;
// *** if within a freestanding block does not work
{
    if(1)
       ++u;
}
// becomes
{
    if(1)
        {}++u;
}

// *** if within a function works
void x(void)
{
    if(1)
        ++u;
}
// becomes
void x(void)
{
    if(1)
        {}++u;
}
   
   
   


patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #8 on: July 25, 2012, 04:22:22 PM »
Actually, there is a quick-brace setting, but I can't find it in the UI for C/C++.  Having it turned off would give the results you're seeing.

While I try to figure out what happened to the UI for it, you can try this:  Save off the attached macro file, quickbrace.e, open it up in slickedit, and then bring up the command prompt, and run "load".  That should make sure quick-brace is enabled in your configuration.  See if it works after that.
--Patrick

Phil Barila

  • Community Member
  • Posts: 662
  • Hero Points: 53
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #9 on: July 25, 2012, 04:44:08 PM »
Actually, there is a quick-brace setting, but I can't find it in the UI for C/C++.
This would kind of suggest that SE is approaching undiscoverable.

patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #10 on: July 26, 2012, 01:19:25 PM »
The setting isn't in the UI for C/C++, it got left out for C++ and Objective-C in v17.  I'll put that back in, it will be in a hotfix sometime soon.
--Patrick

ExtremeXS

  • Community Member
  • Posts: 78
  • Hero Points: 6
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #11 on: July 27, 2012, 10:51:08 AM »
I am also getting this issue after switching from 17.0.0.8 to 17.0.1.

Do you think the missing config option is being reset after importing the config across versions and needs resetting?

Cheers

patrick

  • SlickEdit Team Member
  • Community Member
  • *
  • Posts: 171
  • Hero Points: 8
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #12 on: July 27, 2012, 01:52:51 PM »
I'm not sure yet.  I'm doing installs now to do a 17.0.0.8 -> 17.0.1 upgrade now to see if I can catch it happening.
--Patrick

ExtremeXS

  • Community Member
  • Posts: 78
  • Hero Points: 6
Re: Help, SE 17.0.1 Stopped inserting { } for c++
« Reply #13 on: July 27, 2012, 03:32:04 PM »
I also seemed to loose a 'Tick' on the 'Documents/Indent with Tabs' setting when I tried switched my current project to 17.0.1.  It *may* be another example of a C/C++ setting loss.

Cheers