                (repeat (- (count line) x) (empty-cell char-attrs)))))
 
 (defn clear-to-end-of-screen [{{:keys [x y]} :cursor :keys [width height char-attrs] :as vt}]
-  (update-in vt [:lines] (fn [lines]
-                           (let [top-lines (take y lines)
-                                 curr-line (clear-line-right (nth lines y) x char-attrs)
-                                 bottom-lines (repeat (- height y 1) (empty-line width char-attrs))]
-                             (vec (concat top-lines [curr-line] bottom-lines))))))
+  (update vt :lines (fn [lines]
+                      (let [top-lines (take y lines)
+                            curr-line (clear-line-right (nth lines y) x char-attrs)
+                            bottom-lines (repeat (- height y 1) (empty-line width char-attrs))]
+                        (vec (concat top-lines [curr-line] bottom-lines))))))
 
 (defn clear-line-left [line x char-attrs]
   (vec (concat (repeat (inc x) (empty-cell char-attrs))
                (drop (inc x) line))))
 
 (defn clear-to-beginning-of-screen [{{:keys [x y]} :cursor :keys [width height char-attrs] :as vt}]
-  (update-in vt [:lines] (fn [lines]
-                           (let [top-lines (repeat y (empty-line width char-attrs))
-                                 curr-line (clear-line-left (nth lines y) x char-attrs)
-                                 bottom-lines (drop (inc y) lines)]
-                             (vec (concat top-lines [curr-line] bottom-lines))))))
+  (update vt :lines (fn [lines]
+                      (let [top-lines (repeat y (empty-line width char-attrs))
+                            curr-line (clear-line-left (nth lines y) x char-attrs)
+                            bottom-lines (drop (inc y) lines)]
+                        (vec (concat top-lines [curr-line] bottom-lines))))))
 
 (defn clear-screen [{:keys [width height char-attrs] :as vt}]
   (assoc-in vt [:lines] (empty-screen width height char-attrs)))

  ([vt] (scroll-down vt 1))
  ([{:keys [width top-margin bottom-margin char-attrs] :as vt} n]
   (let [filler (empty-line width char-attrs)]
     (update-in vt [:lines] (fn [lines]
                              (vec (concat
                                    (take top-margin lines)
                                    (scroll-down-lines (subvec lines top-margin (inc bottom-margin)) n filler)
                                    (drop (inc bottom-margin) lines))))))))

(defn move-cursor-to-col [vt x]
  (-> vt

  ([vt] (scroll-up vt 1))
  ([{:keys [width top-margin bottom-margin char-attrs] :as vt} n]
   (let [filler (empty-line width char-attrs)]
     (update vt :lines (fn [lines]
                         (vec (concat
                               (take top-margin lines)
                               (scroll-up-lines (subvec lines top-margin (inc bottom-margin)) n filler)
                               (drop (inc bottom-margin) lines))))))))

(defn scroll-down-lines [lines n filler]
  (let [height (count lines)
