Skip to content

Instantly share code, notes, and snippets.

@elw00d
Created February 8, 2014 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elw00d/8890166 to your computer and use it in GitHub Desktop.
Save elw00d/8890166 to your computer and use it in GitHub Desktop.
void
ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
{
if (len != 0) {
TScreen *screen = TScreenOf(xw);
LineData *ld;
unsigned n;
ld = getLineData(screen, row);
// mix flags received as argument with actual flags
// in xw - current attributes set
flags = (int) ((unsigned) flags | TERM_COLOR_FLAGS(xw));
// use spaces for clearing cells
for (n = 0; n < len; ++n)
ld->charData[(unsigned) col + n] = (CharData) ' ';
memset(ld->attribs + col, flags, (size_t) len);
if_OPT_ISO_COLORS(screen, {
CellColor p = xtermColorPair(xw);
for (n = 0; n < len; ++n) {
ld->color[(unsigned) col + n] = p;
}
});
if_OPT_WIDE_CHARS(screen, {
size_t off;
for_each_combData(off, ld) {
memset(ld->combData[off] + col, 0, (size_t) len * sizeof(CharData));
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment