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

(GitHub code show whitespace) shows space character on empty lines? #65

Closed
animatedantmo opened this issue Dec 20, 2018 · 9 comments
Closed

Comments

@animatedantmo
Copy link

I am using version Chrome Version 71.0.3578.98, 1.2.4 of the GitHub code show whitespace script and the split view for diffs. I am not sure if this is how things always were displayed but I noticed that each line is being prefixed with a white space character. It even seems to throw off the display of lines that only contain line breaks.

This is the scss file as displayed with the script

screen shot 2018-12-20 at 8 22 54 am

This is that same scss file as displayed in my editor with whitespace displayed

screen shot 2018-12-20 at 8 26 32 am

Notice line 8 in the editor vs how its displayed in the diff, specifically the way it seems to wrap.
Is there something I should be doing differently?

@Mottie
Copy link
Owner

Mottie commented Dec 21, 2018

Hi @animatedantmo!

It looks like a code wrap style or script is being applied. When the code wraps, the new line will start at the beginning of the line. If not, then maybe it is this userscript's fault because it's adding content to make the whitespace visible.

When I have the code wrap toggle script running, I'm seeing the same thing; but my question is what are you expecting to happen when the code wraps?

@animatedantmo
Copy link
Author

Excellent point @Mottie, I thought the same thing concerning the text wrapping. But then I saw the behavior on lines without any.

Notice line 107 displaying the behavior in the screenshot below

screen shot 2018-12-20 at 9 12 49 pm

But within the IDE it is fine and there is no wrapping

screen shot 2018-12-20 at 9 17 15 pm

Is this still the expected behavior?

@Mottie
Copy link
Owner

Mottie commented Dec 21, 2018

Hmm, I'm not sure because you're seeing something different from me.

Previously... on the diff views, GitHub would add an extra space (or two?) to every line to allow space for the + and - in the diff. Now, they add the indicator to a pseudo element and include a margin so people can copy/paste the code without the indicators.

I'm no longer seeing a leading space, or a space next to the + like in your screenshot.

GitHub also sets their tab indent to be 8 spaces. You'll see that change to 2 spaces because of my GitHub Dark setting.

@animatedantmo
Copy link
Author

animatedantmo commented Dec 21, 2018

Ive added a different white space rendering script to debug a bit and that leading whitespace is still there. But without the odd wrapping if that helps

https://github.com/glebm/render-whitespace-on-github

screen shot 2018-12-20 at 11 45 59 pm

@Mottie
Copy link
Owner

Mottie commented Feb 17, 2019

Is this still an issue?

@animatedantmo
Copy link
Author

Yes, looks like this is still happening with version 1.2.6

This is what the "GitHub Code Show Whitespace" script displays

odd

This is what the "Render Whitespace on GitHub" script displays

ok

Notice the odd display/line breaking happening on 103 and 107. The second display is what I would expect.

@Mottie
Copy link
Owner

Mottie commented Feb 17, 2019

Please share a link to the page where you see this issue. For me, the carriage returns in the JS files in this repo are not adding an extra CR that I see in the screenshots.

@animatedantmo
Copy link
Author

The repo is private but I went ahead and setup a shell angular project with a PR that exhibits the issue. Please take a look at

https://github.com/animatedantmo/test/pull/1/files

@Mottie Mottie closed this as completed in 5a170c3 Feb 18, 2019
@Mottie
Copy link
Owner

Mottie commented Feb 18, 2019

Ok, so it looks like GitHub is adding an extra <br> inside the code block. I just hid it and it looks good now. Hopefully that doesn't mess up anything else.

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

No branches or pull requests

2 participants