1.1 --- a/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Fri Feb 03 16:09:52 2012 +0100
1.2 +++ b/PLSQL/Formatter/src/org/netbeans/modules/plsql/format/PlsqlFormatter.java Sat Feb 04 10:44:20 2012 +0530
1.3 @@ -726,7 +726,7 @@
1.4 && (!imageTmpPre.equalsIgnoreCase(";")))
1.5 || (imageTmp.equalsIgnoreCase("LOOP")
1.6 && (!imageTmpPre.equalsIgnoreCase(";")))
1.7 - || (imageTmp.equalsIgnoreCase("BEGIN"))
1.8 + || (imageTmp.equalsIgnoreCase("BEGIN"))
1.9 || (imageTmp.equalsIgnoreCase("CASE"))
1.10 || (imageTmp.equalsIgnoreCase("PACKAGE"))) {
1.11 isParent = true;
1.12 @@ -754,7 +754,7 @@
1.13
1.14 return tokenParent;
1.15 }
1.16 -
1.17 +
1.18 /**
1.19 * Get the backward indentation for the current token
1.20 * based on the previous token and the current token.
1.21 @@ -780,7 +780,7 @@
1.22 //END can be ending BEGIN, EXCEPTION, LOOP, IF
1.23 //need the corresponding one
1.24 TokenItem endParent = getEndParent(previousNWS);
1.25 -
1.26 +
1.27 if (endParent != null) {
1.28 indent = getIndentationDiff(endParent, previousNWS);
1.29 }
1.30 @@ -1438,7 +1438,7 @@
1.31
1.32 int indent = getTabSize();
1.33 TokenItem first = findLineFirstNonWhitespace(getPosition(previousNWS, 0)).getToken();
1.34 -
1.35 +
1.36 int parent = getVisualColumnOffset(getPosition(first, 0));
1.37 TokenItem findStatementStart = findStatementStart(first);
1.38
1.39 @@ -1448,8 +1448,12 @@
1.40
1.41 do {
1.42 first = first.getNext();
1.43 - if ((first != null) && (first.getTokenID() != PlsqlTokenContext.WHITESPACE) && (first.getTokenID() != PlsqlTokenContext.BLOCK_COMMENT) && (first.getTokenID() != PlsqlTokenContext.LINE_COMMENT)) {
1.44 - return getVisualColumnOffset(getPosition(first, 0)) - parent;
1.45 + if ((first != null) && (first.getTokenID() != PlsqlTokenContext.WHITESPACE) && (first.getTokenID() != PlsqlTokenContext.BLOCK_COMMENT) && (first.getTokenID() != PlsqlTokenContext.LINE_COMMENT)) {
1.46 + if (parent != 0 && parent < getVisualColumnOffset(getPosition(first, 0))) {
1.47 + return 0;
1.48 + } else {
1.49 + return getVisualColumnOffset(getPosition(first, 0)) - parent;
1.50 + }
1.51 }
1.52 } while (first != null);
1.53 return indent;