       is_binary(unquote(doc)) or
       unquote(doc) == :doc_nil or
       (is_tuple(unquote(doc)) and
-       elem(unquote(doc), 0) in [:doc_cons, :doc_nest, :doc_break, :doc_group, :doc_color, :doc_line])
+       elem(unquote(doc), 0) in [:doc_cons, :doc_nest, :doc_break, :doc_group,
+                                 :doc_color, :doc_line, :doc_next_fits])
     end
   end
 

    format(width, 0, [{0, :flat, group(doc)}])
  end

  # Record representing the document mode to be rendered
  #
  #   * break - represents a fitted document with breaks as breaks
  #   * flat - represents a fitted document with breaks as flats
  #
  @typep mode :: :break | :flat

  @spec fits?(integer, integer, [{integer, mode, t}]) :: boolean
  defp fits?(_, k, _) when k < 0,                          do: false
  defp fits?(_, _, []),                                    do: true
  defp fits?(w, k, [{_, _, :doc_nil} | t]),                do: fits?(w, k, t)
  defp fits?(_, _, [{_, _, doc_line(:hard)} | _]),         do: false
  defp fits?(w, _, [{i, _, doc_line(:soft)} | t]),         do: fits?(w, w - i, t)
  defp fits?(w, k, [{i, m, doc_cons(x, y)} | t]),          do: fits?(w, k, [{i, m, x} | [{i, m, y} | t]])

  defp format(w, k, [{i, m, doc_cons(x, y)} | t]),      do: format(w, k, [{i, m, x} | [{i, m, y} | t]])
  defp format(w, k, [{i, m, doc_color(x, c)} | t]),     do: [ansi(c) | format(w, k, [{i, m, x} | t])]
  defp format(w, k, [{_, _, s} | t]) when is_binary(s), do: [s | format(w, (k + byte_size(s)), t)]
  defp format(w, k, [{i, m, doc_next_fits(x)} | t]),    do: format(w, k, [{i, m, x} | t])

  # Flex breaks are not conditional to the mode
  defp format(w, k, [{i, _, doc_break(s, :flex)} | t]) do
