wood burning stoves 2.0*
The moose likes Ranch Office and the fly likes How does copy from code samples work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "How does copy from code samples work?" Watch "How does copy from code samples work?" New topic
Author

How does copy from code samples work?

Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Whenever I copy some code examples from a post, and paste it into my IDE (or text editor), there doesn't appear to be any linefeed characters...everything prints on one line.
Why is this?
Thanks!
Rob


Rob
SCJP 1.4
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

The problems vary with the editor, I'm sure. Whenever I paste in text from a post I get a bunch o' tabs after the first line. Very annoying, since the reason I do it in the first place is to make the code more readable.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Back in the good old days, my preferred solution was to hit "edit" on the post I wanted to copy from - if you cut & paste from the edit screen, linefeeds are preserved, while cut & paste from the regular view does not. The key is, you could go to the edit screen even if you had no intent or authorization to edit a given post, since the system didn't require a password until you pressed "submit". You could also use this to discover what UBB and HTML codes had been used in someone else's post - very useful for learning. Now with the upgrade though, you can no longer get to the edit screen unless you are authorized to actually perform an edit. Which means it must be your own post, or you must be a sheriff or a bartender acting in your own form. Which ofcourse makes this trick of limited use to most people.
However, I just tried using Opera instead of IE, and found that I can cut and paste just fine there, with linefeeds preserved. So it may be worthwhile switching over - or at least, have Opera available on your system, and try it occasionally. Go to www.opera.com (duh) to download it. Enjoy.
[ January 10, 2002: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
WordPad preserve the linefeeds. You could paste it there then cut and paste to whereever from there. It is an Editor/IDE thing (JCreator/WordPad preserves Programmers File Editor/NotePad does not).
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205

Arrrg, this is driving me BONKERS!
Even when I try to copy code text from a post, so I can quote it in another post, and I paste it directly into the "Post A Reply" form's text field, it still prints all the lines in one row and I have to manually enter a return for each line.
This is the 21st century for god's sake, don't we have technology for these "complicated" editing problems?!?
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Originally posted by Jim Yingst:
Back in the good old days, my preferred solution was to hit "edit" on the post I wanted to copy from - if you cut & paste from the edit screen, linefeeds are preserved, while cut & paste from the regular view does not. The key is, you could go to the edit screen even if you had no intent or authorization to edit a given post, since the system didn't require a password until you pressed "submit". You could also use this to discover what UBB and HTML codes had been used in someone else's post - very useful for learning. Now with the upgrade though, you can no longer get to the edit screen unless you are authorized to actually perform an edit. Which means it must be your own post, or you must be a sheriff or a bartender acting in your own form. Which ofcourse makes this trick of limited use to most people.

You can hit "Reply with Quote" button for this proposal. The text will be enclosed in QUOTE tags, but all inner formatting is preserved.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Ah, good point. I never bothered with "Reply with quote" since I prefer to interleaven my responses within the text I'm quoting, and
tags don't really allow this. But clearly the button has other uses I hadn't considered.
[ January 10, 2002: Message edited by: Jim Yingst ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does copy from code samples work?