• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  [code] tags do not accept whitespace

Erik

Well-known member
#1
What I mean is that code tags trim whitespace like regular content. In other words indenting, etc. is not preserved. :)

For example:
Code:
if($codetags->preserveWhitespace()) {
//this should be indented
$erik->makeHappy();
} else {
// also indented
fix();
}
PHP tags are the same:
PHP:
<?php
if($codetags->preserveWhitespace()) {
//this should be indented
$erik->makeHappy();
} else {
// also indented
fix();
}
?>
On a related note, if you hit the tab key within the editor (either the quick reply or the full editing page), it tabs out to the next form field instead of creating a tab character. (edit: nevermind, as designed :))

These two combined make posting and formatting code a nightmare at the moment. Long pieces of code are almost impossible to read without proper whitespace and indenting. :)
 

Erik

Well-known member
#3
I see that as normal, expected behavior.
You're right, that's how vBulletin's editor currently works as well. I guess as I was trying to create indentation in the code examples I was thinking to myself, "the tab key should really create a tab character." But I can see how this is operating as designed. :)
 

Disjunto

Well-known member
#4
Code:
No indent
 Single tab index
 Double tab indent
Single space indent
  Tab+Space indent
  2Tab+Space indent
   2Tab+2Space indent
   2Tab+10Space indent
Very strange behaviour
 

Mike

XenForo developer
Staff member
#9
This should be fixed for new posts now. I also discovered an issue with editing code as well.

Code:
a
    spaces
 tab
 

Mike

XenForo developer
Staff member
#11
Looks Chrome specific, and IE has some different behaviors. I don't know if I can workaround these issues very easily, but I'll see what I can come up with.
 

Erik

Well-known member
#12
Just FYI, I'm running Firefox 3.6 and in the example above I see four spaces before the word "spaces", and then one space before the word "tab."

Thanks for taking a look. :)
 

Mike

XenForo developer
Staff member
#13
Fixed, though I'm not 100% happy with the fix.

IE also does annoying stuff when pasting in tabs. (It also paste from Eclipse with syntax highlighting.) This, unfortunately, causes all sorts of nightmares with BB codes showing up within. I'll have to deal with that.

Do definitely need a way to go from the WYSIWYG editor to a BB code based version, though all the buttons would go away.
 

Erik

Well-known member
#14
Do definitely need a way to go from the WYSIWYG editor to a BB code based version, though all the buttons would go away.
Yeah, this would be much appreciated. Earlier today the editor was still doing some funky stuff with tabs and whitespace as I was editing and stuff. That might be fixed now, I'll let you know if it's not. :)

Also, if you could fix that extra line break in the quote box that would be great too. :D