private static boolean isVScrollAtTheBottom(@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();
  }
private static boolean isVScrollAtTheBottom(@NotNull EditorEx editor, boolean useImmediatePosition)