 (defn execute-il [{:keys [bottom-margin width height char-attrs] {y :y} :cursor :as vt}]
   (let [n (get-param vt 0 1)
         filler (empty-line width char-attrs)]
-    (update-in vt [:lines] (fn [lines]
-                             (vec (if (<= y bottom-margin)
-                                    (concat
-                                     (take y lines)
-                                     (scroll-down-lines (subvec lines y (inc bottom-margin)) n filler)
-                                     (drop (inc bottom-margin) lines))
-                                    (concat
-                                     (take y lines)
-                                     (scroll-down-lines (drop y lines) n filler))))))))
+    (update vt :lines (fn [lines]
+                        (vec (if (<= y bottom-margin)
+                               (concat
+                                (take y lines)
+                                (scroll-down-lines (subvec lines y (inc bottom-margin)) n filler)
+                                (drop (inc bottom-margin) lines))
+                               (concat
+                                (take y lines)
+                                (scroll-down-lines (drop y lines) n filler))))))))
 
 (defn execute-dl [{:keys [bottom-margin width height char-attrs] {y :y} :cursor :as vt}]
   (let [n (get-param vt 0 1)
         filler (empty-line width char-attrs)]
-    (update-in vt [:lines] (fn [lines]
-                             (vec (if (<= y bottom-margin)
-                                    (concat
-                                     (take y lines)
-                                     (scroll-up-lines (subvec lines y (inc bottom-margin)) n filler)
-                                     (drop (inc bottom-margin) lines))
-                                    (concat
-                                     (take y lines)
-                                     (scroll-up-lines (drop y lines) n filler))))))))
+    (update vt :lines (fn [lines]
+                        (vec (if (<= y bottom-margin)
+                               (concat
+                                (take y lines)
+                                (scroll-up-lines (subvec lines y (inc bottom-margin)) n filler)
+                                (drop (inc bottom-margin) lines))
+                               (concat
+                                (take y lines)
+                                (scroll-up-lines (drop y lines) n filler))))))))
 
 (defn execute-dch [{{:keys [x y]} :cursor :keys [width char-attrs] :as vt}]
   (let [vt (if (>= x width) (move-cursor-to-col vt (dec width)) 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-in 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)

  ([vt] (scroll-down 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-down-lines (subvec lines top-margin (inc bottom-margin)) n filler)
                               (drop (inc bottom-margin) lines))))))))

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