 
 ;; helper functions
 
+(defn show-cursor
+  ([vt] (show-cursor vt true))
+  ([vt show?]
+   (assoc-in vt [:cursor :visible] show?)))
+
+(defn set-margin [vt top bottom]
+  (assoc vt :top-margin top :bottom-margin bottom))
+
 (defn scroll-up [{:keys [width top-margin bottom-margin char-attrs] :as vt}]
   (update-in vt [:lines] (fn [lines]
                            (vec (concat

        bottom (dec (get-param vt 1 height))]
    (if (< -1 top bottom height)
      (-> vt
          (assoc :top-margin top :bottom-margin bottom)
          move-cursor-to-home)
      vt)))


           [nil 4] (assoc vt :insert-mode false)
           [0x3f 6] (-> vt (assoc :origin-mode false) move-cursor-to-home)
           [0x3f 7] (assoc vt :auto-wrap-mode false)
           [0x3f 25] (show-cursor vt false)
           :else vt)))

(defn reset-attrs [vt]
