/** Get the indentation of the line. * @param formatTokenPosition any position on the line. * It doesn't have to be the first one. * @param zeroForWSLine If set to true the method will return zero * in case the line consist of whitespace only. If false * the method will return the indentation even for whitespace * lines. */ public int getLineIndent(FormatTokenPosition pos, boolean zeroForWSLine) { FormatTokenPosition firstNWS = findLineFirstNonWhitespace(pos); if (firstNWS == null) { // no non-WS char on the line if (zeroForWSLine) { return 0; } else { // return indent even for WS lines firstNWS = findLineEnd(pos); } } return getVisualColumnOffset(firstNWS); }
/** * Get the indentation of the line. * * @param formatTokenPosition * any position on the line. It doesn't have to be the first one. * @param zeroForWSLine * If set to true the method will return zero in case the line * consist of whitespace only. If false the method will return * the indentation even for whitespace lines. */ public int getLineIndent(FormatTokenPosition pos, boolean zeroForWSLine) { FormatTokenPosition firstNWS = findLineFirstNonWhitespace(pos); if (firstNWS == null) { // no non-WS char on the line if (zeroForWSLine) { return 0; } else { // return indent even for WS lines firstNWS = findLineEnd(pos); } } return getVisualColumnOffset(firstNWS); }