From 668ee6e3392265b9a93e4c3d3d4d7232f8961564 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 24 Jan 2012 14:44:47 +0100 Subject: [PATCH] IDEA-79264 (IDEA's copy/paste gets in my way when copying between string literals) --- .../StringLiteralCopyPasteProcessor.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java index f79099f4c2db..75ea17b574c6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -132,28 +132,22 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor { } if (isStringLiteral(token)) { - if (rawText != null && rawText.rawText != null) { - text = rawText.rawText; - } - StringBuilder buffer = new StringBuilder(text.length()); @NonNls String breaker = getLineBreaker(token); final String[] lines = LineTokenizer.tokenize(text.toCharArray(), false, true); for (int i = 0; i < lines.length; i++) { buffer.append(escapeCharCharacters(lines[i], token)); - if (i != lines.length - 1 || "\n".equals(breaker) && text.endsWith("\n")) { + if (i != lines.length - 1) { buffer.append(breaker); } + else if (text.endsWith("\n")) { + buffer.append("\\n"); + } } text = buffer.toString(); } else if (isCharLiteral(token)) { - if (rawText != null && rawText.rawText != null) { - return escapeCharCharacters(rawText.rawText, token); - } - else { - return escapeCharCharacters(text, token); - } + return escapeCharCharacters(text, token); } return text; }