boolean (@NotNull EditorEx editor, boolean useImmediatePosition) { JScrollBar scrollBar = editor.getScrollPane().getVerticalScrollBar(); int scrollBarPosition = useImmediatePosition ? scrollBar.getValue() : editor.getScrollingModel().getVisibleAreaOnScrollingFinished().y; return scrollBarPosition == scrollBar.getMaximum() - scrollBar.getVisibleAmount(); }