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.

Author terry.reedy
Recipients cheryl.sabella, louielu, rhettinger, terry.reedy
Date 2019-05-31.19:17:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1559330259.98.0.800231733033.issue23667@roundup.psfhosted.org>
In-reply-to
Content
Raymond, which definition of 'whitespace' do you intent?

Git gui also marks trailing spaces in frozen diffs.  This is much harder to do while editing as text can be read, keyed, and pasted.  Most spaces and blank lines are only temporarily trailing, before something more is added.  I believe I would dislike the idea of temporarily marking them, unless it were very subtle.  They really only need to be stripped just before saving.  So I think we should make that easy and not too intrusive. 

1. Ask if there is trailing whitespace.  For instance,
    if (text.find('\s\n') != -1) or <text ends with '\n\n'>:
        <Query 'strip?', with 'Yes' the default for .py files>

2. Add a setting to strip on save, default yes.

3. always strip trailing whitespace from .py files when saving.
Perhaps flash 'trailing whitespace stripped' to status bar.

The danger with any of these is stripping of wanted trailing whitespace in tripple-quoted string literals.  Such whitespace is rare, but I don't know how rare.

Alternate ways of making such are better in making the blanks permanently visible in any display, not just in IDLE.  The problem is teaching this.

>>> s = (
  'This is justified text\n'
  'with blank spaces.    \n'
  'It is is followed by  \n'
  'a trailing blank line.\n'
  '\n')
>>> s
'This is justified text\nwith blank spaces.    \nIt is is followed by  \na trailing blank line.\n\n'

while an error marking would tell users to do it manually.
---

I closed PR 1644 because implementing features as extensions is obsolete and because the trim function duplicates the existing function (once it is fixed to include blank lines).

I am dubious about PR 1643.  Tagging trailing whitespace as an error would suggest that the user should delete it.  With strip on save, this would be noise.
History
Date User Action Args
2019-05-31 19:17:39terry.reedysetrecipients: + terry.reedy, rhettinger, louielu, cheryl.sabella
2019-05-31 19:17:39terry.reedysetmessageid: <1559330259.98.0.800231733033.issue23667@roundup.psfhosted.org>
2019-05-31 19:17:39terry.reedylinkissue23667 messages
2019-05-31 19:17:39terry.reedycreate