     (if (< i (count items))
       (let [item (nth items i)]
         (render-line screen x (+ y i) width (get item :s) (get item :fg) (get item :bg) (get item :style)))
-      (render-line screen x (+ y i) width "" :white :white #{}))))
+      (render-line screen x (+ y i) width " " :white :white #{}))))
 
 (defn render-text
   [screen position title text]

        ;; pad to width
        s        (if center
                   ;; center justify
                   (center-text line width)
                   ;; left justify
                   (left-justify-text line width))
        [fg bg]  (if invert
                   [bg fg]
                   [fg bg])

  ([s]
   (str->chars s :white :black))
  ([s fg bg]
   (str->chars s fg bg #{}))
  ([s fg bg style]
   (map (fn [c] {:c c :fg fg :bg bg :style style})
        s)))

(defn markup->chars
  ([x y s]
   (markup->chars x y s :white :black))
  ([x y s fg bg]
   (markup->chars x y s fg bg #{}))
  ([x y s fg bg style]
   (if (re-find #"^\s*$" s)
     (map (fn [idx] {:c     " "
                     :x     (+ x idx)
                     :y     y
                     :fg    (color->rgb fg)
                     :bg    (color->rgb bg)
                     :style style})
          (range (count s)))
     (let [body    (str "<body>" s "</body>")
           z       (zip-str body)
           content (-> z zip/node :content)
           characters
       (map-indexed (fn [idx c] (assoc c :c     (str (get c :c))
                                         :x     (+ x idx)
                                         :y     y
                                         :fg    (color->rgb (get c :fg))
                                         :bg    (color->rgb (get c :bg))
                                         :style style))
                    (reduce (fn [characters v]
                              (cond
                                (string? v)
                                  (concat characters
                                          (str->chars v fg bg style))
                                (map? v)
                                  (concat characters
                                          (str->chars (-> v :content first)
                                                      (if (= (get v :tag) :color)
                                                        (keyword (get-in v [:attrs :fg] fg))
                                                        fg)
                                                      (if (= (get v :tag) :color)
                                                        (keyword (get-in v [:attrs :bg] bg))
                                                        bg)))))
                            []
                            content))]
      characters))))

(defn put-string
  ([^robinson.aterminal.ATerminal screen x y string]
