Page 1 of 1
[code][/code] strips leading spaces
Posted: Wed Dec 19, 2007 5:19 pm
by huw
For example
Code: Select all
This sentence should have a leading space.
This shouldn't.
This should.
The spaces are still there if the post is quoted or edited, but they never display. Does BBCode have a <PRE> tag?
Edit: the above is a trivial example, but what about indented code?
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 12:07 am
by Hagar Delest
Code: Select all
Start of the line
2 spaces indent here
No indent
6 spaces indent here
Seems to work fine for me.
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 12:09 am
by Hagar Delest
huw wrote:For example
Code: Select all
This sentence should have a leading space.
This shouldn't.
This should.
The spaces are still there if the post is quoted or edited, but they never display. Does BBCode have a <PRE> tag?
Edit: the above is a trivial example, but what about indented code?
NB: If I add spaces in your code, it works
Conclusion : my keyboard is better than yours
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 12:52 am
by Bhikkhu Pesala
If you can keep your head when all about you
Are losing theirs and blaming it on you.
If you can meet with Triumph and Disaster
And treat those two impostors just the same.
If you use Opera browser,
you can add a shortcut to insert five hard spaces [0160] at once.
That works in most forums.
space ctrl = Insert, " "
If you can fill the unforgiving minute
With sixty seconds' worth of distance run,
Yours is the Earth and everything that's in it,
And - which is more - you'll be a Man, my son!
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 11:23 am
by huw
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
Now will you all admit there's nothing wrong with my spacebar?! Or shall I go back and edit the thread subject to read "{code}{/code} strips single leading space"
* so
you all look crazy, not me?
So, only a single leading space is stripped, any more and they're allowed. It still
caught me out though.
*Can BBCode tags be escaped? Backslash doesn't seem to work for me (or may be
that key is dodgy on my keyboard).
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 5:31 pm
by acknak
It may not be your keyboard, but something very odd is going on.
Here's what I get if I reconstruct your entry (in my text editor) based on what you wrote, then paste that into a pair of code tags:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
So it's the same result for me.
Here's what I get when I use the "SELECT ALL" link; copy & paste from your example:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
There are four leading spaces on the first two lines, six on the next line ("Two"), 7, 8 and 9 on the last three (respectively).
Copying the one I typed out gives me back the same thing I get from yours. Copying the one I copied from yours adds four more spaces at the start.
Uggh. Obviously this needs to be fixed: the [ code][/code]* tags need to be reliable, both for display and for copying.
* In phpBB on oooforum, you could escape any special character by using a numeric entity: [ but that doesn't work in phpBB3. I can't find any way to escape the bbcode tags here. You can slightly mangle the tags and they will be left alone.
PS: I'm using Mozilla Seamonkey on Linux.
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 5:59 pm
by huw
acknak wrote:It may not be your keyboard, but something very odd is going on.
Here's what I get if I reconstruct your entry (in my text editor) based on what you wrote, then paste that into a pair of code tags:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
So it's the same result for me.
Here's what I get when I use the "SELECT ALL" link; copy & paste from your example:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
There are four leading spaces on the first two lines, six on the next line ("Two"), 7, 8 and 9 on the last three (respectively).
Copying the one I typed out gives me back the same thing I get from yours. Copying the one I copied from yours adds four more spaces at the start.
Uggh. Obviously this needs to be fixed: the [ code][/code]* tags need to be reliable, both for display and for copying.
Yikes! Quoting hoses the lot!
I don't have any problem with the SELECT ALL - the displayed number of spaces are copied and pasted fine (the display, and therefore copy & paste, being wrong regarding a single leading space). I'm using IE6 on XP. Anyone else care to help us eliminate OS, browser, or forum software as the problems' sources?
In light of potential
trailing space problems, a test:
Code: Select all
Zero trailing spaces
One
Two
Three
Four
Five
That seems fine for me.
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 7:43 pm
by acknak
FWIW, I see exactly the same errors if I use Firefox.
The trailing spaces seem fine for me (I still get the extra four spaces at the start of each line).
Interestingly, if I paste into the Mozilla HTML editor (so the phpBB html is preserved--presumably), I get this:
Code: Select all
<dl class="codebox">
<dd><code>Zero leading spaces<br>
One<br>
Two<br>
Three<br>
Four<br>
Five<br>
</code></dd>
</dl>
So the extra leading spaces are probably coming from Mozilla's attempt to "indent" a "DL" (Dictionary List).
It is very surprising to me that they would try to use such a list element to hold "preformatted" content. Maybe it's not quite safe to let "J. Random User" insert just any preformatted text; I don't know.
Whatever the intent, this isn't acceptable (IMO): we need to be able to accurately display snippets that can be copied out accurately. Having to attach a file just for that purpose is way to much trouble. I don't mean it's a crisis of course, but it seems like something that we really need to be able to do. It's certainly a regression from phpBB2.
Re: [code][/code] strips leading spaces
Posted: Thu Dec 20, 2007 7:51 pm
by DrewJensen
acknak wrote:It may not be your keyboard, but something very odd is going on.
Here's what I get if I reconstruct your entry (in my text editor) based on what you wrote, then paste that into a pair of code tags:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
So it's the same result for me.
Here's what I get when I use the "SELECT ALL" link; copy & paste from your example:
Code: Select all
Zero leading spaces
One
Two
Three
Four
Five
There are four leading spaces on the first two lines, six on the next line ("Two"), 7, 8 and 9 on the last three (respectively).
Copying the one I typed out gives me back the same thing I get from yours. Copying the one I copied from yours adds four more spaces at the start.
Uggh. Obviously this needs to be fixed: the [ code][/code]* tags need to be reliable, both for display and for copying.
* In phpBB on oooforum, you could escape any special character by using a numeric entity: [ but that doesn't work in phpBB3. I can't find any way to escape the bbcode tags here. You can slightly mangle the tags and they will be left alone.
PS: I'm using Mozilla Seamonkey on Linux.
Use spaces
Code: Select all
sub test
dim a
dim b
if a then
print b
end if
end sub
Use tabs
Code: Select all
sub test
dim a
dim b
if a then
print b
end if
end sub
I am using FireFox under XP with my default encoding set to UTF-8..not that this should matter.
I'll switch over to Linux here in just a bit and try it also.