simple_write_to_buffer() is complicated

The simple_write_to_buffer() function is complicated and should mostly be avoided.