Skip to content

In Firefox, the code from the documentation is copied with Non-breaking spaces (nbsp) #71

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

Closed
deevroman opened this issue Oct 30, 2022 · 8 comments · Fixed by #72
Closed

Comments

@deevroman
Copy link

Starting with Firefox 103, it now does not replace nbsp with a normal space. https://bugzilla.mozilla.org/show_bug.cgi?id=359303

Try copying some code from the documentation and pasting it into a text file. (for example from here https://www.php.net/manual/en/function.preg-replace.php)

Снимок экрана 2022-10-30 в 19 15 36

@cmb69
Copy link
Member

cmb69 commented Oct 31, 2022

I cannot reproduce this with Firefox 106 on Windows (I get spaces after copy&paste). Can anybody else reproduce this issue?

@deevroman
Copy link
Author

Hm. To clarify: I use mac OS 11.6.8 and Firefox 107.0b7

I also checked the stable version 106 -- everything is fine there, and 108.0a1 here the bug is reproduced.

Maybe this is a beta version problem, but a new release is coming soon and it looks like it will get into the stable version.

@cmb69
Copy link
Member

cmb69 commented Oct 31, 2022

Ah, yeah. https://bugzilla.mozilla.org/show_bug.cgi?id=359303#c145 mentions 4 cases, and the last two have been moved into https://bugzilla.mozilla.org/show_bug.cgi?id=1769534, and that fix targets Firefox 107.

I think we should follow suite and get rid of the non-breaking spaces, and instead prevent space-folding by using white-space: pre or such. Anyhow, this is actually a PhD doc issue.

@ianthedev
Copy link

I think we should follow suite and get rid of the non-breaking spaces, and instead prevent space-folding by using white-space: pre or such.

Agreed. I'm a Firefox user as well and encountered this issue yesterday.

Anyhow, this is actually a PhD doc issue.

Should the discussion be moved to PhD doc or continue here? I'm seeing no one here has been assigned to this issue.

@damianwadley
Copy link
Member

Should the discussion be moved to PhD doc or continue here?

"Here" is phd.

@ianthedev
Copy link

Should the discussion be moved to PhD doc or continue here?

"Here" is phd.

I see. Didn't realize "phd" is the same as "PhD doc".

cmb69 added a commit to cmb69/phd that referenced this issue Dec 23, 2022
Some browsers (notably Firefox ≥ 107) copy these NBSPs verbatim, what
causes issues when pasting into text editors/IDE.  Since these NBSPs
are generated by `highlight_string()` and there is no option to produce
regular spaces instead, we replace them manually.

To preserve the desired code layout, this requires something like
<php/web-php#744>.
@cmb69 cmb69 linked a pull request Dec 23, 2022 that will close this issue
@cmb69
Copy link
Member

cmb69 commented Dec 23, 2022

I'm seeing no one here has been assigned to this issue.

Given that this is an open-source project, you could have submitted a pull request. :)

@ianthedev
Copy link

ianthedev commented Dec 23, 2022

I'm seeing no one here has been assigned to this issue.

Given that this is an open-source project, you could have submitted a pull request. :)

I see. Didn't know this issue can be solved that way. Besides, submitting a pull request is current beyond my ability. Actually, I practiced and learned that many years ago by using GitHub Desktop but have long since forgotten the steps. But thanks for letting me know a solution.

@cmb69 cmb69 closed this as completed in #72 Jan 3, 2023
cmb69 added a commit that referenced this issue Jan 3, 2023
Some browsers (notably Firefox ≥ 107) copy these NBSPs verbatim, what
causes issues when pasting into text editors/IDE.  Since these NBSPs
are generated by `highlight_string()` and there is no option to produce
regular spaces instead, we replace them manually.

To preserve the desired code layout, this requires something like
<php/web-php#744>.

Closes GH-72.
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

Successfully merging a pull request may close this issue.

4 participants