gh-77227: An IDLE option to strip trailing whitespace on save#17201
gh-77227: An IDLE option to strip trailing whitespace on save#17201ZackerySpytz wants to merge 2 commits intopython:mainpython/cpython:mainfrom ZackerySpytz:bpo-33046-strip-trailing-whitespace-optionZackerySpytz/cpython:bpo-33046-strip-trailing-whitespace-optionCopy head branch name to clipboard
Conversation
|
There are calls to |
|
I am thinking about the undo issue to make sure I agree. |
|
Having an item in the undo history is needed, otherwise undoing changes before the whitespace stripping could potentially be broken. I don't really see a way to avoid it. |
terryjreedy
left a comment
There was a problem hiding this comment.
Some of the changes you can do now, some need more input from me.
| font-bold= 0 | ||
| encoding= none | ||
| line-numbers-default= 0 | ||
| strip-trailing-whitespace-on-save= 1 |
There was a problem hiding this comment.
rstrip-on-save might be sufficient.
Except for line-numbers, the other existing items are actually for the base class used for editor, shell, and output windows. This has to be for editor windows only, at least at present. PyShell subclasses code.Interactive Interpreter, which already does some stripping before compiling. And user code output should not be touched. This different between items should somehow be more obvious on the configdialog tab. I am thinking about what to do.
If someone want to disable this, doing so for particular windows makes more sense than globally. Could we get away with having only a window option, or are there really people who would never want
| return "break" | ||
|
|
||
| def writefile(self, filename): | ||
| strip = idleConf.GetOption( |
There was a problem hiding this comment.
If rstrip_save is a per-window property, this will not work.
| 'main', 'EditorWindow', | ||
| 'strip-trailing-whitespace-on-save', type='bool') | ||
| if strip: | ||
| self.editwin.Rstrip(self.editwin).do_rstrip() |
There was a problem hiding this comment.
There is already a per-window event handler which I believe could be reused.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
On undo, I will go with what Tal says until an actual problem becomes evident. |
|
@ZackerySpytz, please address the code review. Thanks! |
|
Ping, @ZackerySpytz? |
|
This PR is stale because it has been open for 30 days with no activity. |
https://bugs.python.org/issue33046