homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE - tabify/untabify applied when clicking Cancel
Type: behavior Stage: patch review
Components: IDLE Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: roger.serwy Nosy List: Todd.Rovito, asvetlov, python-dev, roger.serwy, serhiy.storchaka, terry.reedy
Priority: low Keywords: patch

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:40adminsetgithub: 61091
2013年04月07日 01:33:08roger.serwysetstatus: open -> closed
resolution: fixed
messages: + msg186174
2013年04月07日 01:31:59python-devsetnosy: + python-dev
messages: + msg186173
2013年04月02日 04:31:28roger.serwysetmessages: + msg185807
2013年04月02日 04:16:05Todd.Rovitosetmessages: + msg185806
2013年03月31日 17:00:47Todd.Rovitosetnosy: + Todd.Rovito
2013年03月31日 08:55:56roger.serwysetassignee: roger.serwy
messages: + msg185622
versions: - Python 3.2
2013年01月14日 22:02:21asvetlovsetnosy: + asvetlov
2013年01月12日 01:44:56terry.reedysetnosy: + terry.reedy
2013年01月07日 20:57:42roger.serwycreate

AltStyle によって変換されたページ (->オリジナル) /