PDA

View Full Version : Code formatting lost?



mdavis6890
8 Feb 2012, 7:04 AM
How do you all paste data into a post?

Whenever I try, it looks fine until I submit it. Then all my CR/LF are lost. I've tried pasting into intermediate programs like notepad as well, to no avail.

Any ideas?

tvanzoelen
8 Feb 2012, 7:07 AM
Use code tags (# button) around your code

[CODE]

[(/)CODE]

but / without parenthesis , else I couldn't display it

Farish
8 Feb 2012, 7:08 AM
also happens to me a lot!

mystix
8 Feb 2012, 7:21 AM
Check out the vBulletin forum cheatsheat:
http://www.sencha.com/forum/misc.php?do=bbcode

contains everything you might ever need... and more!

mdavis6890
8 Feb 2012, 9:49 AM
Not at all what I'm talking about. I'm very familiar with [CODE] and
tags.

Code that I paste looks like this:
[PHP]
code
indented code
more code


But when I save/submit it gets changed to:


code indented code more code

And continues to look this way, even when I go back to edit it. I.e. the CR/LF are really gone, even in edit mode. (Note that spaces are still there - see the gap between "code" and "indented code" above.)

mystix
8 Feb 2012, 11:14 AM
strange. what OS & text editor are you using?

All I'm doing on my end is copy-pasting code from TextMate (running on OSX) into Chrome.
My LFs are never removed.

Notepad tends to mess up CRs/LFs -- try notepad++ instead.

mdavis6890
8 Feb 2012, 11:18 AM
Notepad++, Windows 7 64bit.

I've also tried to use TextPad and Notepad or both in the middle of the copy/paste process to see if that changes anything. It doesn't. It continues to look fine in each program, as well as the text editor in the forum - until I click submit or save.

mystix
8 Feb 2012, 5:09 PM
Another thing to try: I'm using 4 spaces for indentation.

You might also want to check for any clipboard-assist software / browser plugin which removes formatting from copied text.

Have you tried typing code directly into the [code][ /code] tags?