Archaeopteryx Software, Inc.
Take Flight!Search

Wing IDE
About Us
Open Source

 Advanced Search

[wingide-users] Flaky auto-indent

Stephan R.A. Deibel
Tue, 9 Jul 2002 08:51:00 -0400 (EDT)

On Mon, 8 Jul 2002, Stephen Boulet wrote:
> My auto-indent is a bit wigged out. Here's my preferences file:
> edit.print-paper='Letter'
> edit.personality='normal'
> debug.persist-console=true
> edit.indent-style='tabs-only'
> When I do:
> for i in range(10):
> |
> the cursor is where the vertical bar is when I hit the return key after the
> colon.
> I've noticed this happening all of a sudden in the middle of an editing
> session, after which I can't get it to go back.
> It happened with the 1.14 build, then went away for a while with the 1.15
> update but appeared again.

There are three possible causes of this:

1) The most likely cause is that there is some error in the code at some
point in the file before the cursor, which makes Wing think that the
correct auto-indent point is column 0.  For example, mismatched
parentheses can do this and be non-obvious.  If you hit <tab> and it still
doesn't auto-indent to the right place, this might be the case.  Usually,
you will get an import error from Python if you try to import this file
(e.g., just try Debug Current File from the Run menu to check it... if you
make it to the first line its syntax is OK).

2) Another possible cause of this is if there is some text after the
cursor when you hit return (| is the cursor).  For example starting with:

for i in range(10):|print i

Hit return to get:

for i in range(10):
|print i

Wing doesn't auto-indent in this case because in general it's better not
to.  If this is the cause, hitting <tab> should however, auto-indent to
the right place.

3) Finally, it's possible that somehow the analysis engine is getting
confused about your code as you're editing it.  We're not aware of any
such bug, but one way to test for this is to close and reopen the file.
If that fixed it, there may be a bug in tracking edits.

If none of the above seems to reveal anything, try quitting Wing, removing
the 'cache' directory from your profiles area (~/.wingide on Posix or
profiles/[username] inside the Wing installation area on Windows), and
then restarting Wing.  This clears any possibly bad source analysis data.
If it fixes a "broken" file so auto-indent works again, this would also
indicate some sort of analysis bug.

Hope that helps... let us know if not.


- Stephan

Run by Mailman v 2.0.8

Copyright (c) 2000-2002, Archaeopteryx Software, Inc.
Legal Statements