[issue41608] IDLE: multiple space deletion by Backspace after non-spaces
Terry J. Reedy
report at bugs.python.org
Fri Aug 21 12:55:07 EDT 2020
Terry J. Reedy <tjreedy at udel.edu> added the comment:
Your example is 4 spaces, 3 (non-space) chars, 2 spaces, 3 chars, 2 spaces.
With the cursor after the 2 internal spaces, backspace deletes 1 space, not 2. However, with the first block expanded from 3 chars to 4, backspace deletes both spaces.
Without out looking at the code, the uniform rule, when deleting a space to the left with Backspace, seems to be "Delete up to Indent spaces, stopping at the first non-space char or at a slice position that is a multiple of Indent." Tabs in the text are interpreted as as many spaces needed to get to a position that is a multiple of 8. I tested this with longer space runs and with Indent set to 5.
Deleting a space with Delete always deletes one char. So single space deletion is available anywhere.
I consider the current behavior as a defensible design decision for a PEP 8 oriented Python code editor. Multiple space deletion is a plus when deleting large space blocks, a minus when lining up multiple continuation lines. While I could imagine turning off multiple space delete for internal blocks, I would rather trailing blocks be deleted all at once. All in all, I consider a change fairly low priority at the moment.
The prompt is 4 chars: '>>> '. Anything after that is an indent and should be treated as such. It is the first line of a mini 'file' with one statement. Treating this line differently would be a bug.
----------
title: IDLE: not remove multiple spaces if not at start of line -> IDLE: multiple space deletion by Backspace after non-spaces
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41608>
_______________________________________
More information about the Python-bugs-list
mailing list