defmodule ElementTui.Experimental do alias ElementTui.Experimental.Parser # Reimplementation of normal render, but using the experimental by default def render(elements, x, y, width, height, opts \\ []) when is_integer(x) and is_integer(y) and is_integer(width) and is_integer(height) do opts = Keyword.merge([clear: true], opts) if opts[:clear] do ElementTui.Tui.clear_region(x, y, width, height) end parsed = elements |> Parser.parse(x, y, width, height) parsed.elements |> Enum.each(fn elem -> ElementTui.Tui.puts(elem.x, elem.y, elem.attr, elem.bg_attr, elem.line) end) %{height: parsed.height, width: parsed.width} end end