mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-72690 Auto Collapse File Header Code Folding seems broken
Corrected 'expanded' folding state processing for the regions that start at the zero offset
This commit is contained in:
+10
-2
@@ -153,8 +153,16 @@ class UpdateFoldRegionsOperation implements Runnable {
|
||||
if (caretOffset > myEditor.getDocument().getTextLength()) {
|
||||
return false;
|
||||
}
|
||||
final int currentLine = document.getLineNumber(caretOffset);
|
||||
caretInside = firstLine <= currentLine && currentLine <= lastLine;
|
||||
if (caretOffset == 0 && myApplyDefaultState) {
|
||||
// Caret is located at the zero position when the editor is just opened, so, any fold region that starts at the zero
|
||||
// offset (e.g. file header provided by 'copyright' plugin) is always expanded. We want to avoid that, hence, corresponding
|
||||
// control flow branch is introduced.
|
||||
caretInside = false;
|
||||
}
|
||||
else {
|
||||
final int currentLine = document.getLineNumber(caretOffset);
|
||||
caretInside = firstLine <= currentLine && currentLine <= lastLine;
|
||||
}
|
||||
}
|
||||
|
||||
if (myApplyDefaultState) {
|
||||
|
||||
Reference in New Issue
Block a user