Author Topic: python autoindent failure  (Read 2434 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
python autoindent failure
« on: July 10, 2017, 07:26:45 PM »
This one has been driving me nuts, but I finally figured it out.
Sometimes in python after typing "if someting:<enter>" the next line isn't indented like it ought to be.
Example:
Code: [Select]
def myfunction(a,b,c,d):
    if a.returxcode != 0:
        pass # Autoindent works here
    if a.returncode != 0:
    pass # Autoindent FAILS here

It seems to be because "returncode" starts with "return" -- a keyword.
So even though Slick doesn't color "returncode" as a keyword, it does confuse the indenting logic somehow.

I found that "if definition:" as well as "if xdefinition:" also confuse it -- so the keyword doesn't even need to be the beginning of the identifier.


patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: python autoindent failure
« Reply #1 on: July 10, 2017, 08:00:00 PM »
Reproduced.  I suspect it's a pretty simple hotfix, I'll take a look at it.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: python autoindent failure
« Reply #2 on: August 29, 2017, 09:08:25 PM »
Still repros in Beta2.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: python autoindent failure
« Reply #3 on: September 01, 2017, 02:01:39 PM »
Whoops.  I've checked it in for beta 3.  I'll drop it into the 21.0.3 hotfix in a bit, so it should be in the next released hotfix.