mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-129066 Console auto scroll does not work properly with foldings
This commit is contained in:
@@ -674,7 +674,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
final Document document = myEditor.getDocument();
|
||||
final RangeMarker lastProcessedOutput = document.createRangeMarker(document.getTextLength(), document.getTextLength());
|
||||
final int caretOffset = myEditor.getCaretModel().getOffset();
|
||||
final boolean isAtLastLine = document.getLineNumber(caretOffset) >= document.getLineCount() - 1;
|
||||
final boolean isAtLastLine = isCaretAtLastLine();
|
||||
|
||||
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
|
||||
@Override
|
||||
@@ -1078,6 +1078,9 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
};
|
||||
if (immediately) {
|
||||
model.runBatchFoldingOperation(operation);
|
||||
if (isCaretAtLastLine()) {
|
||||
EditorUtil.scrollToTheEnd(myEditor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
model.runBatchFoldingOperationDoNotCollapseCaret(operation);
|
||||
@@ -1092,6 +1095,12 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCaretAtLastLine() {
|
||||
final Document document = myEditor.getDocument();
|
||||
final int caretOffset = myEditor.getCaretModel().getOffset();
|
||||
return document.getLineNumber(caretOffset) >= document.getLineCount() - 1;
|
||||
}
|
||||
|
||||
private void addFolding(Document document, CharSequence chars, int line, List<FoldRegion> toAdd) {
|
||||
String commandLinePlaceholder = myCommandLineFolding.getPlaceholder(line);
|
||||
if (commandLinePlaceholder != null) {
|
||||
|
||||
Reference in New Issue
Block a user