From c5534728d14def32076394f9d35afd85206fd294 Mon Sep 17 00:00:00 2001 From: anna Date: Tue, 4 Dec 2012 16:13:13 +0100 Subject: [PATCH] i18n: do not escape \n (IDEA-95743) --- .../properties/editor/ResourceBundleUtil.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java index 235f50d6d62e..99458cf5bed1 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleUtil.java @@ -51,6 +51,9 @@ public class ResourceBundleUtil { escaped = true; continue; } + if (escaped && c == 'n') { + buffer.append(ESCAPE_SYMBOL); + } buffer.append(c); escaped = false; } @@ -70,11 +73,21 @@ public class ResourceBundleUtil { char c = text.charAt(i); if ((i == 0 && (c == ' ' || c == '\t')) // Leading white space - || c == '\n' // Multi-line value - || c == ESCAPE_SYMBOL // Escaped 'escape' symbol + || c == '\n' // Multi-line value || SYMBOLS_TO_ESCAPE.contains(c)) // Special symbol { buffer.append(ESCAPE_SYMBOL); + } + else if (c == ESCAPE_SYMBOL) // Escaped 'escape' symbol) + { + if (text.length() > i + 1) { + final char nextChar = text.charAt(i + 1); + if (nextChar != 'n') { + buffer.append(ESCAPE_SYMBOL); + } + } else { + buffer.append(ESCAPE_SYMBOL); + } } buffer.append(c); }