[New-bugs-announce] [issue41608] IDLE: not remove multiple spaces if not at start of line
report at bugs.python.org
Fri Aug 21 09:26:29 EDT 2020
New submission from E. Paine <paineelisha at gmail.com>:
I could not think of a better title so will attempt to explain myself better here. Currently, the IDLE smart backspace will delete multiple whitespace up to the tab width even if it is not at the start of the line. Consider the following examples (where the | is where the cursor is when backspace is clicked - the backticks are just to show code not part of the example text):
` |abc def `: IDLE correctly deletes all four spaces as this is considered the indentation of the code.
` abc |def `: IDLE incorrectly deletes both spaces rather than just one (annoying when correcting a typo). The patch proposes IDLE just deletes one space as is normal/expected behaviour.
` abc def |`: IDLE will currently delete both spaces but the proposed patch will just delete one. This behaviour is up for debate as I personally think all trailing whitespace should be cleared by a backspace, but I also think the proposed behaviour is more consistent than the existing behaviour.
The patch (a PR to be linked shortly after issue creation) is very simple as we already have the compiled `_line_indent_re` which we can check for a full match on all text before the cursor (`chars`).
nosy: epaine, taleinat, terry.reedy
title: IDLE: not remove multiple spaces if not at start of line
versions: Python 3.10, Python 3.8, Python 3.9
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce