Thread: [code] coloring breaks [color]

  1. #1
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    [code] coloring breaks [color]

    The new [code] line numbering + coloring thing breaks [color] tags. It's also doing something weird. It won't line number it unless I SHIFT+RELOAD the page, after I post. It has the normal old code tags where color tags work, but if I shift+reload, it switches to the other format, and breaks the color tags, turning them into HTML font tags.
    Code:
    int main( void )
    {
        return 0;
    }
    Actually, it doesn't quite have the old style. The box around the whole thing is gone for me.

    edit:
    [code] coloring breaks [color]-cboard1-png
    [code] coloring breaks [color]-cboard2-png


    Quzah.
    Last edited by quzah; 09-19-2011 at 07:29 PM.
    Hope is the first step on the road to disappointment.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    I'm going to try something.
    Code:
    int main( void )
    {
        return 0;
    }
    Soma

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    I got the same exact effect that quzah describes, but the odd bit, the bit I wanted to test, the source is properly quoted with correct BBCode color formatting.

    Soma

  4. #4
    Administrator webmaster's Avatar
    Join Date
    Aug 2001
    Posts
    1,012
    The old code tag box is gone (temporarily?) because I had to change the CSS class of the code box to make the syntax highlighting plugin detect the code--probably some restyling will want to happen. My guess regarding the issue you're seeing with needing to force a refresh is that the forum isn't reloading the page when a quick-reply happens, but is instead using Ajax, so the syntax highlighter isn't triggering. I'll have to play around a little bit to see how to make this work, but I'm guessing it's possible.

    The broken color coding seems like it is probably an effect of how the syntax highlighter is working--it looks like it is splitting the html tag for the HTML color coding with its own tags:

    Code:
    <code class="cpp plain"><font color=</code>
    <code class="cpp string">"#FF0000"</code>
    It's getting late, so I'll have to take a look at this more tomorrow--for now, I think I'm going to leave it up to get more feedback on the change.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Well, I assume you are talking about the feature, and I like it, but it needs some work with the colors.

    The biggest thing is native types (int, float, etc.) don't have enough contrast for the size of the text. It is passable on a normal computer monitor, but on my mobile "Firefox", I literally barely see what's happening.

    Soma

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Is it possible to display the new code tags with a white background and an outline box around them?

    The preprocessors are gray on gray and a little hard to see.
    Also can you remove the bold facing from some of the symbols.


    Other than that... YES, Thank you!

  7. #7
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Quote Originally Posted by webmaster View Post
    I think I'm going to leave it up to get more feedback on the change.
    I realize this thread is very old, but I still feel the same way about it and the negative feedback is likely to be the same.

    Maybe as a compromise syntax highlighting will be made optional?

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How about [code] and [codes] for without syntax and with syntax coloring? Um didn't we have this style of coloring before with [php]?


    Quzah.
    Last edited by quzah; 09-20-2011 at 03:42 AM.
    Hope is the first step on the road to disappointment.

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    How about [code] and [codes] for without syntax and with syntax coloring?
    I think that's a bit too "clever". Perhaps [code] for the new code block and a special flag for people who don't want it, such as [code=plain] where the code block is what we've been using.
    My best code is written with the delete key.

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Prelude View Post
    I think that's a bit too "clever". Perhaps [code] for the new code block and a special flag for people who don't want it, such as [code=plain] where the code block is what we've been using.
    Presuming the issue is too difficult to fix, won't that break old posts? I think syntax highlighting is worthwhile regardless, but it might be better to either make the default no highlighting, or hack vBulletin so that the default for posts older than yesterday is no highlighting.
    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

  11. #11
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by MK27 View Post
    Presuming the issue is too difficult to fix, won't that break old posts? I think syntax highlighting is worthwhile regardless, but it might be better to either make the default no highlighting, or hack vBulletin so that the default for posts older than yesterday is no highlighting.
    I would tend to agree with this one. All the old code I posted using my syntax highlighter is now broken and unreadable.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by AndrewHunter View Post
    I would tend to agree with this one. All the old code I posted using my syntax highlighter is now broken and unreadable.


    Probably we are not the only forum to have faced this issue, so if such a possibility or patch does not already exist it would be worthwhile, and I would think not hard. Like 5-10 lines somewhere.
    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

  13. #13
    Administrator webmaster's Avatar
    Join Date
    Aug 2001
    Posts
    1,012
    Thanks for all the feedback!

    Here's my current thinking:

    1) Make it so that code regions that are hand-colored by users (in any way) are ignored by the highlighter. If this works, I'm not sure it will be necessary to have a separate [code=plain] option.
    2) The colors need to be tweaked. I'll work on this once the breakage issues are resolved.
    3) I also like the idea of having an option to disable the highlighting for users who don't want it. Either a per-code-box button or a user setting.
    4) The contexts where it doesn't currently work need to be fixed--lower priority for now, as long as #1 is resolved satisfactorily.

    For the moment, I am going to disable highlighting until I've fixed issue #1 and then, once resolved, try to get reasonable colors.

  14. #14
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by webmaster View Post
    Thanks for all the feedback!

    Here's my current thinking:

    1) Make it so that code regions that are hand-colored by users (in any way) are ignored by the highlighter. If this works, I'm not sure it will be necessary to have a separate [code=plain] option.
    3) I also like the idea of having an option to disable the highlighting for users who don't want it. Either a per-code-box button or a user setting.
    How about a new bbs tag... [pre] [/pre] to allow us to insert preformatted text that's not syntax highlighted?

  15. #15
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    PHP Code:
    int mainvoid )
    {
        
    int x// not initialized
        
    printf"x is uninitialized, yay! %d\n");
        return 
    0;

    See? That's a [php] tag. Why don't you just use that for code coloring? Anyway, [pre] is a good idea too. But we already have had syntax coloring forever with [php]


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Switching from MinGW to Pelles C, code breaks
    By Hear.Me.ROAR in forum C Programming
    Replies: 4
    Last Post: 08-11-2011, 11:21 AM
  2. my code breaks unique pointer rule?
    By George2 in forum C++ Programming
    Replies: 19
    Last Post: 02-17-2008, 03:26 AM
  3. Code-Coloring
    By Vber in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 01-08-2003, 11:29 PM
  4. Paste code into word keeping color
    By GaGi in forum C++ Programming
    Replies: 1
    Last Post: 02-07-2002, 08:26 AM