int ch; /* char height */
int cw; /* char width */
char state; /* focus, redraw, visible */
int ch; /* char height */
int cw; /* char width */
char state; /* focus, redraw, visible */
term.c = (TCursor){{
.mode = ATTR_NULL,
.fg = DefaultFG,
.bg = DefaultBG
}, .x = 0, .y = 0, .state = CURSOR_DEFAULT};
term.c = (TCursor){{
.mode = ATTR_NULL,
.fg = DefaultFG,
.bg = DefaultBG
}, .x = 0, .y = 0, .state = CURSOR_DEFAULT};
term.top = 0, term.bot = term.row - 1;
term.mode = MODE_WRAP;
tclearregion(0, 0, term.col-1, term.row-1);
term.top = 0, term.bot = term.row - 1;
term.mode = MODE_WRAP;
tclearregion(0, 0, term.col-1, term.row-1);
term.line = malloc(term.row * sizeof(Line));
term.alt = malloc(term.row * sizeof(Line));
term.dirty = malloc(term.row * sizeof(*term.dirty));
term.line = malloc(term.row * sizeof(Line));
term.alt = malloc(term.row * sizeof(Line));
term.dirty = malloc(term.row * sizeof(*term.dirty));
for(row = 0; row < term.row; row++) {
term.line[row] = malloc(term.col * sizeof(Glyph));
term.alt [row] = malloc(term.col * sizeof(Glyph));
term.dirty[row] = 0;
}
for(row = 0; row < term.row; row++) {
term.line[row] = malloc(term.col * sizeof(Glyph));
term.alt [row] = malloc(term.col * sizeof(Glyph));
term.dirty[row] = 0;
}
term.line = realloc(term.line, row * sizeof(Line));
term.alt = realloc(term.alt, row * sizeof(Line));
term.dirty = realloc(term.dirty, row * sizeof(*term.dirty));
term.line = realloc(term.line, row * sizeof(Line));
term.alt = realloc(term.alt, row * sizeof(Line));
term.dirty = realloc(term.dirty, row * sizeof(*term.dirty));
/* resize each row to new width, zero-pad if needed */
for(i = 0; i < minrow; i++) {
/* resize each row to new width, zero-pad if needed */
for(i = 0; i < minrow; i++) {
term.line[i] = calloc(col, sizeof(Glyph));
term.alt [i] = calloc(col, sizeof(Glyph));
}
term.line[i] = calloc(col, sizeof(Glyph));
term.alt [i] = calloc(col, sizeof(Glyph));
}
+ if (col > term.col) {
+ bool *bp = term.tabs + term.col;
+
+ memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
+ while (--bp > term.tabs && !*bp)
+ /* nothing */ ;
+ for (bp += TAB; bp < term.tabs + col; bp += TAB)
+ *bp = 1;
+ }
/* update terminal size */
term.col = col, term.row = row;
/* make use of the LIMIT in tmoveto */
/* update terminal size */
term.col = col, term.row = row;
/* make use of the LIMIT in tmoveto */
- xw.bufw = MAX(1, col * xw.cw);
- xw.bufh = MAX(1, row * xw.ch);
+ xw.w = MAX(1, 2*BORDER + col * xw.cw);
+ xw.h = MAX(1, 2*BORDER + row * xw.ch);
xclear(int x1, int y1, int x2, int y2) {
XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE) ? DefaultFG : DefaultBG]);
XFillRectangle(xw.dpy, xw.buf, dc.gc,
xclear(int x1, int y1, int x2, int y2) {
XSetForeground(xw.dpy, dc.gc, dc.col[IS_SET(MODE_REVERSE) ? DefaultFG : DefaultBG]);
XFillRectangle(xw.dpy, xw.buf, dc.gc,
- xw.bufh = term.row * xw.ch;
- xw.bufw = term.col * xw.cw;
- xw.h = xw.bufh + 2*BORDER;
- xw.w = xw.bufw + 2*BORDER;
+ xw.h = 2*BORDER + term.row * xw.ch;
+ xw.w = 2*BORDER + term.col * xw.cw;
void
xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
int fg = base.fg, bg = base.bg, temp;
void
xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
int fg = base.fg, bg = base.bg, temp;