                   (update :lines pop) ;; to restore the version of the line _with_ its trailing delims
                   (update :lines into (safe-subvec (:lines prev-state) last-i))
                   (update :postline-states into (safe-subvec (:postline-states prev-state) (inc last-i)))
+                  (update :postindent-states into (safe-subvec (:postindent-states prev-state) (inc last-i)))
                   (merge (last (:postline-states prev-state))))
         state (-> state
                   (assoc :line-no (dec (count (:lines state))))

(def initial-state
  "An initial state of our running state."
  {:lines []                           ;; final lines containing the inferenced closing delimiters.
   :postline-states []
   :line-no -1                         ;; current line number we are processing.
   :track-indent? false                ;; "true" when we are looking for the first char on a line to signify indentation.
   :delim-trail {:start nil :end nil}  ;; track EOL delims since we replace them wholesale with inferred delims.
   :insert {:line-dy nil :x-pos nil}   ;; the place to insert closing delimiters whenever we hit appropriate indentation.
   :stack []                           ;; the delimiter stack, maps of [:x-pos :ch :indent-delta]
   :backup []})                          ;; trailing delims that are pushed back onto the stack at EOL


  'reduced' will halt further processing."
  [prev-state state [old-i line cache]]
  (let [state (process-line state line)
        new-cache (last (:postindent-states state))
        more? (< (inc old-i) (count (:lines prev-state)))
        can-skip? (and new-cache (= new-cache cache))]
    (if (and can-skip? more?)
      (reduced (fill-rest-with-cache prev-state state old-i))
      state)))
