Issue 16887: IDLE - tabify/untabify applied when clicking Cancel (original) (raw)

Created on 2013-01-07 20:57 by roger.serwy, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tabify.patch roger.serwy,2013-01-07 20:57 review
Messages (6)
msg179282 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-01-07 20:57
Krystian RosiƄski notified me about an error with Tabify/Untabify. Clicking cancel still performs the operation because the _asktabwidth function in Lib/idlelib/EditorWindow.py always returns a number, regardless of cancel being clicked. This bug is visibly noticeable with IdleX since it highlights all \t Tabs, but not with the original IDLE. The attached patch solves the problem.
msg185622 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-03-31 08:55
If there are no objections, I will apply this patch after 2013-04-05.
msg185806 - (view) Author: Todd Rovito (Todd.Rovito) * Date: 2013-04-02 04:16
Roger, I tested the patch and it does seem to function as you describe so feel free to apply the patch. The tabify function makes me scratch my head a little, according to help.txt: "Tabify Region -- Turns *leading* stretches of spaces into tabs (Note: We recommend using 4 space blocks to indent Python code.)" Yet this code doesn't seem to get tabifyed. a=[1,2,3,4,5] for i in range(0, len(a)): print("%d" % a[i]) I would expect that the print statement be tabbed in but on my Mac it does not seem to do that it just puts back in the single space in front of the print. This might be a separate issue but I was wondering if perhaps I misunderstand the purpose of this function?
msg185807 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-02 04:31
Todd, Tabify/Untabify are functions to deal with the great tabs vs. spaces debate (though PEP8 says that spaces are the way to go). The tabify function needs a minimum of 2 spaces before it replaces it with a tab. Its implementation in Lib/idlelib/EditorWindow.py under the tabify_region_event and untabify_region_event reveals a curiousity in its implementation. Tabify will replace spans of space characters with tabs, but still leave in extra space characters if needed. Untabify simply expands all tabs to a fixed number of spaces.
msg186173 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-07 01:31
New changeset d7aa625147f7 by Roger Serwy in branch '2.7': #16887: IDLE now accepts Cancel in tabify/untabify dialog box. http://hg.python.org/cpython/rev/d7aa625147f7 New changeset 5451b82104f3 by Roger Serwy in branch '3.3': #16887: IDLE now accepts Cancel in tabify/untabify dialog box. http://hg.python.org/cpython/rev/5451b82104f3 New changeset 54f6d8c4dfaf by Roger Serwy in branch 'default': #16887: merge with 3.3. http://hg.python.org/cpython/rev/54f6d8c4dfaf
msg186174 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-07 01:33
Closing the issue as fixed.
History
Date User Action Args
2022-04-11 14:57:40 admin set github: 61091
2013-04-07 01:33:08 roger.serwy set status: open -> closedresolution: fixedmessages: +
2013-04-07 01:31:59 python-dev set nosy: + python-devmessages: +
2013-04-02 04:31:28 roger.serwy set messages: +
2013-04-02 04:16:05 Todd.Rovito set messages: +
2013-03-31 17:00:47 Todd.Rovito set nosy: + Todd.Rovito
2013-03-31 08:55:56 roger.serwy set assignee: roger.serwymessages: + versions: - Python 3.2
2013-01-14 22:02:21 asvetlov set nosy: + asvetlov
2013-01-12 01:44:56 terry.reedy set nosy: + terry.reedy
2013-01-07 20:57:42 roger.serwy create