bpo-23667: IDLE: Add trailing space highlight #1643
bpo-23667: IDLE: Add trailing space highlight #1643mlouielu wants to merge 1 commit into
Conversation
|
@mlouielu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rhettinger, @kbkaiser and @terryjreedy to be potential reviewers. |
terryjreedy
left a comment
There was a problem hiding this comment.
Marking whitespace as an error suggests that the user should fix it now, while it can be ignored until saving if strip on save is added. But I will leave this open until the latter is added.
| # self.file = open("file") : | ||
| # 1st 'file' colorized normal, 2nd as builtin, 3rd as string | ||
| builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" | ||
| trailing_space = any("TRAILINGSPACE", [r"[ \t]+(?=\n)"]) |
There was a problem hiding this comment.
I am not sure if these are the only whitespace chars to catch. Does not matter for now.
| head + "+%dc" % b) | ||
| if key == "TRAILINGSPACE" and b - a == 1: | ||
| self.delay_render_trailing_space = self.after( | ||
| 1000, |
There was a problem hiding this comment.
Using colorizer avoids the problem of different sources. The problem is that this is too short if the cursor is still on the line and too if it is leaving.
|
I'm thinking the strip-on-save option is the better way to go. For my purposes, the visual indications of trailing whitespace would just be distracting noise that interferes with teaching. |
|
I agree that auto-stripping whitespace is the way to go, as long as it can be turned off in the configuration. See PR GH-17201. I suggest closing this. @terryjreedy? |
|
@mlouielu Thank you for the patch. We currently want to try the alternate solution. |
https://bugs.python.org/issue23667