Text buffer implementation for a text editor.