Extra newlines in code boxes

This is a discussion on Extra newlines in code boxes within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Is it just me or is there always an extra blank line in (short) code boxes? I tried viewing CBoard ...

  1. #1
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046

    Extra newlines in code boxes

    Is it just me or is there always an extra blank line in (short) code boxes?

    I tried viewing CBoard in a few different web browsers, with the same results. It's annoying me.

    Attached is an image of this.
    Code:
    This is a single line of code.
    Attached Images Attached Images  
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Either we are both imagining this problem, or it's not just your imagination!

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Well, ruling out mass hallucination, I'm glad to hear it's neither my imagination nor my web browsers.

    Just thought I should mention: it's not affected by whether the [/code] is on the same line or not.

    This: [code]something[/code]
    Code:
    something
    and this: [code]
    something
    [/code]
    Code:
    something
    look the same.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    Maybe because the HTML is messed up?

    Here's one of the 'code' segments:

    <div style="margin:20px; margin-top:5px"> <div class="smallfont" style="margin-bottom:2px">Code:</div> <pre class="alt2" dir="ltr" style="margin: 0px; padding: 1px; border: 1px inset; width: 100%; height: 34px; text-align: left; overflow: auto">something</div>

    The 'pre' tag never gets ended. And this is consistent.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Good catch! But I don't think it's the cause of the problem. I added a </pre> tag in manually, and there was no visible difference. (Of course, it should be fixed if possible anyway -- always a good idea to close HTML tags . . . .)

    On the other hand, if I remove the "height: 34 pix", then it displays as I think it should. So the height calculations are messed up . . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I think you people need to "get a life" at this point. Altho not closing a tag deserves chastisement. dwks is obviously right with the "height"; being a chair tipper, I have minimum 20pt fonts and this issue is much harder to notice that way than in the OP, because 34px is 34px.
    Last edited by MK27; 06-08-2009 at 04:36 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    But if you're going to all the trouble (and unportableness . . . .) of putting an absolute height into a code box, it might as well be less than 34 pixels high . . . I don't think many people view CBoard with even size 32 font.

    Okay, it's probably irrelevant, but I noticed it and thought I might as well bring it up.

    See you later.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Explain this C code in english
    By soadlink in forum C Programming
    Replies: 16
    Last Post: 08-31-2006, 12:48 AM
  2. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 11:38 AM
  3. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-15-2002, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21