Support » Fixing WordPress » The Editor adds Unexpected Carriage Return at end of the line

  • When in text editing mode the editor is adding an unexpected carriage return at the end of the line.

    1) Open up Editor and click on the Text tab.
    2) Write a line of text and at the end of the line start typing numbers until the word wraps to the next line
    3) Move your cursor right before the character that caused the word to be placed on the next line. In my example it was between 6 and 7.
    4) Press Space twice. The second space will add both a space and carriage return
    5) You now have two spaces and a carriage return between those two characters, when you should only have two spaces.

    Video
    http://tinypic.com/r/2zp8rqs/9

    I edit exclusively in Text mode and I come across this fairly often.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Could not check the video as I do not have Flash. This may explain things: https://clickwp.com/kb/understanding-paragraphs-and-line-breaks-in-wordpress/.
    Also it is not clear whether your carriage return is only shown in text mode or also in the frontend or public facing website. In text mode there is only so much space to show and editor mode styling is not applied.

    Thread Starter stevegibson12

    (@stevegibson12)

    Thanks for the link. I converted the video to gif and took a screenshot of the source.

    https://imgur.com/a/Snowm

    There’s an unexpected <br> in between the 6 and 7. I only pressed space between those two, but when you do so at the end up the text entry line it adds it.

    I’d been noticing this for a while since it was goofing up my frontend appearance.

    Well perhaps the word is simply too long for the space left. When you added 7 to the long number that number was pushed to the next line.Could be a word-break rule. So when you broke up the word the second part was pushed to the next line as there was no more space left.

    Thread Starter stevegibson12

    (@stevegibson12)

    I don’t know what it’s related to. Maybe the word break rule you reference is affecting how the CR gets in there. Once it’s there WP later converts it to a break. If the editor doesn’t magically create that carriage return when I’m only typing spaces, everything would work as I think it’s supposed to be.

    Separately, it was news to me that Text edit mode is not strictly an HTML field. What I’m sure some people would value is the ability to view just the HTML, similar to the Custom HTML widget. Otherwise you never fully have control over your pages, which sometimes you need.

    Separately, it was news to me that Text edit mode is not strictly an HTML field.

    Well, yes, it should be. So do check in inspector if any CSS or other rules are applied. Do not have the time to check now, but I would check for that. Do know the regular editor allows for CSS to determine looks. This so the WYSIWYG editor shows more like how it will look frontend. But have not seen it with the text edit mode.

    Thread Starter stevegibson12

    (@stevegibson12)

    OK, thanks for the tips. Maybe I’ll poke around the code too. For now I can work around it by just deleting any unwanted CRs.

    I just did a quick test on a number of different applications. Surprisingly, it’s around 50-50 for the ones I tested. I didn’t submit these since how the system processes it isn’t really the issue. I just want two spaces to equal two spaces when I’m entering text regardless of where in the text entry field I am. Looks like an obscure use case that I alone care about though.

    Places it adds and extra CR/NL when you’re only typing spaces
    Wordpress Editor in Text mode
    Wordpress Custom HTML Field
    Wordpress Support forum field, bbPress
    Facebook Post Status
    Google Plus Post Status

    Places two spaces = two spaces
    Wordpress Editor in Visual mode
    Gmail
    Yahoo Mail
    Twitter Tweet Field
    LinkedIn Status Update
    Google docs
    TextEdit (on Mac)

    I’ll update this if I get the chance to check into it further and find anything interesting. My guess is most people aren’t reinventing the wheel when implementing editors and this weird bug is passed from one to the next.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘The Editor adds Unexpected Carriage Return at end of the line’ is closed to new replies.