Fixed  [code] tags do not accept whitespace

Erik

Well-known member
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. :)
 
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. :)
 
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
 
I think the white space was stripped somewhere. Looking at the html, there does not apear to be any whitespace in the text.

HTML:
test
I sent ten spaces and typed test, the html source has all lf the spaces removed: http://pastebin.com/J3gpdAQ2
 
This should be fixed for new posts now. I also discovered an issue with editing code as well.

Code:
a
    spaces
 tab
 
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.
 
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. :)
 
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.
 
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
 
Top Bottom