@justinmk and @oni-link what do you think of the new incarnation: https://github.com/aktau/neovim/commit/8ce525ec3506bb75989ddbeb8d18d4cf22bc24be

It basically does one `realloc` and `memcpy` in all cases.

There's one thing that bothered me a little. Vim doesn't seem to apply `maxlen` to the total string in the case of `must_append`. What I mean is that in the `must_append` case, the `expr_line` could grow indefinitely even when `maxlen` is specified. Since I wasn't sure if this was intentional, I kept this behaviour.