int i;
int window_height;
int from_row, to_row;
- struct attr *dup_attr;
// scrolling range is inclusive
window_height = terminal->margin_bottom - terminal->margin_top + 1;
terminal_get_attr_row(terminal, from_row - i),
terminal->attr_pitch);
}
- dup_attr = terminal_get_attr_row(terminal, terminal->margin_top);
for (i = terminal->margin_top; i < (terminal->margin_top + d); i++) {
memset(terminal_get_row(terminal, i), 0, terminal->data_pitch);
- if (i > terminal->margin_top) {
- memcpy(terminal_get_attr_row(terminal, i),
- dup_attr, terminal->attr_pitch);
- }
+ attr_init(terminal_get_attr_row(terminal, i),
+ terminal->curr_attr, terminal->width);
}
} else {
to_row = terminal->margin_top;
terminal_get_attr_row(terminal, from_row + i),
terminal->attr_pitch);
}
- dup_attr = terminal_get_attr_row(terminal, terminal->margin_bottom);
for (i = terminal->margin_bottom - d + 1; i <= terminal->margin_bottom; i++) {
memset(terminal_get_row(terminal, i), 0, terminal->data_pitch);
- if (i < terminal->margin_bottom) {
- memcpy(terminal_get_attr_row(terminal, i),
- dup_attr, terminal->attr_pitch);
- }
+ attr_init(terminal_get_attr_row(terminal, i),
+ terminal->curr_attr, terminal->width);
}
}
}
terminal->data_pitch = data_pitch;
terminal->attr_pitch = attr_pitch;
+ terminal->margin_bottom =
+ height - (terminal->height - terminal->margin_bottom);
terminal->width = width;
terminal->height = height;
- if(terminal->margin_bottom >= terminal->height)
- terminal->margin_bottom = terminal->height - 1;
terminal->data = data;
terminal->data_attr = data_attr;
terminal->tab_ruler = tab_ruler;
{
foreground = attr.bg;
background = attr.fg;
+ if (attr.a & ATTRMASK_BOLD) {
+ if (foreground <= 16) foreground |= 0x08;
+ if (background <= 16) background &= 0x07;
+ }
} else {
foreground = attr.fg;
background = attr.bg;
tmp = foreground;
foreground = background;
background = tmp;
+ if (attr.a & ATTRMASK_BOLD) {
+ if (foreground <= 16) foreground |= 0x08;
+ if (background <= 16) background &= 0x07;
+ }
}
bold = attr.a & (ATTRMASK_BOLD | ATTRMASK_BLINK);
underline = attr.a & ATTRMASK_UNDERLINE;
text_x = side_margin + col * extents.max_x_advance;
text_y = top_margin + extents.ascent + row * extents.height;
if (underline) {
- cairo_move_to(cr, text_x, text_y + 2);
- cairo_line_to(cr, text_x + extents.max_x_advance, text_y + 2);
+ cairo_move_to(cr, text_x, (double)text_y + 1.5);
+ cairo_line_to(cr, text_x + extents.max_x_advance, (double) text_y + 1.5);
cairo_stroke(cr);
}
cairo_move_to(cr, text_x, text_y);
break;
case 'c': /* Primary DA */
write(terminal->master, "\e[?6c", 5);
- sleep(1);
break;
case 'd': /* VPA */
x = set[0] ? args[0] : 1;
terminal->column+1);
write(terminal->master, response, strlen(response));
}
- sleep(1); /* is this required? why? */
break;
case 'r':
if(!set[0]) {
terminal->color_scheme = &DEFAULT_COLORS;
terminal_init(terminal);
terminal->margin_top = 0;
- terminal->margin_bottom = 10000; /* much too large, will be trimmed down
- * by terminal_resize */
+ terminal->margin_bottom = -1;
terminal->window = window_create(display, "Wayland Terminal",
500, 400);
pid = forkpty(&master, NULL, NULL, NULL);
if (pid == 0) {
- setenv("TERM", "vt102", 1);
+ setenv("TERM", "xterm-256color", 1);
+ setenv("COLORTERM", "xterm-256color", 1);
if (execl(path, path, NULL)) {
printf("exec failed: %m\n");
exit(EXIT_FAILURE);