Paste hell - how to stop Idea from inserting \n in strings?

Answered

Hi folks,

I'm trying to figure out how to stop Idea from inserting \n in strings which span multiple lines. Breaking up the string with "" + "" is fine, but inserting "\n" + "" is just wrong as now its breaking up stuff that is supposed to be on the same line.

IntelliJ IDEA 2021.1.3 (Ultimate Edition)
Build #IU-211.7628.21, built on June 30, 2021
You have a perpetual fallback license for this version.
Subscription is active until February 7, 2024.
Runtime version: 11.0.11+9-b1341.60 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12

Kotlin: 211-1.4.32-release-IJ7628.19

 

 

Note: This is a duplicate from 10 YEARS ago that was never addressed.   See 206965615-Paste-hell-how-to-stop-Idea-from-inserting-n-in-strings-

0
3 comments
It is not reproducible from my side. Can you please attach a sample?
0

Thanks for the quick response!

In a java module I have

@Schema(description = "")

Between the quotes I am pasting londe description text from a PDF document

It ends up looking like this:

@Schema(description = "The ontologyinfo command allows the user to find ontology information. Information includes\n" +
"description, id, synonyms and type of the ontology term.")

 

so splitting the line and adding the + is good but adding the '\n' is not.  I have noticed testing just now, this behavior only when pasting text cut from PDF documents?

0
That's because there is a line separator in the copied text.
0

Please sign in to leave a comment.