-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtopic-IDLEtype-featureA feature request or enhancementA feature request or enhancement
Description
In #136061,
Lines 1365 to 1385 in 561212a
# Ick. It may require *inserting* spaces if we back up over a | |
# tab character! This is written to be clear, not fast. | |
tabwidth = self.tabwidth | |
have = len(chars.expandtabs(tabwidth)) | |
assert have > 0 | |
want = ((have - 1) // self.indentwidth) * self.indentwidth | |
# Debug prompt is multilined.... | |
ncharsdeleted = 0 | |
while True: | |
chars = chars[:-1] | |
ncharsdeleted = ncharsdeleted + 1 | |
have = len(chars.expandtabs(tabwidth)) | |
if have <= want or chars[-1] not in " \t": | |
break | |
text.undo_block_start() | |
text.delete("insert-%dc" % ncharsdeleted, "insert") | |
if have < want: | |
text.insert("insert", ' ' * (want - have), | |
self.user_input_insert_tags) | |
text.undo_block_stop() | |
return "break" |
However, the complexity there comes from a loop which handles situations (files with tabs) that either cannot or should not occur; in the current default IDLE, you can't put tabs, and a space after a tab should just be deleted in a file coming from elsewhere as in indicated in #134874 (comment). Therefore, simplifying the function specification and/or deprecating IDLE to handle tabs (which we should do) will allow elimination of this piece of obsolete code, as indicated in #136061 (comment).
Metadata
Metadata
Assignees
Labels
stdlibPython modules in the Lib dirPython modules in the Lib dirtopic-IDLEtype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
No status