Author Topic: B3: "if" brace style next line not respected  (Read 750 times)

rowbearto

  • Senior Community Member
  • Posts: 1464
  • Hero Points: 110
B3: "if" brace style next line not respected
« on: September 11, 2017, 02:08:24 pm »
I uploaded my configuration and source file to support.slickedit.com under "ifbrace.tar.gz". My configuration and source file are needed to reproduce.

In my C++ formatting, I have the brace style for "if" statements for "next line":

Tools->Options->Languages->Application Languages->C/C++->Formatting->Edit->Brace Style->Statement Styles->'if' statement blocks->"Next Line"

see attached picture "ifbrace_next_line.png"

In my source file "ifbrace.cc" go to the end of line 78, type <ENTER> and then "if<space>".

After typing the <space> can see that the opening brace for "if" is on the same line instead of next line, see attached screenshot.

« Last Edit: September 11, 2017, 02:22:14 pm by rowbearto »

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1120
  • Hero Points: 105
Re: B3: "if" brace style next line not respected
« Reply #1 on: September 11, 2017, 03:03:43 pm »
Adaptive formatting.  It's enabled, and looked at the brace style of the source file and decided it's brace style 1.  Which it is for that source file.  You'd either need to turn off adaptive formatting, or fix the source files spacing and brace style to match what you want.

rowbearto

  • Senior Community Member
  • Posts: 1464
  • Hero Points: 110
Re: B3: "if" brace style next line not respected
« Reply #2 on: September 11, 2017, 03:05:53 pm »
OK, thanks for pointing this out and for the other related issue as well, now I know the explanation and what to look for when this issue happens.

rowbearto

  • Senior Community Member
  • Posts: 1464
  • Hero Points: 110
Re: B3: "if" brace style next line not respected
« Reply #3 on: September 11, 2017, 03:34:47 pm »
I found I could keep adaptive formatting on, but turn it off for "begin/end style" so that I could have the brace on the next line if I want.

Thanks again!
Rob