mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Move the code to set up a padding cell into grid.c.
This commit is contained in:
parent
2a4d4bda2b
commit
4694e9a2b6
@ -45,6 +45,13 @@ grid_view_set_cell(struct grid *gd, u_int px, u_int py,
|
||||
grid_set_cell(gd, grid_view_x(gd, px), grid_view_y(gd, py), gc);
|
||||
}
|
||||
|
||||
/* Set padding. */
|
||||
void
|
||||
grid_view_set_padding(struct grid *gd, u_int px, u_int py)
|
||||
{
|
||||
grid_set_padding(gd, grid_view_x(gd, px), grid_view_y(gd, py));
|
||||
}
|
||||
|
||||
/* Set cells. */
|
||||
void
|
||||
grid_view_set_cells(struct grid *gd, u_int px, u_int py,
|
||||
|
21
grid.c
21
grid.c
@ -40,8 +40,16 @@ const struct grid_cell grid_default_cell = {
|
||||
{ { ' ' }, 0, 1, 1 }, 0, 0, 8, 8, 0
|
||||
};
|
||||
|
||||
/*
|
||||
* Padding grid cell data. Padding cells are the only zero width cell that
|
||||
* appears in the grid - because of this, they are always extended cells.
|
||||
*/
|
||||
static const struct grid_cell grid_padding_cell = {
|
||||
{ { '!' }, 0, 0, 0 }, 0, GRID_FLAG_PADDING, 8, 8, 0
|
||||
};
|
||||
|
||||
/* Cleared grid cell data. */
|
||||
const struct grid_cell grid_cleared_cell = {
|
||||
static const struct grid_cell grid_cleared_cell = {
|
||||
{ { ' ' }, 0, 1, 1 }, 0, GRID_FLAG_CLEARED, 8, 8, 0
|
||||
};
|
||||
static const struct grid_cell_entry grid_cleared_entry = {
|
||||
@ -524,7 +532,7 @@ grid_get_cell(struct grid *gd, u_int px, u_int py, struct grid_cell *gc)
|
||||
grid_get_cell1(&gd->linedata[py], px, gc);
|
||||
}
|
||||
|
||||
/* Set cell at relative position. */
|
||||
/* Set cell at position. */
|
||||
void
|
||||
grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
||||
{
|
||||
@ -547,7 +555,14 @@ grid_set_cell(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
|
||||
grid_store_cell(gce, gc, gc->data.data[0]);
|
||||
}
|
||||
|
||||
/* Set cells at relative position. */
|
||||
/* Set padding at position. */
|
||||
void
|
||||
grid_set_padding(struct grid *gd, u_int px, u_int py)
|
||||
{
|
||||
grid_set_cell(gd, px, py, &grid_padding_cell);
|
||||
}
|
||||
|
||||
/* Set cells at position. */
|
||||
void
|
||||
grid_set_cells(struct grid *gd, u_int px, u_int py, const struct grid_cell *gc,
|
||||
const char *s, size_t slen)
|
||||
|
@ -38,10 +38,6 @@ static int screen_write_overwrite(struct screen_write_ctx *,
|
||||
static const struct grid_cell *screen_write_combine(struct screen_write_ctx *,
|
||||
const struct utf8_data *, u_int *);
|
||||
|
||||
static const struct grid_cell screen_write_pad_cell = {
|
||||
{ { 0 }, 0, 0, 0 }, 0, GRID_FLAG_PADDING, 8, 8, 0
|
||||
};
|
||||
|
||||
struct screen_write_collect_item {
|
||||
u_int x;
|
||||
int wrapped;
|
||||
@ -1774,7 +1770,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||
*/
|
||||
for (xx = s->cx + 1; xx < s->cx + width; xx++) {
|
||||
log_debug("%s: new padding at %u,%u", __func__, xx, s->cy);
|
||||
grid_view_set_cell(gd, xx, s->cy, &screen_write_pad_cell);
|
||||
grid_view_set_padding(gd, xx, s->cy);
|
||||
skip = 0;
|
||||
}
|
||||
|
||||
|
2
tmux.h
2
tmux.h
@ -2499,6 +2499,7 @@ void grid_clear_history(struct grid *);
|
||||
const struct grid_line *grid_peek_line(struct grid *, u_int);
|
||||
void grid_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
||||
void grid_set_cell(struct grid *, u_int, u_int, const struct grid_cell *);
|
||||
void grid_set_padding(struct grid *, u_int, u_int);
|
||||
void grid_set_cells(struct grid *, u_int, u_int, const struct grid_cell *,
|
||||
const char *, size_t);
|
||||
struct grid_line *grid_get_line(struct grid *, u_int);
|
||||
@ -2520,6 +2521,7 @@ u_int grid_line_length(struct grid *, u_int);
|
||||
void grid_view_get_cell(struct grid *, u_int, u_int, struct grid_cell *);
|
||||
void grid_view_set_cell(struct grid *, u_int, u_int,
|
||||
const struct grid_cell *);
|
||||
void grid_view_set_padding(struct grid *, u_int, u_int);
|
||||
void grid_view_set_cells(struct grid *, u_int, u_int,
|
||||
const struct grid_cell *, const char *, size_t);
|
||||
void grid_view_clear_history(struct grid *, u_int);
|
||||
|
9
tty.c
9
tty.c
@ -1380,9 +1380,10 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
screen_select_cell(s, &last, gcp);
|
||||
else
|
||||
memcpy(&last, gcp, sizeof last);
|
||||
if (!tty_check_overlay(tty, atx + ux, aty))
|
||||
ux += gcp->data.width;
|
||||
else if (ux + gcp->data.width > nx) {
|
||||
if (!tty_check_overlay(tty, atx + ux, aty)) {
|
||||
if (~gcp->flags & GRID_FLAG_PADDING)
|
||||
ux += gcp->data.width;
|
||||
} else if (ux + gcp->data.width > nx) {
|
||||
tty_attributes(tty, &last, defaults, palette);
|
||||
tty_cursor(tty, atx + ux, aty);
|
||||
for (j = 0; j < gcp->data.width; j++) {
|
||||
@ -1397,7 +1398,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
||||
for (j = 0; j < gcp->data.size; j++)
|
||||
tty_putc(tty, gcp->data.data[j]);
|
||||
ux += gcp->data.width;
|
||||
} else {
|
||||
} else if (~gcp->flags & GRID_FLAG_PADDING) {
|
||||
memcpy(buf + len, gcp->data.data, gcp->data.size);
|
||||
len += gcp->data.size;
|
||||
width += gcp->data.width;
|
||||
|
Loading…
Reference in New Issue
Block a user