Pasting code into WordPress post – LFs being eaten

I’m sure this is an inappropriate question for this SE because it’s not programming related AFAIK but maybe someone here has an idea. I’ve been posting code into my blog for years and have had no formatting concerns. Now all of a sudden, when I copy and paste code from whatever IDE I’m working in, the LFs are stripped out. I can’t imagine what may have changed.

Some additional troubleshooting info:

Read More
  • I’m pasting into the visual editor, not the HTML editor (this is how I’ve always done it)
  • pasting into a PRE section doesn’t help
  • the CR/LF information is in the clipboard (when I paste into Word for example, the LFs and tabs are preserved)
  • pasting using Paste Text has the correct LFs but strips out tabs so that’s not an option
  • pasting using Paste from Word does the same
  • I’m using the latest WP update (as of this time) WP 3.1.2
  • I”m using TinyMCE, but have disabled it and that’s had no effect; also WP-Syntax, no joy

Can anyone suggest something else to look into to figure this out? It’s killing me.

I’ve re-read the section in the Codex just to be sure I’m not missing something obvious, but there’s nothing that pops up. I’ve been pasting code into my blog (www.tomauger.com) for years and years now without any special plugins, just sticking it inside PRE tags and have never ever encountered this issue. What could have changed?

Related posts

Leave a Reply

1 comment

  1. This almost certainly appears to be a Google Chrome issue (though the bug is still probably within WordPress, since Chrome does preserve all tabs and linebreaks when pasting into the Paste Text or Paste from Word areas, so Chrome is not itself stripping out the linebreaks.)

    I’m recommending we close this cause it probably doesn’t belong here anyway, and I’ll post a bug on Trac.