import type { ScrollBoxRenderable } from "@opentui/core"

export function createScrollHelpers(scroll: { get value(): ScrollBoxRenderable | undefined }) {
  function toBottom() {
    setTimeout(() => {
      const s = scroll.value
      if (!s || s.isDestroyed) return
      s.scrollTo(s.scrollHeight)
    }, 50)
  }

  return { toBottom }
}
