[Another Forum Issue] Editing code blocks in the forum text box is pain

What it says in the title.
The text box uses a proportional font, writing snippets of code in it is basically impossible.

However, if one has a usersyle extension installed, applying the following to forums.parallax.com will make both the edit box and the "finished" code blocks use the PropTool font.
.MessageForm textarea,.DiscussionForm textarea {
    font-family: Parallax, monospace;
    font-size: 12pt;
    line-height: 1;
}

#Body pre {
    font-family: Parallax, monospace;
    font-size: 12pt;
    line-height: 1;
}

Comments

  • ...and @ and its double and triple variant screw up text and code or even make code between them disappear.
    "1æ2ææ3æææ" —(s/æ/@/g)—▷ 1@2@@3@@@
    
    And, if not changed recently, some stuff gets drawn together.
    8 ) = =  —▷  8)==
    
    I'm really not happy about this integrated dyslexic nanny.

    Make code blocks dumb again.

    Well... and being at it:

    Please add an edit button for being able to correct stuff in personal messages. I've sent lots of garbled code and that could have been avoided if a preview and edit feature were added.
  • I never even noticed that the PM dialog doesn't have a preview button. WTF though?

    Parallax should fix the @ thing though before P2 comes out properly. It's quite embarassing.
    How that happened to begin with, IDK. Surely everyone using the code block feature in this software would have noticed that it's broken.

    Also, why is there no syntax highlighting?

  • yetiyeti Posts: 618
    edited 2020-01-05 - 00:49:36
    Wuerfel_21 wrote: »
    I never even noticed that the PM dialog doesn't have a preview button. WTF though?
    I do discuss code via PMs a lot and not everyone wants to click on some links pointing to elsewhere.
    Wuerfel_21 wrote: »
    Parallax should fix the @ thing though before P2 comes out properly. It's quite embarassing.
    How that happened to begin with, IDK. Surely everyone using the code block feature in this software would have noticed that it's broken.
    I don't remember that many problems with the older forum software. Maybe that's just beginning al(c|z)heimer?
    Wuerfel_21 wrote: »
    Also, why is there no syntax highlighting?
    Then $THEY would need to additionally specify in which language the code is in. Like {code=simple-ide}...{/code} or such. That's really asking for far too much.
    Let it be!
    Just don't mention this again!
  • I haven't had any issues with code blocks recently vis-à-vis the font. My browsers (Chrome and Firefox on multiple platforms) default to Courier or some other monospaced typeface within the code blocks. So I'd be very surprised if there are any matters with the forum server that need to be addressed by Parallax.

    -Phil
  • yetiyeti Posts: 618
    edited 2020-01-05 - 02:45:10
    @Phil Pilgrim (PhiPi) ... I demonstrated problems with the code box.
    Just look up.

    Maybe your code just does not trigger them.
    Ok.
    Mine did.
    Far too often.

    I was told, that someone would look at it.
  • yetiyeti Posts: 618
    edited 2020-01-05 - 02:56:00
    While we type, the code box has fused ";" and "|" with previous chars.
    See the "return" lines of "test1" and "test2":
    Dave Hein wrote: »
    The following C code shows a bug in the fastspin C compiler. test2() works correctly, and test1() does not. test1() is maintaining the result at 8 bits instead of keeping all 32 bits.
    #include <stdio.h>
    
    #ifdef __FLEXC__
    #include <propeller.h>
    #define P2_TARGET_MHZ 160
    #include "sys/p2es_clock.h"
    #define BAUD 230400
    #endif
    
    int test1(int x, unsigned char y)
    {
        return y | (x << 8);
    }
    
    int test2(int x, unsigned char y)
    {
        return (x << 8) | y;
    }
    
    void main(void)
    {
    #ifdef __FLEXC__
        clkset(_SETFREQ, _CLOCKFREQ);
        _setbaud(BAUD);
    #endif
        printf("%8.8x %8.8x\n", test1(0x12, 0x34), test2(0x12, 0x34));
    }
    

  • I haven't had any issues with code blocks recently vis-à-vis the font. My browsers (Chrome and Firefox on multiple platforms) default to Courier or some other monospaced typeface within the code blocks. So I'd be very surprised if there are any matters with the forum server that need to be addressed by Parallax.

    -Phil

    The font within the code blocks is fine, but the font in the editor box is proportional, so you can't properly write code in it, you always have to copy/paste to/from an external editor (unless you change the font). I just changed the code block font, too, for consistency.
  • VonSzarvasVonSzarvas Posts: 1,808
    edited 2020-01-19 - 12:50:44
    TEST
    1 @2 @@3 @@@
    
    1 @ 2 @@ 3 @@@
    
    1@2@@3@@@
    

    #define TESTCT
    #include <stdio.h>
    
    #ifdef __FLEXC__
    #include <propeller.h>
    #define P2_TARGET_MHZ 160
    #include "sys/p2es_clock.h"
    #define BAUD 230400
    #endif
    
    int test1(int x, unsigned char y)
    {
        return y | (x <<  8);
    }
    
    int test2(int x, unsigned char y)
    {
        return (x << 8) | y;
    }
    
    void main(void)
    {
    #ifdef __FLEXC__
        clkset(_SETFREQ, _CLOCKFREQ);
        _setbaud(BAUD);
    #endif
        printf("%8.8x %8.8x\n", test1(0x12, 0x34), test2(0x12, 0x34));
    }
    
  • Wuerfel_21Wuerfel_21 Posts: 510
    edited 2020-01-05 - 15:29:03
    Wow, the characters no longer overlap!
    Maybe also add the line "line-height: 1;" (or 1.1) to the code blocks, the line spacing is a bit much
  • Wuerfel_21 wrote: »
    Wow, the characters no longer overlap!
    Maybe also add the line "line-height: 1;" (or 1.1) to the code blocks, the line spacing is a bit much

    Noted, thanks.

    I ran out of time today, but will come back to this soon. About to fix the multi @ issue, and then can adjust the css a little bit if it looks right.

    Thanks to everyone for raising this again. If there's any simple suggestions (like a css tweak), feel free to add them here and we can see if they are doable. And please shout if anything got broken by these updates :)
  • Wuerfel_21 wrote:
    Also, why is there no syntax highlighting?
    Because the code boxes are used for a lot of different things and thus have to be language-agnostic.

    -Phil
  • Wuerfel_21 wrote: »
    Wow, the characters no longer overlap!
    \o/
    VonSzarvas wrote: »
    I ran out of time today, but will come back to this soon. About to fix the multi @ issue, and then can adjust the css a little bit if it looks right.
    Yayyy!
    And thanks a lot!
  • Wuerfel_21 wrote: »
    Parallax should fix the @ thing though before P2 comes out properly.


    @ thing should be fixed now.

    Hopefully I can rely on you guys to let me know if you can break it :)



    The other comments/ideas are all noted, and maybe next weekend or so we can find some moments to check them.
  • Wuerfel_21Wuerfel_21 Posts: 510
    edited 2020-01-19 - 09:01:07
    Well, it seems you broke the @-mentions entirely in the process (which I think are a rather useful feature to have)
    The editor still gives suggestions for them, oddly enough. @VonSzarvas

    Image6.png
    893 x 340 - 22K
  • VonSzarvasVonSzarvas Posts: 1,808
    edited 2020-01-19 - 19:01:48
    Got it, thanks. Good catch.
    Feature unbroken.


    - look like there's an edge case with certain usernames, but it doesn't seem to impact the code being rendered, so will leave that alone for a couple weeks. We are going to try update the forum version then, if our offline test site updates ok, and the handlers for the text formatting/rendering are a little different with the new version; so let's wait for that update now- unless anything really silly comes to light in the meantime.

Sign In or Register to comment.