Blanks in codebox

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
ericj
Registered User
Posts: 2
Joined: Thu Oct 20, 2016 7:33 am

Blanks in codebox

Post by ericj »

Currently, adjacent blanks in a codebox consist of html nbsp characters. When copying/pasting a codebox (plain text) with Microsoft Edge browser, it will translate the nbsp into UTF-8 nbsp characters. Other browsers don't, they translate the nbsp into a space. The behaviour of Microsoft Edge breaks some existing functionality for our use of the codebox. From a browser's point of view it seems logical to translate it into nbsp, so I can't really blame MS Edge.

PROPOSED SOLUTION
The solution could be not to use nbsp characters in a codebox.

I have implemented this as follows:
1) includes\bbcode.php: I removed conversion of blanks into nbsp
2) I added the css style "white-space: pre-wrap" to a codebox code section

This solution is ok for me, though I am not really familiar with phpbb and frontend development to know if this solution is the best.

I want to propose this change since it seems more straightforward to use just blanks in a codebox than using mixed blanks and nbsp chars.

Edit: It seems this solution is not as good as I hoped, since the changed css style breaks correct copy/paste in IE11.

Cheers,
Eric

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: Blanks in codebox

Post by JoshyPHP »

I'm pretty sure that's already the case in 3.2.

Code: Select all

no	non-breaking    spaces

ericj
Registered User
Posts: 2
Joined: Thu Oct 20, 2016 7:33 am

Re: Blanks in codebox

Post by ericj »

JoshyPHP wrote: Thu Oct 20, 2016 9:40 pm I'm pretty sure that's already the case in 3.2.

Code: Select all

no	non-breaking    spaces
Hmm, seems I have some updates to do.

Thanks for the reply!

Post Reply