Pressing enter causes an indent?

I am using version 9.0.97.2071.

If I type in:

var x := 1;

and press enter, the new line is indented. Why would not the naturally expected thing be for the new line to be lined up beneath the previous line (assuming that the previous line wasn’t either an “if then” or “if then begin”)?

By the way, there are a lot of things with indentation that I wish I could control automatically, but specify the style I use. It would be nice if there were a style choices in options, or templates for the styles that we could optionally alter.

One thing I don’t like is the blank line after the last end in a file. Every time I make a new file, one of the first things I do is change a bunch of indentation and delete the last line. Not a horribly difficult thing to do, but it would be nicer and quicker if I didn’t have to do that.

I also like everything in the interface block to be indented and not on the left margin. And similarly for the implementation section.

But at least this indenting after the line does make sense. Maybe there is some sort of Text Edit options that make it make sense, but I couldn’t find a combination that worked the way I expected. I THINK the way this works now may be a change from the previous version of Oxygene that I was using. Not quite sure.

Marc,
for these ones, I have defined my own “new file” templates, so they are as I want :smiley:

Fire or VS?

VS 2013

I have “smart” indenting with an indent and tab size of 3 and “insert spaces”.

I’m pretty sure that is what I’ve been using for a long time.

Here is another odd piece of the puzzle. I opened up an old project, made sure the settings for the Text Editor|All Languages|Tabs were those I said above. Then I tried the new line operation described, and it worked as expected.

Then I went into the new project, checked the settings, then tried there and it didn’t work as expected.

I went back into the settings and noticed that “smart” was no longer checked. For some reason, it doesn’t seem to be saving that setting.

So perhaps there is something wrong in the saving of the settings, not how it works when the settings are correct.

Here is the code where it is happening, in case that makes a difference:

namespace VSDSUpdater.Classes;

interface

   uses 
      System.Collections.Generic;

   type
      Initialization = public class
         private
         protected
         public
            constructor;
            TableNames : List<String>;
         end;

implementation

   constructor Initialization;
      begin
      TableNames := new List<String>;

      // these tables will initialize records in the target database table with values from the source tables
      // other tables will not have column initialization
      TableNames.Add( 'VSDS_NEXT_KEY' );
      var x:= 1;

      end;

end.