fix writeline_color_buffer and add test for it