   end
 
   defp apply_nesting(_, k, :cursor), do: k
+  defp apply_nesting(_, _, :reset), do: 0
   defp apply_nesting(i, _, j), do: i + j
 
   defp ansi(color) do

  If `level` is an integer, that's the indentation appended
  to line breaks whenever they occur. If the level is `:cursor`,
  the current position of the "cursor" in the document becomes
  the nesting.

  `mode` can be `:always`, which means nesting always happen,
  or `:break`, which means nesting only happens inside a group


  def nest(doc, :cursor, mode) when is_doc(doc) and mode in [:always, :break] do
    doc_nest(doc, :cursor, mode)
  end

  def nest(doc, :reset, mode) when is_doc(doc) and mode in [:always, :break] do
    doc_nest(doc, :reset, mode)
  end

  def nest(doc, 0, _mode) when is_doc(doc) do
