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:

  • 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?

  • Are you pasting into the visual editor or HTML editor? – Ian Dunn May 20 '11 at 14:03
  • 1
    Visual editor - I've always pasted into the Visual editor. I'll update my question to reflect this. – Tom Auger May 20 '11 at 18:25
  • It's possible something changed in TinyMCE and not WP? – Milo May 20 '11 at 18:30
  • Tried disabling the plugin and it didn't change anything. – Tom Auger May 20 '11 at 18:57
  • 1
    I mean the default TinyMCE editor that WP uses. does it lose formatting if you switch back and forth between html/visual? if so, it's TinyMCE. if it happens after save, then it's WP. – Milo May 20 '11 at 19:04

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.

  • I feel dirty accepting my own answer, but I don't know how to delete a question. – Tom Auger Jun 7 '11 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.