fixed weird characters

backspacing is now not broken!
This commit is contained in:
cowmonk 2025-01-21 13:56:25 -07:00
parent 7e11c02405
commit a044864f92

View File

@ -1070,6 +1070,10 @@ static int master_cb(int fd, void *data, Window window) {
case '\b':
if (cursor_x > 0) {
cursor_x--;
terminal_buffer[cursor_y][cursor_x] = ' ';
color_buffer[cursor_y][cursor_x] = current_color;
attr_buffer[cursor_y][cursor_x] = current_attr;
bg_color_buffer[cursor_y][cursor_x] = current_bg_color;
needs_refresh = 1;
} else if (cursor_y > 0) {
cursor_y--;
@ -1082,16 +1086,18 @@ static int master_cb(int fd, void *data, Window window) {
default:
if (cursor_y >= term_rows || cursor_x >= term_cols)
break;
terminal_buffer[cursor_y][cursor_x] = buf[i];
color_buffer[cursor_y][cursor_x] = current_color;
attr_buffer[cursor_y][cursor_x] = current_attr;
bg_color_buffer[cursor_y][cursor_x] = current_bg_color;
needs_refresh = 1;
if (++cursor_x >= term_cols) {
cursor_x = 0;
if (++cursor_y >= term_rows) {
scroll_region_up(1);
cursor_y = term_rows - 1;
if (buf[i] >= 32 && buf[i] <= 126) {
terminal_buffer[cursor_y][cursor_x] = buf[i];
color_buffer[cursor_y][cursor_x] = current_color;
attr_buffer[cursor_y][cursor_x] = current_attr;
bg_color_buffer[cursor_y][cursor_x] = current_bg_color;
needs_refresh = 1;
if (++cursor_x >= term_cols) {
cursor_x = 0;
if (++cursor_y >= term_rows) {
scroll_region_up(1);
cursor_y = term_rows - 1;
}
}
}
break;