Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show single non-boundary spaces in show-whitespace #5709

Merged
merged 12 commits into from Jun 23, 2022

Conversation

fregante
Copy link
Member

@fregante fregante commented Jun 20, 2022

@fregante fregante changed the title Don't show single spaces Don't show single spaces in show-whitespace Jun 20, 2022
@@ -21,26 +21,38 @@ function showWhiteSpacesOn(line: Element): void {
continue;
}

const startingCharacter = shouldAvoidSurroundingSpaces && nodeIndex === 0 ? 1 : 0;
const skipLastCharacter = shouldAvoidSurroundingSpaces && nodeIndex === textNodesOnThisLine.length - 1;
// This referes to the boundary text nodes, not actual whitespace nodes. Text nodes are generated by the syntax highlighter, so non-highlighted text will have one text node.
Copy link
Member Author

@fregante fregante Jun 20, 2022

Choose a reason for hiding this comment

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

Not that this PR doesn't change how the feature behaves on non-highlighted pre like

hello world

@fregante fregante changed the base branch from main to test-show-whitespace June 20, 2022 08:15
@fregante fregante marked this pull request as ready for review June 20, 2022 08:15
Base automatically changed from test-show-whitespace to main June 22, 2022 15:03
@fregante

This comment was marked as resolved.

@fregante fregante marked this pull request as draft June 22, 2022 15:09
@yakov116

This comment was marked as resolved.

@fregante

This comment was marked as resolved.

@fregante fregante marked this pull request as ready for review June 22, 2022 15:54
@fregante fregante changed the title Don't show single spaces in show-whitespace Don't show single non-boundary spaces in show-whitespace Jun 23, 2022
@fregante fregante merged commit 138a547 into main Jun 23, 2022
@fregante fregante deleted the only-trailing-whitespace branch June 23, 2022 14:18
@yakov116
Copy link
Member

If I remember correctly this was my only complaint when we added this feature.
Thanks for removing!

@fregante
Copy link
Member Author

fregante commented Jun 23, 2022

Let's just hope I didn't break the feature further 😅
I already saw it often stop working after a certain number of lines in the past

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

Successfully merging this pull request may close these issues.

Show only boundary whitespace
3 participants