# `OpenUI.Edit`
[🔗](https://github.com/ideia4it/openui/blob/v0.1.1/lib/openui/edit.ex#L1)

Incremental editing (language.md, section 7): merges a patch, the changed
statements a model answers with in edit mode, into the current program.

Both texts are read with the parser's own rules for fences, comments and
statement boundaries, so a multi-line ternary is one statement in both. A
patch statement replaces the one with its name in place; a new name is
appended; `name = null` deletes the statement. After merging, statements
`root` cannot reach are removed, unless there is no `root` statement.
State declarations are always kept. Merge only once the patch has finished
streaming: a half-written `root` would remove statements it reaches later.

# `merge`

```elixir
@spec merge(String.t(), String.t()) :: String.t()
```

Merges `patch` into the `current` program text and returns the merged text.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
