static void screen_write(struct tsm_screen *con, unsigned int x, unsigned int y, tsm_symbol_t ch, unsigned int len, const struct tsm_screen_attr *attr) { struct line *line; unsigned int i; if (!len) return; if (x >= con->size_x || y >= con->size_y) { llog_warn(con, "writing beyond buffer boundary"); return; } line = con->lines[y]; if ((con->flags & TSM_SCREEN_INSERT_MODE) && (int)x < ((int)con->size_x - len)) { line->age = con->age_cnt; memmove(&line->cells[x + len], &line->cells[x], sizeof(struct cell) * (con->size_x - len - x)); } line->cells[x].age = con->age_cnt; line->cells[x].ch = ch; line->cells[x].width = len; memcpy(&line->cells[x].attr, attr, sizeof(*attr)); for (i = 1; i < len && i + x < con->size_x; ++i) { line->cells[x + i].age = con->age_cnt; line->cells[x + i].width = 0; } }
static void screen_write(struct tsm_screen *con, unsigned int x, unsigned int y, tsm_symbol_t ch, const struct tsm_screen_attr *attr) { struct line *line; if (x >= con->size_x || y >= con->size_y) { llog_warn(con, "writing beyond buffer boundary"); return; } line = con->lines[y]; if ((con->flags & TSM_SCREEN_INSERT_MODE) && x < (con->size_x - 1)) memmove(&line->cells[x + 1], &line->cells[x], sizeof(struct cell) * (con->size_x - 1 - x)); line->cells[x].ch = ch; memcpy(&line->cells[x].attr, attr, sizeof(*attr)); }