•  
      request #11914 Newlines in comments may be lost
    Infos
    #11914
    Aurélien Tisné (atisne)
    2022-05-24 08:59
    2018-07-25 15:36
    12521
    Details
    Newlines in comments may be lost
    Steps to reproduce:

    1- Add a (text) follow-up containing several successive newlines to an artefact
    sample:
    "This is the first section.

    This is the second one."
    2- save the artefact
    3- edit the follow-up
    -> The blank line is lost.

    The system should not alter the text.

    (You can test below.)
    Trackers
    All
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Verified
    Empty
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar
    Your remark is important. Whitespaces at the beginning of the lines may be useful. Especially to structure ideas:

    - first item
    - sub item
    - sub sub item
    - second item

    Currently, beginning whitespaces are kept but regrettably not displayed on the view mode.

    Trailing whitespaces are useless (I think).
    User avatar
    Thomas Gerbet (tgerbet)2018-07-25 16:31
    Hi,

    I confirm.


    You can work around it by using the HTLM format.




    I just took a quick look on what's going on behind the scene: the content is retrieved with Node.textContent so the newlines are indeed lost. We should probably use Node.innerText instead to keep the new lines [0]. The content will still be changed a bit (e.g. we will lost whitespaces at the beginning or at the end of lines) but closer to what's being displayed to the user. To keep the exact same content we would need to inject somewhere in the DOM the raw text content, I'm not sure we need to go this far.

    [0] http://perfectionkills.com/the-poor-misunderstood-innerText/

    • Status changed from New to Verified
    • Reported in version changed from 10.3 to All
    User avatar
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes