public static void perform(@Nullable Document document, boolean stopAnimation, @NotNull Runnable runnable) {
    EditorScrollingPositionKeeper.ForDocument keeper = new EditorScrollingPositionKeeper.ForDocument(document);
    keeper.savePosition();
    try {
      runnable.run();
      keeper.restorePosition(stopAnimation);
    }
    finally {
      Disposer.dispose(keeper);
    }
  }
public static void perform(@Nullable Document document, boolean stopAnimation, @NotNull Runnable runnable)