   (vec (concat (take x line)
                (repeat (- (count line) x) (empty-cell char-attrs)))))
 
-(defn clear-to-end-of-screen [{{x :x y :y} :cursor width :width height :height char-attrs :char-attrs :as vt}]
+(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)

        (assoc-in [:cursor :x] 0)
        (update-in [:cursor :y] inc))))

(defn move-cursor-down [{height :height {y :y} :cursor :as vt}]
  (if (= height (inc y))
    (scroll-up vt)
    (update-in vt [:cursor :y] inc)))


(defn execute-sc
  "http://www.vt100.net/docs/vt510-rm/DECSC"
  [{{:keys [x y]} :cursor :keys [char-attrs] :as vt}]
  (assoc vt :saved {:cursor {:x x :y y}
                    :char-attrs char-attrs}))

