                  (set-bg 3)
                  (move-cursor 1 1))]
       (let [{lines :lines {x :x y :y} :cursor} (feed-csi vt "J")]
-        (is (= lines [[[0x41 {}] [0x42 {}] [0x43 {}] [0x44 {}]]
-                      [[0x45 {}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]
-                      [[0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]]))
+        (is (= (compact-lines lines) [[["ABCD" {}]]
+                                      [["E" {}] ["   " {:bg 3}]]
+                                      [["    " {:bg 3}]]]))
         (is (= x 1))
         (is (= y 1)))
       (let [{lines :lines {x :x y :y} :cursor} (feed-csi vt "1J")]
-        (is (= lines [[[0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]
-                      [[0x20 {:bg 3}] [0x20 {:bg 3}] [0x47 {}] [0x48 {}]]
-                      [[0x49 {}] [0x4a {}] [0x20 {}] [0x20 {}]]]))
+        (is (= (compact-lines lines) [[["    " {:bg 3}]]
+                                      [["  " {:bg 3}] ["GH" {}]]
+                                      [["IJ  " {}]]]))
         (is (= x 1))
         (is (= y 1)))
       (let [{lines :lines {x :x y :y} :cursor} (feed-csi vt "2J")]
-        (is (= lines [[[0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]
-                      [[0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]
-                      [[0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}] [0x20 {:bg 3}]]]))
+        (is (= (compact-lines lines) [[["    " {:bg 3}]]
+                                      [["    " {:bg 3}]]
+                                      [["    " {:bg 3}]]]))
         (is (= x 1))
         (is (= y 1)))))
 

              {:keys [lines] {:keys [x y]} :cursor} vt]
          (is (= x 2))
          (is (= y 1))
          (is (= lines [[[0x41 {}] [0x42 {}] [0x43 {}] [0x20 {}]]
                        [[0x44 {}] [0x45 {}] [0x20 {}] [0x20 {}]]
                        [[0x20 {}] [0x20 {}] [0x20 {}] [0x20 {}]]]))))))

  (testing "CSI ?l (DECRM)" ; reset multiple modes
    (let [vt (make-vt 80 24)]

              {:keys [lines] {:keys [x y]} :cursor} vt]
          (is (= x 2))
          (is (= y 1))
          (is (= (compact-lines lines) [[["ABC " {}]]
                                        [["DE  " {}]]
                                        [["    " {}]]]))))))

  (testing "CSI ?h (DECSM)" ; set multiple modes
    (let [vt (-> (make-vt 80 24)
