Change of formatting of code wrapped sections on devnet?


  • Moderators

    Apparently the code wrapping has been changed. Long code lines were displayed in code wrapping as long lines with a slider to move along. However, this is not working anymore see this "formatting of code":http://developer.qt.nokia.com/forums/viewthread/13880/
    In my Chrome browser it looks like this
    !http://db.tt/VIeb4AJ6(example)!

    There is a line break introduced at the first "space". When removing the "space" it breaks at the "-" very early in the line.



  • Hmmm... that is annoying. Code should not be wordwrapped, ever. It may be significant.



  • ... and it mostly leads to unreadable code. +1 for the old behaviour.



  • In fact, I considder this a bug. Please file a bugreport.


  • Moderators

    On popular demand I have filed a "bug report on JIRA ":https://bugreports.qt-project.org/browse/QTWEBSITE-390 :-)

    [quote author="Andre" date="1327745498"]Code should not be wordwrapped, ever. [/quote]

    I do not agree completely with statement. When the code line is exceeding the window size several times it is annyoing to scroll along. So there it would be nice to have the wrap.
    However, it might be complex to solve and such cases should be rare and edited by hand.



  • No, I stand by my statement. Code can be wrapped on /n just fine, but that is always explicit. The layout engine is being told by the user to wrap at a specific place. I encourage that completely! A single statement, for instance with a list of long-ish arguments, should be broken up into multiple lines. However, that is not word-wrapping. Word wrapping is automatically wrapping the lines based on word boundaries. That works fine for normal text, but not for code. I want the 'const' to stay with the variable name, thank you very much.


  • Moderators

    [quote author="Andre" date="1327750845"]No, I stand by my statement. Code can be wrapped on /n just fine, but that is always explicit. The layout engine is being told by the user to wrap at a specific place. I encourage that completely! A single statement, for instance with a list of long-ish arguments, should be broken up into multiple lines. However, that is not word-wrapping. Word wrapping is automatically wrapping the lines based on word boundaries. That works fine for normal text, but not for code. I want the 'const' to stay with the variable name, thank you very much. [/quote]

    I completely agree if your initial statement is interpret word-by-word. Source code lines should be smartly wrapped. Developers not doing this have to live with the pain. And for sure they do :-)

    My view was a bit focus on the display in devnet though. "Code" I have interpret as code section. The code sectioning is used also to display error messages in posts. Especially within error message for templates used causing a compile error. At least the ms compiler some times displays messages stretching for ever. Copy and pasting them to devnet code section caused in the past that you have to slide through several window sizes. This is annoying and does not help.
    I was wondering, if such situations were the origin of changing the behaviour of displaying the code section. If so, I would prefer to have an automatic wrap after 2 times the windows size may be. But again I think it is too complex and/or too time consuming lateron.



  • Ah, ok. I guess you are right about issues with displaying long error-messages or other similar things. The root of that issue is, of course, that we are -abusing- using code tags for these as well. With good reason, of course, but you cannot exect a layout engine to on the one hand not touch code, but on the other wrap around non-code-but-still-code-like sections. We'd need some way to identify what it is we are posting. That would be useful anyway. Hightlighting also isn't quite the same for python, C++, javascript or QML, so it would be useful to have a distinction there.

    Personally, I like parts of the syntax we have here, but not all of it. It gets in the way far to easily. While it is convenient that you can use underscores for italic instead of [i]...[/i], for code, it creates problems. I would much rather just have [ code] [ /code] and then be able to say [code lang:cpp], [code lang:qml] or [code lang:log] to tweak how whatever is in that block is rendered.

    _Edit: Hmm... code between square brackets seems to work already



  • I think any solution is acceptable that marks wrappings in a way that they are clearly visible to the user. Personally I prefer code wrapping (with markers) to no code wrapping).

    In KDE we would make it a user preference :-)



  • Just for information:
    The change is live since a change of the code formatting engine. It has moved from some JavaScript on the browser side to the server side.

    I'd prefer no line wrapping for the actual code together with some wrapping "show this as plaintext" like tag for logs etc.


  • Moderators

    Oh, the discussion goes beyond the initial reason of a probable bug.

    I like the idea being able to specialize the code section.

    Should we formulate a suggestion then?

    BTW: I have seen the wrapping with "code" in square brackets before in soem posts. However, it is not a documented feature in "ForumHelp":http://developer.qt.nokia.com/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01



  • The markup "language" behind DevNet is "textile":/search/tag/textile. Most of its syntax works here too, including [ code ] (without the nice syntax highlighting, though).


  • Moderators

    [quote author="Volker" date="1327757076"]The markup "language" behind DevNet is "textile":/search/tag/textile. Most of its syntax works here too, including [ code ] (without the nice syntax highlighting, though).[/quote]

    Good to know, thanks



  • Thanks for feedback, as Volker said we changed the syntax highlighter engine away from a browser based JavaScript solution to a server side solution. This prevents the "jumping around" of text on page load if you're not on a low latency connection. Good for performance overall. And we had a fair share of cross-browser issues with the old solution. 0 so far with the new one.

    I'll check if we can make code wrapping a user preference.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.