mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed EA-83621
This commit is contained in:
@@ -85,6 +85,7 @@ public abstract class AbstractBlockWrapper {
|
||||
*
|
||||
* @return the whitespace preceding the block
|
||||
*/
|
||||
@Nullable
|
||||
public WhiteSpace getWhiteSpace() {
|
||||
return myWhiteSpaceBefore;
|
||||
}
|
||||
|
||||
@@ -88,22 +88,19 @@ public class CoreFormatterUtil {
|
||||
* @return non-line feed symbols to the left of the given wrapped block
|
||||
*/
|
||||
public static int getStartColumn(@Nullable LeafBlockWrapper block) {
|
||||
if (block != null) {
|
||||
int result = 0;
|
||||
while (true) {
|
||||
final WhiteSpace whiteSpace = block.getWhiteSpace();
|
||||
if (block == null) return -1;
|
||||
|
||||
int result = 0;
|
||||
while (true) {
|
||||
final WhiteSpace whiteSpace = block.getWhiteSpace();
|
||||
if (whiteSpace != null) {
|
||||
result += whiteSpace.getTotalSpaces();
|
||||
if (whiteSpace.containsLineFeeds()) {
|
||||
return result;
|
||||
}
|
||||
block = block.getPreviousBlock();
|
||||
if (result > CodeStyleSettings.MAX_RIGHT_MARGIN || block == null) return result;
|
||||
result += block.getSymbolsAtTheLastLine();
|
||||
if (block.containsLineFeeds()) return result;
|
||||
if (whiteSpace.containsLineFeeds()) return result;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
block = block.getPreviousBlock();
|
||||
if (result > CodeStyleSettings.MAX_RIGHT_MARGIN || block == null) return result;
|
||||
result += block.getSymbolsAtTheLastLine();
|
||||
if (block.containsLineFeeds()) return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user