Corrected folding processing

This commit is contained in:
Denis Zhdanov
2011-07-12 14:45:55 +04:00
parent 04b2e76abf
commit 2efe62ce99
@@ -44,13 +44,17 @@ class FoldingUtil {
return null;
}
@Nullable
public static FoldRegion findFoldRegionStartingAtLine(Editor editor, int line){
FoldRegion result = null;
if (line >= editor.getDocument().getLineCount()) {
if (line < 0 || line >= editor.getDocument().getLineCount()) {
return result;
}
FoldRegion[] regions = editor.getFoldingModel().getAllFoldRegions();
for (FoldRegion region : regions) {
if (!region.isValid()) {
continue;
}
if (region.getDocument().getLineNumber(region.getStartOffset()) == line) {
if (result != null) return null;
result = region;