Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-23667: IDLE: Add trailing space highlight #1643

Closed
mlouielu wants to merge 1 commit into
python:masterpython/cpython:masterfrom
mlouielu:bpo-23667-highlightmlouielu/cpython:bpo-23667-highlightCopy head branch name to clipboard
Closed

bpo-23667: IDLE: Add trailing space highlight #1643
mlouielu wants to merge 1 commit into
python:masterpython/cpython:masterfrom
mlouielu:bpo-23667-highlightmlouielu/cpython:bpo-23667-highlightCopy head branch name to clipboard

Conversation

@mlouielu

@mlouielu mlouielu commented May 18, 2017

Copy link
Copy Markdown
Contributor

@mention-bot

Copy link
Copy Markdown

@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.

@mlouielu mlouielu changed the title bpo-23667: Add trailing space highlight bpo-23667: IDLE: Add trailing space highlight May 18, 2017
@matrixise matrixise changed the title bpo-23667: IDLE: Add trailing space highlight bpo-23667: IDLE: Add trailing space highlight May 7, 2019
@matrixise matrixise requested a review from terryjreedy May 7, 2019 20:51

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Lib/idlelib/colorizer.py
# 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)"])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if these are the only whitespace chars to catch. Does not matter for now.

Comment thread Lib/idlelib/colorizer.py
head + "+%dc" % b)
if key == "TRAILINGSPACE" and b - a == 1:
self.delay_render_trailing_space = self.after(
1000,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@rhettinger

Copy link
Copy Markdown
Contributor

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.

@taleinat

Copy link
Copy Markdown
Contributor

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?

@terryjreedy

Copy link
Copy Markdown
Member

@mlouielu Thank you for the patch. We currently want to try the alternate solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.