Main Menu

Weird C/C++ indenting...

Started by jeffatrad, May 31, 2009, 07:19:16 PM

Previous topic - Next topic

jeffatrad

When I type "for" <enter>, it indents the line, so that my formatting looks like this:

  for(;;)
    {
      blah();
    }

Which is nuts.  How do I get standard formatting?

  for(;;)
  {
    blah();
  }

?

alex

Hello Jeff,

welcome.

I think you have not used code template after typing for, because otherwise you would get something like this:
for (int i = 0; i < |; i++)
{

}


So, if you type for () <enter> it indents it like this because HE does not know that you plan to have {} after it, and thoght you want something like this:
for (int i = 0; i < 10; i++)
sum += 10;

here code should be indented.

So, correct logic would be probably to remove additional indent after typing {, but this is not implemented now...

The formatting rules described in syntax schema in cbase_spec.xml in HippoEDIT\data\syntax folder for C Based languages:
      <FormatWords>
        <FormatWord word="public" next_line="true" range_till_next="true" pos_sent_start="1"/>
        <FormatWord word="private" next_line="true" range_till_next="true" pos_sent_start="1"/>
        <FormatWord word="protected" next_line="true" range_till_next="true" pos_sent_start="1"/>
        <FormatWord word="if" next_line="true" range_sentence="true"/>
        <FormatWord word="else" next_line="true" range_sentence="true" range_till_next="true"/>
        <FormatWord word="while" next_line="true" range_sentence="true"/>
        <FormatWord word="case" next_line="true" range_till_next="true"/>
        <FormatWord word="default" next_line="true" range_till_next="true"/>
        <FormatWord word="for" next_line="true" range_sentence="true"/>
      </FormatWords>


So what you can do is remove:
  <FormatWord word="for" next_line="true" range_sentence="true"/> from spec file. Then you wuld not get additional indenting after for <enter>. But be aware that it because it is standard schema it would be overwritten with next install...

I am planning to add regular expression based rules for indenting, but this would come later...

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

jeffatrad

I removed the format words and it works fine.

The problem I have now is that the editor just stops responding constantly.  Should I consider this beta software for now?  It's happened 4 times in the last couple days - it just stops responding.  Is there anything I can give you to track it down?

alex

Hello Jeff,

have answered on your mail.
Generally I need to know:
1) version you are using
2) is the hangs are reproducable
3) I sent you also link to version with pdbs. So you can see and send me call stacks of hanging threads.

I would try to help asap.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]