mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Corrected folding processing
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user