   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

    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]])

    doc_break(string, :strict)
  end

  @doc """
  Annotates that the next break, including lines,
  in the document will mark it as a fit.
  """
  @spec next_break_fits(t) :: doc_next_fits
  def next_break_fits(doc) when is_doc(doc) do
    doc_next_fits(doc)
  end

  @doc """
  Introduces a flex break.

  A flex break still causes a group to break, like
  a regular break, but it is re-evaluated when the
  documented is processed.

  This function is used by `surround/4` and friends
  to the maximum amount of entries on the same line.
  """
  @spec flex_break(binary) :: doc_break
  def flex_break(string \\ " ") when is_binary(string) do
    doc_break(string, :flex)
  end

  @doc """
  Glues two documents (`doc1` and `doc2`) inserting a
  `flex_break/1` given by `break_string` between them.

  This function is used by `surround/4` and friends
  to the maximum amount of entries on the same line.
  """
  @spec flex_glue(t, binary, t) :: t
  def flex_glue(doc1, break_string \\ " ", doc2) when is_binary(break_string) do
    concat(doc1, concat(flex_break(break_string), doc2))
  end

  @doc ~S"""
  Glues two documents (`doc1` and `doc2`) inserting the given
  break `break_string` between them.

  For more information on how the break is inserted, see `break/1`.
