Warning: This post will probably be to wide, until the bug is fixed. That's on purpose, it is precisely what this post is about.

Looking at Re^2: Change readonly status of Win32::GUI::RichEdit, I was wondering why the article is so wide in Firefox. (It would seem to be rather normal in MSIE, but that is only because MSIE can wrap text where there is no whitespace, for example, right after a hyphen.) It's that first code snippet, over 160 characters long, that is to blame. It just doesn't wrap.

In case you don't see it like I do, here's a screenshot (for a few weeks, at least).

Apparently, code that doesn't contain a newline, doesn't wrap. See for yourself:

$mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VISIBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-left=>10,-top=>35,-readonly=>1);

Inserting a newline anywhere in the code, allows the code wrapper to kick in:

Newline inserted at the front:

$mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VIS +IBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-lef +t=>10,-top=>35,-readonly=>1);

Newline appended at the end:
$mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VISIBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-left=>10,-top=>35,-readonly=>1);

Two lines of code with just a newline between them, but nowhere else:

$mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VIS +IBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-lef +t=>10,-top=>35,-readonly=>1); $mainform->tab->Page4->AddRichEdit(-name=>'articletext',-style=>WS_VIS +IBLE|WS_VSCROLL,-multiline=>1,-text=>"",-width=>745,-height=>450,-lef +t=>10,-top=>35,-readonly=>1);

Note that that is all I changed.

Update: Some people don't seem to get what I'm driving at. I think this is a bug. No node with code should ever act like that.

Update: In case your browser/user settings are vastly different than mine, here's a screenshot of this post, showing both what I find normal and not normal.

Replies are listed 'Best First'.
Re: code without newline doesn't wrap
by zentara (Cardinal) on Feb 12, 2005 at 13:18 UTC
    Just to confirm your observation, I have been dealing with this for quite some time using Mozilla. Certain nodes would just come up with huge horizontal scrolling. I've just learned to accept it, but it would be cool if it could be fixed.

    I'm not really a human, but I play one on earth. flash japh

      Then turn "auto" code wrapping off!

      It doesn't seem to matter how many times I say this. Even in threads where I've said this I see later replies complaining that wrapping doesn't always work in Moz.

      Code wrapping works fine in Moz, but "auto" code wrapping doesn't. I guess part of the problem is that auto code wrapping often doesn't need the soft hyphens so people think "it works" because sometimes it does.

      Even castaway's explanation fails to mention "auto". That is what she is talking about but I think most would have a hard time figuring that out.

      As for code tags w/o newlines, such are meant for code within a sentence and as such aren't expected to start at the start of a line and so non-auto code wrapping would make no sense.

      If someone writes a paragraph of code w/o including a newline, then they've misused the formatting. If anyone wants that fixed then they'll have to write the code that accurately and efficiently distinguishes code within a paragraph from code as a paragraph.

      - tye        

        I just turned it off. No change to this thread. Yes, firefox/mozilla is broken. Given that this is something they've known about for years and years, what is the likelihood of us getting them to fix it? More likely to get PM to change behaviour somehow. (And even then, with your exasperation, it seems that even that is unlikely.)

        Then turn "auto" code wrapping off!

        I did, and Mozilla still gives me a wide horizontal view of bart's post.


        I'm not really a human, but I play one on earth. flash japh
Re: code without newline doesn't wrap
by castaway (Parson) on Feb 12, 2005 at 14:07 UTC
    Some investigation proves, that this is just a further 'Mozilla/FireFox don't render soft hyphens like other browsers' problem. Using Mozilla, and turning PMs code wrapping options on (Auto Code Wrap, plus an entry in the Code Length field); makes PM output soft hyphens at appropriate places in the code, but Mozilla ignores these.

    Turning the Code Wrapping options off, PM turns sections of code with any newlines in them, into pre tags, and adds soft hyphens AND extra newlines where the code should wrap. (Default 70 long, unless a value is set in Code Length). Sections without newlines don't get either of these.

    Aside from discussions about why Mozilla doesnt interpret soft hyphens like the rest, how can we solve this problem? I'm currently wondering if there's a good reason why code sections without newlines doesnt get such added, just like sections with newlines, since it clearly doesnt wrap for a lot of users.

    castaway looks over at tye

    C.

    discussion of softhyphens as wrapping characters

Re: code without newline doesn't wrap
by Dietz (Curate) on Feb 12, 2005 at 16:05 UTC
    Hi bart!

    I'm using Firefox myself, and for me, the page appears similar to your screenshots.

    The examples you provided are in code tags, thus, the code wrapper comes in place when there's a newline provided.

    $mainform->tab->Page4->AddRichEdit... from Re^2: Change readonly status of Win32::GUI::RichEdit is not in code tags.
    So this is no issue for code wrapper and probably cannot be fixed within PM.


    Back to code without newline:

    I'm using a modified version of demerphq's CSS (Re: Perl-blue theme (Aristotle/Demerphq Blue)), and so, code appears for me in the following form:
    This is code

    For the behavior of code wrapper, I'm glad that it doesn't wrap code when there is no newline.
    For instance when code tags are used for mentioning functions or such within a sentence.

    But this is just a matter of taste.

    2 examples which are using "use strict;" in code tags:

    Following use strict; is in code tags and appears in one sentence.

    Now here is a sentence with
    use strict;
    and it is also containing
    use warnings;
    just to demonstrate that this is one sentence.


    The second sentence would appear in the above form if code wrapper would wrap code even when there is no newline in it.
    At least if you are using a similiar CSS.

    Maybe there is a need for another tag you could use instead of <code></code> like <fixed></fixed> , which could be used in sentences instead of code tags, but there is no profit when users don't use it.


    Update:
    Corrected link-id to demerphq's CSS
    and added inline CSS style to simulate the display of my CSS settings for code tags.
    Update 2:
    Removed inline CSS style because it didn't show up after my update.
    It seems that I'm not able to show a simulation of my CSS settings (sigh).
    In fact text in code tags should show up in a table with black background.
      $mainform->tab->Page4->AddRichEdit... from Re^2: Change readonly status of Win32::GUI::RichEdit is not in code tags.

      It is. Two ways you can tell:

      1. If you look at the "download code" section, it is there. How could it be if it wasn't in code tags?
      2. If you look at the XML, you can clearly see the code tags.

      And even if it wasn't, mine is in code tags. I personally did it that way. The only difference between my first example that doesn't wrap, and the following two examples that do wrap, is the addition of an extra newline inside the code tags. So it's that newline that triggers the code wrapper.

        Ah, I see.
        I didn't know that you could tell by viewing the xml version.
        Thanks for clarification! ++

        Still, I like code wrapper the way it is now (as pseudo-demonstrated by me),
        but I could also live with it if it was changed.
        But this is just my opinion.
Re: code without newline doesn't wrap
by ysth (Canon) on Feb 15, 2005 at 22:44 UTC
    AFAICT this is by design, and shouldn't be "fixed". code tags not containing a newline are supposed to act like inline tags. How would you tell where to break it up?