1. 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

Discussion in 'Resolved Bug Reports' started by Erik, Jul 30, 2010.

  1. Erik

    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. :)
     
  2. Enigma

    Enigma Well-Known Member

    I see that as normal, expected behavior.
     
  3. Erik

    Erik Well-Known Member

    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. :)
     
  4. Disjunto

    Disjunto Well-Known Member

    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
     
  5. Kuma

    Kuma Active Member

    Might just need some <pre> tags.
     
  6. Disjunto

    Disjunto Well-Known Member

    it's already in a pre, they just need to change how the pre treats whitespace
     
  7. Kuma

    Kuma Active Member

    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
     
  8. Disjunto

    Disjunto Well-Known Member

    yeah, I remembered I had already checked that after posting... and for some reason never edited my post. oh well :)
     
  9. Mike

    Mike XenForo Developer Staff Member

    This should be fixed for new posts now. I also discovered an issue with editing code as well.

    Code:
    a
        spaces
     tab
    
     
  10. Mike

    Mike XenForo Developer Staff Member

    Hmm, the tab went weird on me. Worked in tests...
     
  11. Mike

    Mike XenForo Developer Staff Member

    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.
     
  12. Erik

    Erik Well-Known Member

    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. :)
     
  13. Mike

    Mike XenForo Developer Staff Member

    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.
     
    Enigma likes this.
  14. Erik

    Erik Well-Known Member

    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
     
  15. Enigma

    Enigma Well-Known Member

    Definitely agree with you on this, except for the part about the buttons going away :)
     

Share This Page