Skip to content

IDLE not smart indenting correctly in nested statements #52532

Closed

Description

@Tofystedeth
BPO 8285
Nosy @terryjreedy, @mdickinson, @cben
Superseder
  • bpo-7676: IDLE shell shouldn't use TABs
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-01-16.22:32:41.972>
    created_at = <Date 2010-04-01.20:50:22.879>
    labels = ['interpreter-core', 'type-bug']
    title = 'IDLE not smart indenting correctly in nested statements'
    updated_at = <Date 2012-01-17.09:44:03.308>
    user = 'https://bugs.python.org/Tofystedeth'

    bugs.python.org fields:

    activity = <Date 2012-01-17.09:44:03.308>
    actor = 'taleinat'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-01-16.22:32:41.972>
    closer = 'terry.reedy'
    components = ['Interpreter Core']
    creation = <Date 2010-04-01.20:50:22.879>
    creator = 'Tofystedeth'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 8285
    keywords = []
    message_count = 5.0
    messages = ['102134', '113007', '113026', '151413', '151433']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'mark.dickinson', 'cben', 'Tofystedeth']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'needs patch'
    status = 'closed'
    superseder = '7676'
    type = 'behavior'
    url = 'https://bugs.python.org/issue8285'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    Activity

    1. Tofystedeth commented on Apr 1, 2010

      Tofystedethmannequin
      MannequinAuthor

      huh, somehow I submitted this before I was done, sorry bout that.

      IDLE (the shell, not the text editor) doubles the indentation when in nested statements.
      For instance
      while True:
      while True:
      while True:

      becomes
      >>> while True:
              while True:
                      while True:
      backspacing removes all 8 spaces as well, so once I'm nested that far I have to manually indent.
    2. mdickinson commented on Aug 5, 2010

      @mdickinson
      Member

      I don't think this is specific to IDLE; it also happens when launching the python interpreter directly from a terminal on OS X or Linux. (BTW, what platform are you on?)

      As far as I can tell, the TAB character is simply advancing to the next tab stop; those tab stops are determined by the terminal, and can be controlled with the 'tabs' command on Linux. Though if you're using the readline library, that seems to override or reset the tab settings somehow.

    3. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      and removed on Aug 5, 2010
    4. Tofystedeth commented on Aug 5, 2010

      Tofystedethmannequin
      MannequinAuthor

      You're right, it also does it when I use the Python shell from the command prompt. I'm running Windows Vista 32bit SP2.

    5. terryjreedy commented on Jan 16, 2012

      @terryjreedy
      Member

      The current indentation is a consequent of using tabs for indents.
      Changing that is the subject of bpo-7676.
      bpo-1196946 is a similar issue.

    6. cben commented on Jan 17, 2012

      cbenmannequin
      Mannequin

      Mark: customizing tabs to be anything but 8 spaces is inadvisable with Python, because Python always parses them as 8.
      Sooner or later one would mix tabs and spaces and the result would be really painful to debug.

    7. transferred this issue fromon Apr 10, 2022
    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

      interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions