Commit graph

5 commits

Author SHA1 Message Date
Bill Currie
3eceb444d3 [console] Add test for buffer line tracking
Seems to work, so I guess con_buffer is ok now.
2022-09-18 16:07:22 +09:00
Bill Currie
48e5848a41 [console] Rework con_buffer ring buffers to have gaps
I really don't know why I tried to do ring-buffers without gaps, the
code complication is just not worth the tiny savings in memory. In fact,
just the switch from pointers to 32-bit offsets saves more memory than
not having gaps (on 64-bit systems, no change on 32-bit).
2022-09-18 11:35:09 +09:00
Bill Currie
5e8d18a774 [console] Add failing test for adding to full 1-line buffer
I've decided that appending to a full single-line buffer should simply
scroll through the existing text. Unsurprisingly, the existing code
doesn't handle the situation all that well. While I've already got a fix
for it, I think I've got a better idea that will handle full buffers
more gracefully.
2022-09-17 15:31:52 +09:00
Bill Currie
9a92496662 [console] Don't overwrite tail line if same as current line
This fixes the current line object getting corrupted by the tail line
update when the buffer is filled with a single line. There are probably
more tests to write and bugs to fix :)
2022-09-17 13:56:23 +09:00
Bill Currie
d13df6cd37 [console] Add failing unit test for con_buffer
I was looking through the code for Con_BufferAddText trying to figure
out what it was doing (answer: ring buffer for both text and lines) and
got suspicious about its handling of the line objects. I decided an
automated test was in order. It turns out I was right: filling the
buffer with a single long line causes the tail line to trample the
current line, setting its pointer and length to 0 when the final
character is put in the buffer.
2022-09-17 12:59:36 +09:00