Added support for replacing lines in buffers.