Blanks in codebox

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.2/Rhea followed by 3.3.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.1. If you need support for phpBB 3.1 please visit the 3.1.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 » Thu Oct 20, 2016 8:13 am

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: 350
Joined: Fri Jul 08, 2011 9:43 pm

Re: Blanks in codebox

Post by JoshyPHP » 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

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

Re: Blanks in codebox

Post by ericj » Thu Oct 20, 2016 9:55 pm

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