Smart indent: comment after conditional bug?

Running 4.0.4 CE

Howdy. When I type the code as such, the smart indent sticks the cursor at the denoted spot (*). No amount of tab-mashing will get the cursor to properly line up under the hash mark.

def smartindent():
    ok = True
    if ok:
        # This is a comment

If I type something, I can press tab twice to get it to line up under the hash, but if it's a comment the problem repeats.

If there's code already in the conditional, such as:

def smartindent():
    ok = True
    if ok:
        ok = False

and I insert comment after the conditional statement followed by a return, the code indents correctly, and the cursor is at the indicated position (*).

def smartindent():
    ok = True
    if ok:
        # Inserting the comment here.
        *
        ok = False

Seems like a bug, but if it isn't, what do I need to change to get smart indent behaving in this case?

Please sign in to leave a comment.