python / python/cpython

IDLE gets confused when switching between tabs and spaces.

未关闭
#142,107 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stdlib topic-IDLE type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Bug report

Bug description:

My IDLE is set to the default 4-space indent. When I switch to using tabs through whatever the keyboard for toggle-tabs, after the popup message, the tab key generates the tab character.

If I switch back to using spaces using the same keyboard shortcut, I find that the tab key generates eight spaces instead of the usual four. I don’t think that’s the intended behaviour.

This is fixed after restarting IDLE.

CPython versions tested on:

3.14

Operating systems tested on:

Windows 11 & macOS

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在 Windows 11 或 macOS 上使用 Python 3.14,通过 toggle-tabs 键盘快捷键将 IDLE 中的四空格缩进切换为制表符,然后再切换回来,以复现该问题。跟踪 toggle-tabs 的行为,并验证切换回空格后 Tab 键会产生四个空格,而无需重启 IDLE。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
desktop, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。