Found that termous was not bing reset

This commit is contained in:
2025-05-31 23:02:26 +00:00
parent b6a50cf942
commit 8cef088b61
4 changed files with 102 additions and 73 deletions

View File

@@ -92,22 +92,24 @@ struct tart_cell tart_set_cell(struct tart_buffer* buffer, struct tart_cell cell
tart_byte tart_draw_window(struct tart_window * window, char* rend_buffer) {
int offset = 0;
int i = 0;
int bufferWidth = 0;
for (int b = 0;b < 0xFF; b++) {
if(window->buffers[b].cell_count == 0)
continue;
bufferWidth = window->buffers[b].size.x;
for (int y = 0; y < window->buffers[b].size.y; y++) {
for (int x = 0; x < window->buffers[b].size.x; x++) {
// add data to window c buffer.
struct tart_cell cell = window->buffers[b].cells[(y*window->buffers[b].size.x) + x];
char pre[TART_CELL_DATA_SIZE];
int size = sprintf(pre, "\033[%d;%d;%dm%c\033[0;0m", (int)cell.style, cell.foreground, cell.background, cell.display);
for(int preIdx = 0; preIdx < size; preIdx++) {
window->data[(y*window->buffers[b].size.x) + x + offset] = pre[preIdx];
offset++;
// add data to window c buffer.
struct tart_cell cell = window->buffers[b].cells[(y*window->buffers[b].size.x) + x];
char pre[TART_CELL_DATA_SIZE];
int size = sprintf(pre, "\033[%d;%d;%dm%c\033[0;0m", (int)cell.style, cell.foreground, cell.background, cell.display) - 1;
for(int preIdx = 0; preIdx < size; preIdx++) {
window->data[(y * bufferWidth) + x + offset] = pre[preIdx];
offset++;
}
}
window->data[((y)*window->buffers[b].size.x) + offset + window->buffers[b].size.x] = '\n';
//window->data[((y)*window->buffers[b].size.x) + offset + window->buffers[b].size.x] = '\n';
offset++;