diff --git a/cowterm.c b/cowterm.c index 42e65b2..d534d58 100644 --- a/cowterm.c +++ b/cowterm.c @@ -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;