Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28457 Discussions

Annoying VS tab behavior developed a mind of its own

dboggs
New Contributor I
296 Views

I've always had some trouble coping with some characteristics of tab behavior interacting with CR/LF, but now I'm at my wits end.

Have just been set up with a new computer + op sys (Win 8.1) + IVF  (2013sp1.3.202). Even though IVF version is not different from what I  use on other computers, nor from what others around me use, the tab behavior has developed an annoying behavior that no one else sees and I can't get rid of: after pressing <enter> the cursor goes not to the start of the next line, but rather to the first or even second tab stop, EVEN IF THE PREVIOUS LINE WAS A COMMENT with ! in column 1. I enter LOTS of comments like this and I'm getting tired of manually tabbing back to column 1 for every new line.

I have tried in every way I can see to set my options up like they were before, or like every one else has around here. But I have not had this behavior before and no one else here has either. I have experimented with the VS text editor options for Fortran - tabs for example, but those effects seem unexplainable. Is it documented exactly what they are SUPPOSED to do?

Also, sometimes pressing <enter> on a line causes the PREVIOUS line to jump right or left by one tab stop. Is this EVER SUPPOSED to happen? How would this helpful?

I'm tiring of reverse-engineering this system, wondering if others have trouble, or if the system is known to be broken.

0 Kudos
5 Replies
Steven_L_Intel1
Employee
296 Views

This could depend on the contents of the source file - the editor has an auto-indent behavior. See Tools > Options > Text Editor > Fortran > Tabs > Indenting

0 Kudos
IanH
Honored Contributor II
296 Views

My experience is that with block or smart indenting (not sure if there's a difference) in a Fortran file - comments do not influence the automatic indenting - consequently if there is a non-comment line above, then its starting column is what the auto-indent seeks. 

But... in a file with no content (or only comments) the editor for some reason prefers to automatically start new lines as if tab had been pressed, for reasons that I've never been able to decipher.  Silly workaround is to put a dummy first line into the file with a printing character in column one before you start writing your novel in the opening comments, then delete that line it when you are done.

I don't think I've seen lines jumping around after being entered, well excluding times when I've been coding under the influence of sem-sav-blanc.

0 Kudos
DavidWhite
Valued Contributor II
296 Views

The only strange behaviour I have seen is that adding a line at the end of a subprogram results in the End statement being indented 4 chars, and putting the cursor to column 5 for the new line.  This is even though the Subroutine statement is in column 1.

This behaviour is sometimes automatically repeated when opening Visual Studio automatically to the last open solution, when the cursor was left on the last statement of the subprorgram.  This automatic addition of a new line, if not noticed, results in the project being rebuilt because of a change in the source, even though I haven't done anything.

David

0 Kudos
dboggs
New Contributor I
296 Views

Thanks for the comments, especially Ian: 

...block or smart indenting (not sure if there's a difference) in a Fortran file - comments do not influence the automatic indenting - consequently if there is a non-comment line above, then its starting column is what the auto-indent seeks...

This does indeed seem to be what is happening to me--now at least (why didn't it ever do this before and why not to anyone else I work with?)

Unfortunately this is not an easy thing to fix. All of my (unindented) Fortran statements begin in column 4 or 7, and most of my comments begin in column 1. This explains why every time I try to start a new comment line the editor automatically indents me to 4 or 7, and I have to manually return to column 1. It is usually seeking the last line of code in the preceeding subroutine, which is usually and END statement beginning in column 4. It's not really practical to sprinkle dummy, nonprinting characters in column 1 throughout the code--i.e. at the end of every subroutine, since they would have to be removed every time I compile and then replaced.

I'm certain that the system did not used to behave this way. Please make it stop!

0 Kudos
IanH
Honored Contributor II
296 Views

Turn auto indenting off (Tools > Options then Text Editor > Fortran > Tabs then set Indenting to None).

I've just seen the behaviour David describes if Indenting is set to smart - with the line with the end statement jumping left by an indent as I press enter (VS2010 prof + ifort 14.0.2).  And even though it is Friday it is still a bit too early for semillon sauv-blanc, so it can't be that.

0 Kudos
Reply