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.

Title: IDLE option to strip trailing whitespace automatically on save
Type: enhancement Stage: patch review
Components: IDLE Versions: Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: 38862 Superseder:
Assigned To: terry.reedy Nosy List: ZackerySpytz, rhettinger, terry.reedy
Priority: normal Keywords: patch

Created on 2018-03-11 05:14 by rhettinger, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 17201 open ZackerySpytz, 2019-11-17 06:56
Messages (3)
msg313580 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-03-11 05:14
Add option to IDLE preferences in the general section to automatically run Strip Trailing Whitespace before saving.

People who use Strip Trailing Whitespace generally do so just before saving and they do it over and over again as they develop and check in code.  It would be nice to have this done automatically.  In general, trailing whitespace is almost never desireable.
msg356793 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-11-17 07:11
I have created a pull request to implement this feature.  There was also some relevant discussion in bpo-23667.
msg357032 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-11-20 06:16
I want to add EOF newline stripping before making this automatic.  Otherwise, the new feature will give people a false sense that it is all taken care of.  I opened #38862 and hope to do it tomorrow.

I may then merge Zackary's PR with any still edits of existing code,  and make fixing the General tab and its Help page a new PR.

I am thinking to make the per file option toggle, under Options, analogous to Add/Hide Linenumbers, be 'Fix/Leave Whitespace' + 'on Save' if it does not make box too wide.
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77227
2019-11-20 06:16:52terry.reedysetdependencies: + IDLE: Include end newlines in whitespace fix.
messages: + msg357032
versions: + Python 3.7, Python 3.9
2019-11-18 04:51:36terry.reedylinkissue23667 superseder
2019-11-17 07:11:52ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg356793
2019-11-17 06:56:23ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16705
2018-03-11 05:14:08rhettingercreate