sindresorhus/refined-github

`show-whitespace` causes lines to wrap #3542

jeff-minard-ck posted onGitHub

When RefinedGithub is enable, diffs and other views are doing line wrapping on code. I would like to disable this behavior. I searched around the open/closed PRs, as well as through the options for "wrap" but couldn't find this option.

Thanks!


Where are you seeing the code wrapping? Post a link and/or screenshot as requested by the template

posted by fregante over 4 years ago

Disabled:

<img width="1007" alt="Screen Shot 2020-09-16 at 9 25 57 PM" src="https://user-images.githubusercontent.com/1210963/93420171-4b7aa100-f863-11ea-86e5-73e7b01b65d8.png">

Enabled:

<img width="1006" alt="Screen Shot 2020-09-16 at 9 26 11 PM" src="https://user-images.githubusercontent.com/1210963/93420196-559c9f80-f863-11ea-88a0-d82ac64265b8.png">

Oddly, the text file seems to always wrap.

This is also on Github Enterprise; version 2.19.6

Post a link and/or screenshot as requested by the template

The template for "Feature request" doesn't ask for that, fyi.

posted by jeff-minard-ck over 4 years ago

Thanks for the screenshots, but without a URL now I have to recreate your condition, making it harder for us to find the issue.

The template for "Feature request" doesn't ask for that, fyi.

It does ask for a URL:

  1. Include a full URL where the feature should appear.
posted by fregante over 4 years ago

It happens under a PR diff view, something like http://our-ghe.com/org/repo/pull/295/files

posted by jeff-minard-ck over 4 years ago
posted by fregante over 4 years ago

The wrapping is because of https://github.com/sindresorhus/refined-github/blob/f13db9b420cc351680b15fc86344ad099bd4f96a/source/features/show-whitespace.css#L3 which was added in #3292, to fix another wrapping issue #2991.

posted by notlmn over 4 years ago

It looks like GitHub wraps some file type while it doesn't wrap others. Is this easily detectable? Perhaps that white-space only needs to be applied to some filetypes.

Wrap.md: https://github.com/discord/discord-api-docs/commit/79e7e2894e268c27d11e55d009bf00f020395d64 No-wrap.js: https://github.com/sindresorhus/refined-github/commit/4cb59bea8b78a2d3b8ea4fa888df5e70ca286ff4

posted by fregante over 4 years ago

Seems like there's a div in the chain that adds .soft-wrap which adds this for files which GH thinks should be wrapped.

posted by jeff-minard-ck over 4 years ago

I'm thinking this should be easy fix, haven't tested, might be wrong.

[rgh-observing-whitespace] {
    // other props
}

.soft-wrap [rgh-observing-whitespace] {
    white-space: break-spaces;
}

GitHub is likely wrapping files that it thinks don't have code in them, again, I might be wrong.

posted by notlmn over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests