junichi11 closed pull request #627: donation2_merge:#215318: Fixing the auto 
comment population
URL: https://github.com/apache/incubator-netbeans/pull/627
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptor.java
 
b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptor.java
index 4037798f58..1b2d29e201 100644
--- 
a/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptor.java
+++ 
b/javascript2.editor/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptor.java
@@ -202,8 +202,8 @@ public void insert(MutableContext context) throws 
BadLocationException {
         if (id.isError()) {
             // See if it's a block comment opener
             String text = token.text().toString();
-            if (comments.test(doc) && text.startsWith("/*") && ts.offset() == 
Utilities.getRowFirstNonWhite(doc, offset)) {
-                int indent = GsfUtilities.getLineIndent(doc, offset);
+            if (comments.test(doc) && text.startsWith("/*") ) {
+                int indent = GsfUtilities.getLineIndent(doc, ts.offset());
                 StringBuilder sb = new StringBuilder();
                 sb.append("\n"); // NOI18N
                 sb.append(IndentUtils.createIndentString(doc, indent));
diff --git 
a/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptorTest.java
 
b/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptorTest.java
index bd3d7043a1..7f8fb308f4 100644
--- 
a/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptorTest.java
+++ 
b/javascript2.editor/test/unit/src/org/netbeans/modules/javascript2/editor/JsTypedBreakInterceptorTest.java
@@ -546,5 +546,23 @@ public void testIssue236799_02() throws Exception {
                 + "\\n\\^\n'\n"
                 + "};"
         );
+    } 
+   
+    public void testIssue215318() throws Exception {
+        insertBreak(
+                "    /**\n"
+                + "     *^",
+                "    /**\n"
+                + "     *\n"
+                + "     * ^\n"
+                + "     */");
     }
+
+    public void testIssue215318_1() throws Exception {
+        insertBreak(
+                "    /** *^",
+                "    /** *\n"
+                + "     * ^\n"
+                + "     */");
+    } 
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to