mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Add a helper to store a cell, and some tidying.
This commit is contained in:
parent
96b66f8fc3
commit
ac1f294bb9
38
grid.c
38
grid.c
@ -59,6 +59,25 @@ static size_t grid_string_cells_bg(const struct grid_cell *, int *);
|
||||
static void grid_string_cells_code(const struct grid_cell *,
|
||||
const struct grid_cell *, char *, size_t, int);
|
||||
|
||||
/* Store cell in entry. */
|
||||
static void
|
||||
grid_store_cell(struct grid_cell_entry *gce, const struct grid_cell *gc,
|
||||
u_char c)
|
||||
{
|
||||
gce->flags = gc->flags;
|
||||
|
||||
gce->data.fg = gc->fg & 0xff;
|
||||
if (gc->fg & COLOUR_FLAG_256)
|
||||
gce->flags |= GRID_FLAG_FG256;
|
||||
|
||||
gce->data.bg = gc->bg & 0xff;
|
||||
if (gc->bg & COLOUR_FLAG_256)
|
||||
gce->flags |= GRID_FLAG_BG256;
|
||||
|
||||
gce->data.attr = gc->attr;
|
||||
gce->data.data = c;
|
||||
}
|
||||
|
||||
/* Set cell as extended. */
|
||||
static struct grid_cell *
|
||||
grid_extended_cell(struct grid_line *gl, struct grid_cell_entry *gce,
|
||||
@ -371,11 +390,10 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
||||
grid_expand_line(gd, py, px + 1, 8);
|
||||
|
||||
gl = &gd->linedata[py];
|
||||
gce = &gl->celldata[px];
|
||||
|
||||
if (px + 1 > gl->cellused)
|
||||
gl->cellused = px + 1;
|
||||
|
||||
gce = &gl->celldata[px];
|
||||
extended = (gce->flags & GRID_FLAG_EXTENDED);
|
||||
if (!extended && (gc->data.size != 1 || gc->data.width != 1))
|
||||
extended = 1;
|
||||
@ -383,20 +401,10 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
||||
extended = 1;
|
||||
if (!extended && (gc->bg & COLOUR_FLAG_RGB))
|
||||
extended = 1;
|
||||
if (extended) {
|
||||
if (extended)
|
||||
grid_extended_cell(gl, gce, gc);
|
||||
return;
|
||||
}
|
||||
|
||||
gce->flags = gc->flags;
|
||||
gce->data.attr = gc->attr;
|
||||
gce->data.fg = gc->fg & 0xff;
|
||||
if (gc->fg & COLOUR_FLAG_256)
|
||||
gce->flags |= GRID_FLAG_FG256;
|
||||
gce->data.bg = gc->bg & 0xff;
|
||||
if (gc->bg & COLOUR_FLAG_256)
|
||||
gce->flags |= GRID_FLAG_BG256;
|
||||
gce->data.data = gc->data.data[0];
|
||||
else
|
||||
grid_store_cell(gce, gc, gc->data.data[0]);
|
||||
}
|
||||
|
||||
/* Clear area. */
|
||||
|
@ -423,6 +423,9 @@ screen_redraw_pane(struct client *c, struct window_pane *wp)
|
||||
if (status_at_line(c) == 0)
|
||||
yoff++;
|
||||
|
||||
log_debug("%s: redraw pane %%%u (at %u,%u)", c->tty.path, wp->id,
|
||||
wp->xoff, yoff);
|
||||
|
||||
for (i = 0; i < wp->sy; i++)
|
||||
tty_draw_pane(&c->tty, wp, i, wp->xoff, yoff);
|
||||
tty_reset(&c->tty);
|
||||
|
Loading…
Reference in New Issue
Block a user