void (@NotNull Editor editor, int offset, boolean animated, boolean onlyMajorForward, boolean onlyMajorBackward) { ScrollingModel model = editor.getScrollingModel(); int currentOffset = model.getVerticalScrollOffset(); if (onlyMajorForward && offset > currentOffset || onlyMajorBackward && offset < currentOffset) { if (Math.abs(offset - currentOffset) < editor.getLineHeight()) { return; } } if (!animated) model.disableAnimation(); model.scrollVertically(offset); if (!animated) model.enableAnimation(); }