EADS-3685 - A comment row will be inserted if you type code before a comment and enter return. that should not happen
authorchrislovsund@netbeans.org
Thu, 16 May 2013 15:00:34 +0200
changeset 400183a12deacb1
parent 399 f98530851dd0
child 401 b82d3dc958ae
EADS-3685 - A comment row will be inserted if you type code before a comment and enter return. that should not happen
now check if on a row with comment issue at start as well as row after
PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlTypedBreakInterceptor.java
     1.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlTypedBreakInterceptor.java	Wed May 15 23:04:20 2013 +0200
     1.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlTypedBreakInterceptor.java	Thu May 16 15:00:34 2013 +0200
     1.3 @@ -32,7 +32,9 @@
     1.4        }
     1.5        BaseDocument doc = (BaseDocument) context.getDocument();
     1.6        int insertPos = context.getCaretOffset();
     1.7 -      if (wordInRowBelowStartsWith(doc, insertPos, "--")) {
     1.8 +      int lineStartPos = Utilities.getRowStart(doc, insertPos);
     1.9 +      String startWord = Utilities.getWord(doc, lineStartPos);
    1.10 +      if (startWord.startsWith("--") && wordInRowBelowStartsWith(doc, insertPos, "--")) {
    1.11           context.setText("\n--  ", 0, 5);
    1.12        }
    1.13     }