File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -1368,11 +1368,18 @@ def smart_backspace_event(self, event):
13681368
13691369 # Debug prompt is multilined....
13701370 ncharsdeleted = 0
1371+ have = len (chars .expandtabs (tabwidth ))
13711372 for i in range (len (chars ) - 1 , - 1 , - 1 ):
1372- have = len (chars .expandtabs (tabwidth ))
1373- if have <= want or chars [i ] not in " \t " :
1374- break
1373+ # ``Delete'' chars[i], and subtract count
1374+ # (since redoing expandtabs is O(n))
13751375 ncharsdeleted += 1
1376+ if chars [i ] == '\t ' :
1377+ have -= tabwidth
1378+ else :
1379+ have -= 1
1380+ if have <= want or chars [i - 1 ] not in " \t " :
1381+ break
1382+ # Perform the actual removal
13761383 chars = chars [:len (chars ) - ncharsdeleted ]
13771384
13781385 text .undo_block_start ()
You can’t perform that action at this time.
0 commit comments