Skip to content

IDLE regression: toggle tabs and change indent width functions #82817

Closed

Description

@Zero
mannequin
BPO 38636
Nosy @terryjreedy, @miss-islington
PRs
  • bpo-38636: Fix IDLE tab toggle and file indent width #17008
  • [3.8] bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008) #17274
  • [3.7] bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008) #17275
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2020-03-27.19:26:20.457>
    created_at = <Date 2019-10-29.21:14:08.474>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7', '3.9']
    title = 'IDLE regression: toggle tabs and change indent width functions'
    updated_at = <Date 2020-03-27.19:26:20.456>
    user = 'https://bugs.python.org/Zero'

    bugs.python.org fields:

    activity = <Date 2020-03-27.19:26:20.456>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-03-27.19:26:20.457>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-10-29.21:14:08.474>
    creator = 'Zero'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38636
    keywords = ['patch']
    message_count = 8.0
    messages = ['355678', '355701', '355712', '355737', '355738', '357033', '357034', '357035']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'Zero', 'miss-islington']
    pr_nums = ['17008', '17274', '17275']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38636'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Activity

    1. Zero commented on Oct 29, 2019

      Zeromannequin
      MannequinAuthor

      In the latest Python 3.8.0 installation when running IDLE on Windows, pressing "Alt + T" generates the following error:

          Exception in Tkinter callback
          Traceback (most recent call last):
            File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in __call__
              return self.func(*args)
            File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in handler
              r = l[i](event)
          TypeError: toggle_tabs_event() missing 1 required positional argument: 'event'

      Similarly, pressing "Alt + U" will generate a very similar error:

          Exception in Tkinter callback
          Traceback (most recent call last):
            File "C:\Program Files\Python38\Lib\tkinter\__init__.py", line 1883, in __call__
              return self.func(*args)
            File "C:\Program Files\Python38\Lib\idlelib\multicall.py", line 176, in handler
              r = l[i](event)
          TypeError: change_indentwidth_event() missing 1 required positional argument: 'event'
    2. added
      type-bug
      on Oct 29, 2019
    3. terryjreedy commented on Oct 30, 2019

      @terryjreedy
      Member

      Both the menu items and the short cuts for these two functions on the Format menu give these call errors. They are only visible if IDLE is started from a console.

      They work in 3.6; the regression is due to bpo-36390. These 2 functions were moved separately from the others in the 3rd PR, PR 14827, changeset 1b38922. I found the mistake and believe I have one possible version of a working fix on a new branch.

      The diff contains this comment:
      # With mixed indents not allowed, these are semi-useless and not unittested.
      I was thinking that they should be removed, but regardless, they should have been manually tested. However, in one test with 3.6, a mixed indent -- tab + 4 spaces following a 4 space tab -- did work, so I am not sure of the rule. I will try to add a unittest along with the fix.

    4. added
      3.7 (EOL)
      3.9 (EOL)
      and removed on Oct 30, 2019
    5. changed the title [-]"Alt + T" and "Alt + U" Broken in IDLE on Windows[/-] [+]IDLE regression: toggle tabs and change indent width functions[/+] on Oct 30, 2019
    6. Zero commented on Oct 30, 2019

      Zeromannequin
      MannequinAuthor

      When I start IDLE and the shell window appears, my first task is to press "Alt + T" to change from using tabs to spaces and then "Alt + U" to change from using 8 spaces to 4. This allows code pasted from the shell into an editor window or other IDE to not require reformatting since those settings seem to be common for Python code. If the defaults for these settings were to be exposed in IDLE's settings under the General tab (maybe near the new "Show line numbers in new windows" checkbox), would it be best to make that request here or to open a new bug with an enhancement suggestion?

    7. terryjreedy commented on Oct 31, 2019

      @terryjreedy
      Member
      Interesting.  The result of making these changes is legal code looking like
      >>> if a:
          if b:
              c = 3
      This has been proposed as the way Shell should work, but rejected as likely too confusing to beginners as the indented code does not look indented compared to the line above.  The use of tabs for indents in Shell has long been considered a wart that is a 'least bad solution'.

      Please hold your proposals. I intend to solve the issue by moving the prompt to a shell sidebar and use the same indent in shell as in editors. bpo-37903 has a PR under review.

    8. terryjreedy commented on Oct 31, 2019

      @terryjreedy
      Member

      The old, long discussion of Shell indents is bpo-7676 and a preceding issue reference therein. My replacement is bpo-37892.

      The PR patch is simple enough to apply by to existing 3.7.5 and 3.8.0 installs.

    9. terryjreedy commented on Nov 20, 2019

      @terryjreedy
      Member

      New changeset b846247 by Terry Jan Reedy in branch 'master':
      bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008)
      b846247

    10. miss-islington commented on Nov 20, 2019

      @miss-islington
      Contributor

      New changeset 755caaa by Miss Islington (bot) in branch '3.7':
      bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008)
      755caaa

    11. miss-islington commented on Nov 20, 2019

      @miss-islington
      Contributor

      New changeset 1322439 by Miss Islington (bot) in branch '3.8':
      bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008)
      1322439

    12. 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

    Labels

    3.7 (EOL)3.8 (EOL)3.9 (EOL)topic-IDLEtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions