Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Line, which starts from "elif" or "else" moves one indent level left #209

Closed

Description

@vlad0337187

Prerequisites

Description

When line starts from "elif" or "else" keyword, has some indentation (I use tabs), before it already used "return" statement and you add something to it, then it automatically moves to one indent level left.

Steps to Reproduce

  1. Maybe to check preferences to be consistent with myne. Also to use tab key (and tabs) for indentation.
  2. Make some block with indentation
  3. Add line with "if" on it; and it's block
    2.5. Include "return" statement into "if" block (or "elif" block, which is previous to that, which will be unindented).
  4. Add line with "elif" or "else" and something into it.
  5. After you'll press ":", than this line will be moved to one indentation level left.
  6. After this if you'll move this line to one indentation right - it'll be moved
  7. If you'll try to change something on this line - it'll be moved to one indentation level left again.

Expected behavior: Nothing would be moved to one indentation level left. Because functions often have several "return" statements.
Actual behavior: Line is moved to one indentation level left

Reproduces how often: Always (or often)

Versions

Atom : 1.20.0
Electron: 1.6.9
Chrome : 56.0.2924.87
Node : 7.4.0

apm 1.18.4
npm 3.10.10
node 6.9.5 x64
python 2.7.14rc1
git 2.14.1

OS: Debian Sid x64
Linux: 4.12.0-1-amd64

Atom's preferences:
____Editor tab:
________Auto Indent: True
________Auto Indent On Paste: True
________Soft Tabs: False
________Tab Type: Auto

Additional Information

Video with reproduction of this bug on YouTube: https://youtu.be/I-b7O0y13Js
In 1.20.1 this error is present too.

Activity

  1. lumbduck commented on Sep 28, 2017

    @lumbduck

    I've had this problem as well. The unwanted shifting of the indent happens in several situations while editing else and elif statements.

    I made sure that all issue-tracking prerequisites were met. One simple example follows.

    Steps to Reproduce

    1. Launch atom --safe with default configuration (I moved my configuration to a backup)
    2. Unzip and open the following python file in the editor:
      Atom_indent_issue.py.zip
    3. Place cursor on Line 4, anywhere after the 9th character (inside the condition of the line beginning with elif)
    4. Begin editing the conditional statement

    Expected behavior: I would expect the line to stay stationary as I add new content in the middle of it.

    Actual behavior: The indentation of line 4 shifts to the left

    Reproduces how often: Always

    Versions

    On Mac OSX (10.12.6)
    Atom : 1.20.1
    Electron: 1.6.9
    Chrome : 56.0.2924.87
    Node : 7.4.0

    Additional Information

    You can find many similar variations of this issue. For example, in step 3-4 above, instead simply highlight elif and type else in its place. The indentation will shift the same way.

  2. csvoss commented on Sep 28, 2017

    @csvoss

    This issue is happening to me as well. It seems to happen when my elif or else is directly after a return or pass in the previous block.

  3. Hanzhizheng commented on Oct 9, 2017

    @Hanzhizheng

    same issue

  4. eicksl commented on Oct 14, 2017

    @eicksl

    I've also been experiencing this issue, both before and after the new 1.21.1 update.

  5. Jglez2330 commented on Oct 15, 2017

    @Jglez2330

    same problem

  6. Navigat-r commented on Nov 28, 2017

    @Navigat-r

    I'm having this exact same problem. Upon finishing the line of an elif or else statement with a colon, that line unindents itself. This seems to have been an issue for quite some time, how come it's still a problem? Is it a mysterious or difficult problem to solve?

  7. csvoss commented on Nov 28, 2017

    @csvoss

    Thanks to 50Wliu's pull request #212, this is now somewhat fixed in language-python release 0.45.5, which appears to be included in core Atom release 1.23.0-beta1. If you want to get this fix, you can manually install 1.23.0-beta1 and it will be fixed! (I have tested this; it was fixed in 1.23.0-beta1 but not in 1.22.0.)

  8. Navigat-r commented on Nov 28, 2017

    @Navigat-r

    I tried it out, updating to the beta, and it seems indeed like it works! Thanks for the tip! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions