Jump to content
Brandon Staggs

Convert line endings on paste?

Recommended Posts

I am working on a project that involves a lot of documentation pasting and the source is always not CRLF. 

 

Pasting non-CRLF line endings into a Delphi pascal unit, at least in the project, is a sure-fire way to lobotomize LSP.

 

If I close the IDE and re-open it, it automatically converts the line endings to CRLF, and then once saved, LSP behaves again.

 

Is there a way to have the IDE automatically convert line endings on paste? I think the answer is no, but figured I should check.

Share this post


Link to post

Cannot try in the moment, but perhaps MultiPaste can act as a workaround.

 

Nevertheless, it would make for a good feature request.

Share this post


Link to post
33 minutes ago, Brandon Staggs said:

Is there a way to have the IDE automatically convert line endings on paste?

Not that I'm aware of.  But its funny, because the RTL does have an AdjustLineBreaks() function, so it would have been trivial for the IDE to adjust pasted text to the editor's native format.

Share this post


Link to post
4 minutes ago, programmerdelphi2k said:

if does not exists, then just "Copy" to any text-editor like MS Notepad, and later. "Copy/Paste" in your unit Pas!

Of course, that is a workaround. One that adds another step that I will forget to do because this is the only time I need to do it when copy and pasting.. something I do a lot of... If the source files were not all PDFs I would have converted all of those in the first place.

Share this post


Link to post
4 minutes ago, Brandon Staggs said:

If the source files were not all PDFs

You mean open PDF files in the IDE? well, then, I think this is beyond the scope of the IDE, after all third-party applications have adopted their own rules for creating and opening files.
However, in RAD you have the option of "UserInterface->Editor->LineEndings-> ASK" to convert the CRLF when the file is opened, have you tried this route? you may need to add the file extension in "Known extentions"...

Share this post


Link to post
Just now, programmerdelphi2k said:

You mean open PDF files in the IDE? well, then, I think this is beyond the scope of the IDE,

No, why would I want to do that? I am copying and pasting documentation from PDFs into the IDE, ergo my original post about pasting text into the IDE.

Share this post


Link to post
1 minute ago, programmerdelphi2k said:

However, in RAD you have the option of "UserInterface->Editor->LineEndings-> ASK" to convert the CRLF when the file is opened, have you tried this route? you may need to add the file extension in "Known extentions"

This doesn't make any sense. Please see the original post. I am asking about pasted text, not opening text files.

Share this post


Link to post
1 hour ago, programmerdelphi2k said:

ok, you're very nervous!  sorry!

LOL, no, just trying to increase the signal/noise ratio in the thread.

Share this post


Link to post
1 minute ago, Brandon Staggs said:

LOL, no, just trying to increase the signal/noise ratio in the thread.

😁  mmm, sometimes the "words" say more than itself!  ok, YOU'RE not nervous now!  :classic_biggrin: :classic_cheerleader:

Share this post


Link to post
1 minute ago, programmerdelphi2k said:

nervous

You keep using that word, I do not think it means what you think it means.

Share this post


Link to post
Just now, programmerdelphi2k said:

look your avatar... is nervous or calm down? :classic_rolleyes: :classic_biggrin:

So, the movie-reference avatar is meant to be funny, not taken seriously. Also, the phrase "You keep using that word, I do not think it means what you think it means" is a movie reference as well, meant to lighten the mood of a discussion. Maybe a language barrier on top of cultural references going on here.

Share this post


Link to post
1 minute ago, Brandon Staggs said:

Maybe a language barrier on top of cultural references going on here.

You're right! I beg your perdon about anything and let's go ahead...

Share this post


Link to post
On 5/17/2023 at 10:49 AM, Uwe Raabe said:

Cannot try in the moment, but perhaps MultiPaste can act as a workaround.

This actually works. It trims each line. And since I am immediately commenting out these lines, I can use Multipaste to do this at the same time. Not that commenting out a block of lines is easier this way, but, it does resolve the original problem. Thanks for the suggestion.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×