#4556 - NetBeans should not auto-insert \n\ in Groovy triple quoted strings (#4562)

* #4556 - NetBeans should not auto-insert \n\ in Groovy triple quoted strings

* ''' are handle as well.
diff --git a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/typinghooks/GroovyTypedBreakInterceptor.java b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/typinghooks/GroovyTypedBreakInterceptor.java
index 11e76f9..7d5dd60 100644
--- a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/typinghooks/GroovyTypedBreakInterceptor.java
+++ b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/typinghooks/GroovyTypedBreakInterceptor.java
@@ -163,6 +163,11 @@
         }
 
         if (id == GroovyTokenId.STRING_LITERAL || id == GroovyTokenId.STRING_CH && offset < ts.offset()+ts.token().length()) {
+            String tokenText = token.text().toString();
+            if (id == GroovyTokenId.STRING_LITERAL 
+                    && (tokenText.startsWith("\"\"\"") || tokenText.startsWith("'''"))) {
+                return;
+            }
             String str = (id != GroovyTokenId.STRING_LITERAL || offset > ts.offset()) ? "\\n\\\n"  : "\\\n";
             context.setText(str, -1, str.length());
             return;
diff --git a/groovy/groovy.editor/test/unit/src/org/netbeans/modules/groovy/editor/typinghooks/TypedBreakInterceptorTest.java b/groovy/groovy.editor/test/unit/src/org/netbeans/modules/groovy/editor/typinghooks/TypedBreakInterceptorTest.java
index 77c4b06..184469a 100644
--- a/groovy/groovy.editor/test/unit/src/org/netbeans/modules/groovy/editor/typinghooks/TypedBreakInterceptorTest.java
+++ b/groovy/groovy.editor/test/unit/src/org/netbeans/modules/groovy/editor/typinghooks/TypedBreakInterceptorTest.java
@@ -146,5 +146,33 @@
         // No auto-// on new lines
         insertBreak("foo // ^", "foo // \n^");
     }
+    
+    public void testStringLiteral01() throws Exception {
+        insertBreak("String a = \"\"\" ahoj^how are you? \"\"\"", "String a = \"\"\" ahoj\n^how are you? \"\"\"");            
+    }
+    
+    public void testStringLiteral02() throws Exception {
+        insertBreak("\"\"\" ahoj^how are you?", "\"\"\" ahoj\n^how are you?");
+    }
 
+    public void testStringLiteral03() throws Exception {
+        insertBreak("\"\"\" ahoj^", "\"\"\" ahoj\n^");
+    }
+    
+    public void testStringLiteral04() throws Exception {
+        insertBreak("String a = \" ahoj^how are you? \"", "String a = \" ahoj\\n\\\n^how are you? \"");            
+    }
+
+    public void testStringLiteral05() throws Exception {
+        insertBreak("String a = ''' ahoj^how are you? '''", "String a = ''' ahoj\n^how are you? '''");            
+    }
+    
+    public void testStringLiteral06() throws Exception {
+        insertBreak("''' ahoj^how are you?", "''' ahoj\n^how are you?");
+    }
+
+    public void testStringLiteral07() throws Exception {
+        insertBreak("''' ahoj^", "''' ahoj\n^");
+    }
+        
 }