--- a/docs/Writerside/topics/buffer.h.md Thu Dec 11 23:07:24 2025 +0100 +++ b/docs/Writerside/topics/buffer.h.md Thu Dec 11 23:47:46 2025 +0100 @@ -194,9 +194,12 @@ All the above functions advance the buffer position by the number of bytes written and cause the _size_ of the buffer to grow, if necessary, to contain all written bytes. -On the other hand, `cxBufferTerminate()` writes a zero-byte at the current position, +On the other hand, `cxBufferTerminate()` writes a zero-byte at the current position and shrinks the buffer, effectively creating a zero-terminated string whose size equals the buffer size. +> If you use cxBufferTerminate() on a buffer with the `CX_BUFFER_COPY_ON_EXTEND` flag set, the shrink operation is skipped. +> Using `cxBufferTerminate()` on a buffer with the `CX_BUFFER_COPY_ON_WRITE` flag set, will copy the entire memory just to add the zero-terminator. + The function `cxBufferAppend()` writes the data to the end of the buffer (given by its size) regardless of the current position, and it also does _not_ advance the position.