mirror of
https://github.com/tmux/tmux.git
synced 2026-04-01 01:26:28 +00:00
Change overlay_ranges into visible_ranges.
This commit is contained in:
10
menu.c
10
menu.c
@@ -181,17 +181,15 @@ menu_mode_cb(__unused struct client *c, void *data, u_int *cx, u_int *cy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return parts of the input range which are not obstructed by the menu. */
|
/* Return parts of the input range which are not obstructed by the menu. */
|
||||||
struct visible_ranges *
|
void
|
||||||
menu_check_cb(__unused struct client *c, void *data, u_int px, u_int py,
|
menu_check_cb(__unused struct client *c, void *data, u_int px, u_int py,
|
||||||
u_int nx)
|
u_int nx, struct visible_ranges *r)
|
||||||
{
|
{
|
||||||
struct menu_data *md = data;
|
struct menu_data *md = data;
|
||||||
struct menu *menu = md->menu;
|
struct menu *menu = md->menu;
|
||||||
struct visible_ranges *r;
|
|
||||||
|
|
||||||
r = server_client_overlay_range(md->px, md->py, menu->width + 4,
|
server_client_overlay_range(md->px, md->py, menu->width + 4,
|
||||||
menu->count + 2, px, py, nx);
|
menu->count + 2, px, py, nx, r);
|
||||||
return (r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
37
popup.c
37
popup.c
@@ -164,19 +164,27 @@ popup_mode_cb(__unused struct client *c, void *data, u_int *cx, u_int *cy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Return parts of the input range which are not obstructed by the popup. */
|
/* Return parts of the input range which are not obstructed by the popup. */
|
||||||
static struct visible_ranges *
|
static void
|
||||||
popup_check_cb(struct client* c, void *data, u_int px, u_int py, u_int nx)
|
popup_check_cb(struct client* c, void *data, u_int px, u_int py, u_int nx,
|
||||||
|
struct visible_ranges *r)
|
||||||
{
|
{
|
||||||
struct popup_data *pd = data;
|
struct popup_data *pd = data;
|
||||||
struct visible_ranges *or[2], *r;
|
static struct visible_ranges or[2] = { { NULL, 0, 0 }, { NULL, 0, 0 } };
|
||||||
u_int i, j, k = 0;
|
u_int i, j, k = 0;
|
||||||
|
|
||||||
if (pd->md != NULL) {
|
if (pd->md != NULL) {
|
||||||
/* Check each returned range for the menu against the popup. */
|
/* Check each returned range for the menu against the popup. */
|
||||||
r = menu_check_cb(c, pd->md, px, py, nx);
|
menu_check_cb(c, pd->md, px, py, nx, r);
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r->used; i++) {
|
||||||
or[i] = server_client_overlay_range(pd->px, pd->py, pd->sx,
|
server_client_overlay_range(pd->px, pd->py, pd->sx,
|
||||||
pd->sy, r->px[i], py, r->nx[i]);
|
pd->sy, r->ranges[i].px, py, r->ranges[i].nx, &or[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Caller must free when no longer used. */
|
||||||
|
if (r->size == 0) {
|
||||||
|
r->ranges = xcalloc(2, sizeof(struct visible_range));
|
||||||
|
r->size = 2;
|
||||||
|
r->used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -185,20 +193,21 @@ popup_check_cb(struct client* c, void *data, u_int px, u_int py, u_int nx)
|
|||||||
*/
|
*/
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r->used; i++) {
|
||||||
/* Each or[i] only has up to 2 ranges. */
|
/* Each or[i] only has up to 2 ranges. */
|
||||||
for (j = 0; j < or[i]->used; j++) {
|
for (j = 0; j < or[i].used; j++) {
|
||||||
if (or[i]->nx[j] > 0) {
|
if (or[i].ranges[j].nx > 0) {
|
||||||
r->px[k] = or[i]->px[j];
|
r->ranges[k].px = or[i].ranges[j].px;
|
||||||
r->nx[k] = or[i]->nx[j];
|
r->ranges[k].nx = or[i].ranges[j].nx;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
return (r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (server_client_overlay_range(pd->px, pd->py, pd->sx, pd->sy, px, py,
|
server_client_overlay_range(pd->px, pd->py, pd->sx, pd->sy,
|
||||||
nx));
|
px, py, nx, r);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -817,13 +817,14 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j)
|
|||||||
struct window_pane *wp, *active = server_client_get_pane(c);
|
struct window_pane *wp, *active = server_client_get_pane(c);
|
||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
const struct grid_cell *tmp;
|
const struct grid_cell *tmp;
|
||||||
struct visible_ranges *r;
|
static struct visible_ranges r = { NULL, 0, 0 };
|
||||||
u_int cell_type, x = ctx->ox + i, y = ctx->oy + j;
|
u_int cell_type;
|
||||||
|
u_int x = ctx->ox + i, y = ctx->oy + j;
|
||||||
int isolates;
|
int isolates;
|
||||||
|
|
||||||
if (c->overlay_check != NULL) {
|
if (c->overlay_check != NULL) {
|
||||||
r = c->overlay_check(c, c->overlay_data, x, y, 1);
|
c->overlay_check(c, c->overlay_data, x, y, 1, &r);
|
||||||
if (r->nx[0] + r->nx[1] == 0)
|
if (r.ranges[0].nx + r.ranges[1].nx == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -943,7 +944,7 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
struct screen *s = wp->screen;
|
struct screen *s = wp->screen;
|
||||||
struct colour_palette *palette = &wp->palette;
|
struct colour_palette *palette = &wp->palette;
|
||||||
struct grid_cell defaults;
|
struct grid_cell defaults;
|
||||||
struct visible_ranges *vr;
|
static struct visible_ranges vr;
|
||||||
u_int i, j, top, x, y, px, width, r;
|
u_int i, j, top, x, y, px, width, r;
|
||||||
|
|
||||||
if (wp->base.mode & MODE_SYNC)
|
if (wp->base.mode & MODE_SYNC)
|
||||||
@@ -989,21 +990,21 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
__func__, c->name, wp->id, i, j, x, y, width);
|
__func__, c->name, wp->id, i, j, x, y, width);
|
||||||
|
|
||||||
/* xxxx Breaking up the tty_draw_line like this isn't fully working. */
|
/* xxxx Breaking up the tty_draw_line like this isn't fully working. */
|
||||||
vr = tty_check_overlay_range(tty, x, y, width);
|
tty_check_overlay_range(tty, x, y, width, &vr);
|
||||||
|
|
||||||
tty_default_colours(&defaults, wp);
|
tty_default_colours(&defaults, wp);
|
||||||
|
|
||||||
for (r=0; r < vr->used; r++) {
|
for (r=0; r < vr.used; r++) {
|
||||||
if (vr->nx[r] == 0)
|
if (vr.ranges[r].nx == 0)
|
||||||
continue;
|
continue;
|
||||||
/* Convert window coordinates to tty coordinates. */
|
/* Convert window coordinates to tty coordinates. */
|
||||||
px = vr->px[r];
|
px = vr.ranges[r].px;
|
||||||
/* i is px of cell, add px of region, sub the
|
/* i is px of cell, add px of region, sub the
|
||||||
* pane offset. If you don't sub offset,
|
* pane offset. If you don't sub offset,
|
||||||
* contents of pane shifted. note: i apparently unnec.
|
* contents of pane shifted. note: i apparently unnec.
|
||||||
*/
|
*/
|
||||||
tty_draw_line(tty, s, /* i + */ vr->px[r] - wp->xoff, j,
|
tty_draw_line(tty, s, /* i + */ vr.ranges[r].px - wp->xoff, j,
|
||||||
vr->nx[r], px, y, &defaults, palette);
|
vr.ranges[r].nx, px, y, &defaults, palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,37 +165,36 @@ server_client_clear_overlay(struct client *c)
|
|||||||
* Given overlay position and dimensions, return parts of the input range which
|
* Given overlay position and dimensions, return parts of the input range which
|
||||||
* are visible.
|
* are visible.
|
||||||
*/
|
*/
|
||||||
struct visible_ranges *
|
void
|
||||||
server_client_overlay_range(u_int x, u_int y, u_int sx, u_int sy, u_int px,
|
server_client_overlay_range(u_int x, u_int y, u_int sx, u_int sy, u_int px,
|
||||||
u_int py, u_int nx)
|
u_int py, u_int nx, struct visible_ranges *r)
|
||||||
{
|
{
|
||||||
u_int ox, onx;
|
u_int ox, onx;
|
||||||
static struct visible_ranges r = {NULL, NULL, 0, 0};
|
|
||||||
|
|
||||||
/* For efficiency vr is static and space reused. */
|
/* Caller must free when no longer used. */
|
||||||
if (r.size == 0) {
|
if (r->size == 0) {
|
||||||
r.px = xcalloc(2, sizeof(u_int));
|
r->ranges = xcalloc(2, sizeof(struct visible_range));
|
||||||
r.nx = xcalloc(2, sizeof(u_int));
|
r->size = 2;
|
||||||
r.size = 2;
|
r->used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trivial case of no overlap in the y direction. */
|
/* Trivial case of no overlap in the y direction. */
|
||||||
if (py < y || py > y + sy - 1) {
|
if (py < y || py > y + sy - 1) {
|
||||||
r.px[0] = px;
|
r->ranges[0].px = px;
|
||||||
r.nx[0] = nx;
|
r->ranges[0].nx = nx;
|
||||||
r.used = 1;
|
r->used = 1;
|
||||||
return (&r);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Visible bit to the left of the popup. */
|
/* Visible bit to the left of the popup. */
|
||||||
if (px < x) {
|
if (px < x) {
|
||||||
r.px[0] = px;
|
r->ranges[0].px = px;
|
||||||
r.nx[0] = x - px;
|
r->ranges[0].nx = x - px;
|
||||||
if (r.nx[0] > nx)
|
if (r->ranges[0].nx > nx)
|
||||||
r.nx[0] = nx;
|
r->ranges[0].nx = nx;
|
||||||
} else {
|
} else {
|
||||||
r.px[0] = 0;
|
r->ranges[0].px = 0;
|
||||||
r.nx[0] = 0;
|
r->ranges[0].nx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Visible bit to the right of the popup. */
|
/* Visible bit to the right of the popup. */
|
||||||
@@ -204,14 +203,13 @@ server_client_overlay_range(u_int x, u_int y, u_int sx, u_int sy, u_int px,
|
|||||||
ox = px;
|
ox = px;
|
||||||
onx = px + nx;
|
onx = px + nx;
|
||||||
if (onx > ox) {
|
if (onx > ox) {
|
||||||
r.px[1] = ox;
|
r->ranges[1].px = ox;
|
||||||
r.nx[1] = onx - ox;
|
r->ranges[1].nx = onx - ox;
|
||||||
} else {
|
} else {
|
||||||
r.px[1] = 0;
|
r->ranges[1].px = 0;
|
||||||
r.nx[1] = 0;
|
r->ranges[1].nx = 0;
|
||||||
}
|
}
|
||||||
r.used = 2;
|
r->used = 2;
|
||||||
return (&r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this client is inside this server. */
|
/* Check if this client is inside this server. */
|
||||||
|
|||||||
33
tmux.h
33
tmux.h
@@ -1915,26 +1915,24 @@ struct client_window {
|
|||||||
};
|
};
|
||||||
RB_HEAD(client_windows, client_window);
|
RB_HEAD(client_windows, client_window);
|
||||||
|
|
||||||
/* Visible areas not obstructed by overlays. */
|
/* Visible range array element. */
|
||||||
#define OVERLAY_MAX_RANGES 3
|
struct visible_range {
|
||||||
struct overlay_ranges {
|
u_int px; /* Start */
|
||||||
u_int px[OVERLAY_MAX_RANGES];
|
u_int nx; /* Length */
|
||||||
u_int nx[OVERLAY_MAX_RANGES];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Visible range array element. */
|
/* Visible areas not obstructed. */
|
||||||
struct visible_ranges {
|
struct visible_ranges {
|
||||||
u_int *px; /* Start */
|
struct visible_range *ranges; /* dynamically allocated array */
|
||||||
u_int *nx; /* Length */
|
size_t used; /* number of entries in ranges */
|
||||||
size_t used;
|
size_t size; /* allocated capacity of ranges */
|
||||||
size_t size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Client connection. */
|
/* Client connection. */
|
||||||
typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
|
typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
|
||||||
typedef void (*prompt_free_cb)(void *);
|
typedef void (*prompt_free_cb)(void *);
|
||||||
typedef struct visible_ranges *(*overlay_check_cb)(struct client*, void *,
|
typedef void (*overlay_check_cb)(struct client*, void *, u_int, u_int, u_int,
|
||||||
u_int, u_int, u_int);
|
struct visible_ranges *);
|
||||||
typedef struct screen *(*overlay_mode_cb)(struct client *, void *, u_int *,
|
typedef struct screen *(*overlay_mode_cb)(struct client *, void *, u_int *,
|
||||||
u_int *);
|
u_int *);
|
||||||
typedef void (*overlay_draw_cb)(struct client *, void *,
|
typedef void (*overlay_draw_cb)(struct client *, void *,
|
||||||
@@ -2561,8 +2559,8 @@ void tty_default_attributes(struct tty *, const struct grid_cell *,
|
|||||||
void tty_update_mode(struct tty *, int, struct screen *);
|
void tty_update_mode(struct tty *, int, struct screen *);
|
||||||
const struct grid_cell *tty_check_codeset(struct tty *,
|
const struct grid_cell *tty_check_codeset(struct tty *,
|
||||||
const struct grid_cell *);
|
const struct grid_cell *);
|
||||||
struct visible_ranges *tty_check_overlay_range(struct tty *, u_int, u_int,
|
void tty_check_overlay_range(struct tty *, u_int, u_int, u_int,
|
||||||
u_int);
|
struct visible_ranges *);
|
||||||
|
|
||||||
/* tty-draw.c */
|
/* tty-draw.c */
|
||||||
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
|
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
|
||||||
@@ -2922,8 +2920,8 @@ void server_client_set_overlay(struct client *, u_int, overlay_check_cb,
|
|||||||
overlay_mode_cb, overlay_draw_cb, overlay_key_cb,
|
overlay_mode_cb, overlay_draw_cb, overlay_key_cb,
|
||||||
overlay_free_cb, overlay_resize_cb, void *);
|
overlay_free_cb, overlay_resize_cb, void *);
|
||||||
void server_client_clear_overlay(struct client *);
|
void server_client_clear_overlay(struct client *);
|
||||||
struct visible_ranges *server_client_overlay_range(u_int, u_int, u_int, u_int, u_int, u_int,
|
void server_client_overlay_range(u_int, u_int, u_int, u_int, u_int, u_int,
|
||||||
u_int);
|
u_int, struct visible_ranges *);
|
||||||
void server_client_set_key_table(struct client *, const char *);
|
void server_client_set_key_table(struct client *, const char *);
|
||||||
const char *server_client_get_key_table(struct client *);
|
const char *server_client_get_key_table(struct client *);
|
||||||
int server_client_check_nested(struct client *);
|
int server_client_check_nested(struct client *);
|
||||||
@@ -3625,7 +3623,8 @@ int menu_display(struct menu *, int, int, struct cmdq_item *,
|
|||||||
const char *, const char *, struct cmd_find_state *,
|
const char *, const char *, struct cmd_find_state *,
|
||||||
menu_choice_cb, void *);
|
menu_choice_cb, void *);
|
||||||
struct screen *menu_mode_cb(struct client *, void *, u_int *, u_int *);
|
struct screen *menu_mode_cb(struct client *, void *, u_int *, u_int *);
|
||||||
struct visible_ranges *menu_check_cb(struct client *, void *, u_int, u_int, u_int);
|
void menu_check_cb(struct client *, void *, u_int, u_int, u_int,
|
||||||
|
struct visible_ranges *);
|
||||||
void menu_draw_cb(struct client *, void *,
|
void menu_draw_cb(struct client *, void *,
|
||||||
struct screen_redraw_ctx *);
|
struct screen_redraw_ctx *);
|
||||||
void menu_free_cb(struct client *, void *);
|
void menu_free_cb(struct client *, void *);
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
|
|||||||
struct colour_palette *palette)
|
struct colour_palette *palette)
|
||||||
{
|
{
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
struct grid_cell gc, *gcp, ngc, last;
|
const struct grid_cell *gcp;
|
||||||
|
struct grid_cell gc, ngc, last;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
u_int i, j, last_i, cx, ex, width;
|
u_int i, j, last_i, cx, ex, width;
|
||||||
u_int cellsize, bg;
|
u_int cellsize, bg;
|
||||||
|
|||||||
70
tty.c
70
tty.c
@@ -66,7 +66,8 @@ static void tty_emulate_repeat(struct tty *, enum tty_code_code,
|
|||||||
enum tty_code_code, u_int);
|
enum tty_code_code, u_int);
|
||||||
static void tty_draw_pane(struct tty *, const struct tty_ctx *, u_int);
|
static void tty_draw_pane(struct tty *, const struct tty_ctx *, u_int);
|
||||||
static int tty_check_overlay(struct tty *, u_int, u_int);
|
static int tty_check_overlay(struct tty *, u_int, u_int);
|
||||||
struct visible_ranges *tty_check_overlay_range(struct tty *, u_int, u_int, u_int);
|
void tty_check_overlay_range(struct tty *, u_int, u_int, u_int,
|
||||||
|
struct visible_ranges *);
|
||||||
|
|
||||||
#ifdef ENABLE_SIXEL
|
#ifdef ENABLE_SIXEL
|
||||||
static void tty_write_one(void (*)(struct tty *, const struct tty_ctx *),
|
static void tty_write_one(void (*)(struct tty *, const struct tty_ctx *),
|
||||||
@@ -1160,8 +1161,6 @@ tty_clear_line(struct tty *tty, const struct grid_cell *defaults, u_int py,
|
|||||||
u_int px, u_int nx, u_int bg)
|
u_int px, u_int nx, u_int bg)
|
||||||
{
|
{
|
||||||
struct client *c = tty->client;
|
struct client *c = tty->client;
|
||||||
struct visible_ranges *r;
|
|
||||||
u_int i;
|
|
||||||
|
|
||||||
log_debug("%s: %s, %u at %u,%u", __func__, c->name, nx, px, py);
|
log_debug("%s: %s, %u at %u,%u", __func__, c->name, nx, px, py);
|
||||||
|
|
||||||
@@ -1199,15 +1198,6 @@ tty_clear_line(struct tty *tty, const struct grid_cell *defaults, u_int py,
|
|||||||
*/
|
*/
|
||||||
tty_cursor(tty, px, py);
|
tty_cursor(tty, px, py);
|
||||||
tty_repeat_space(tty, nx);
|
tty_repeat_space(tty, nx);
|
||||||
/*
|
|
||||||
r = tty_check_overlay_range(tty, px, py, nx);
|
|
||||||
for (i = 0; i < r->used; i++) {
|
|
||||||
if (r->nx[i] == 0)
|
|
||||||
continue;
|
|
||||||
tty_cursor(tty, r->px[i], py);
|
|
||||||
tty_repeat_space(tty, r->nx[i]);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear a line, adjusting to visible part of pane. */
|
/* Clear a line, adjusting to visible part of pane. */
|
||||||
@@ -1442,41 +1432,45 @@ tty_cell_width(const struct grid_cell *gcp, u_int atcol)
|
|||||||
static int
|
static int
|
||||||
tty_check_overlay(struct tty *tty, u_int px, u_int py)
|
tty_check_overlay(struct tty *tty, u_int px, u_int py)
|
||||||
{
|
{
|
||||||
struct visible_ranges *r;
|
static struct visible_ranges r = { NULL, 0, 0 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A unit width range will always return nx[2] == 0 from a check, even
|
* A unit width range will always return nx[2] == 0 from a check, even
|
||||||
* with multiple overlays, so it's sufficient to check just the first
|
* with multiple overlays, so it's sufficient to check just the first
|
||||||
* two entries.
|
* two entries.
|
||||||
*/
|
*/
|
||||||
r = tty_check_overlay_range(tty, px, py, 1);
|
if (r.size == 0) {
|
||||||
if (r->nx[0] + r->nx[1] == 0)
|
r.ranges = xcalloc(2, sizeof(struct visible_range));
|
||||||
|
r.size = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
tty_check_overlay_range(tty, px, py, 1, &r);
|
||||||
|
if (r.ranges[0].nx + r.ranges[1].nx == 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return parts of the input range which are visible. */
|
/* Return parts of the input range which are visible. */
|
||||||
struct visible_ranges *
|
void
|
||||||
tty_check_overlay_range(struct tty *tty, u_int px, u_int py, u_int nx)
|
tty_check_overlay_range(struct tty *tty, u_int px, u_int py, u_int nx,
|
||||||
|
struct visible_ranges *r)
|
||||||
{
|
{
|
||||||
static struct visible_ranges r = {NULL, NULL, 0, 0};
|
|
||||||
struct client *c = tty->client;
|
struct client *c = tty->client;
|
||||||
|
|
||||||
/* For efficiency vr is static and space reused. */
|
if (r->size == 0) {
|
||||||
if (r.size == 0) {
|
r->ranges = xcalloc(2, sizeof(struct visible_range));
|
||||||
r.px = xcalloc(1, sizeof(u_int));
|
r->size = 2;
|
||||||
r.nx = xcalloc(1, sizeof(u_int));
|
|
||||||
r.size = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->overlay_check == NULL) {
|
if (c->overlay_check == NULL) {
|
||||||
r.px[0] = px;
|
r->ranges[0].px = px;
|
||||||
r.nx[0] = nx;
|
r->ranges[0].nx = nx;
|
||||||
r.used = 1;
|
r->used = 1;
|
||||||
return (&r);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (c->overlay_check(c, c->overlay_data, px, py, nx));
|
c->overlay_check(c, c->overlay_data, px, py, nx, r);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_SIXEL
|
#ifdef ENABLE_SIXEL
|
||||||
@@ -2004,7 +1998,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
{
|
{
|
||||||
const struct grid_cell *gcp = ctx->cell;
|
const struct grid_cell *gcp = ctx->cell;
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct visible_ranges *r;
|
static struct visible_ranges r = { NULL, 0, 0 };
|
||||||
u_int px, py, i, vis = 0;
|
u_int px, py, i, vis = 0;
|
||||||
|
|
||||||
px = ctx->xoff + ctx->ocx - ctx->wox;
|
px = ctx->xoff + ctx->ocx - ctx->wox;
|
||||||
@@ -2021,9 +2015,9 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
|
|
||||||
/* Handle partially obstructed wide characters. */
|
/* Handle partially obstructed wide characters. */
|
||||||
if (gcp->data.width > 1) {
|
if (gcp->data.width > 1) {
|
||||||
r = tty_check_overlay_range(tty, px, py, gcp->data.width);
|
tty_check_overlay_range(tty, px, py, gcp->data.width, &r);
|
||||||
for (i = 0; i < r->used; i++)
|
for (i = 0; i < r.used; i++)
|
||||||
vis += r->nx[i];
|
vis += r.ranges[i].nx;
|
||||||
if (vis < gcp->data.width) {
|
if (vis < gcp->data.width) {
|
||||||
tty_draw_line(tty, s, s->cx, s->cy, gcp->data.width,
|
tty_draw_line(tty, s, s->cx, s->cy, gcp->data.width,
|
||||||
px, py, &ctx->defaults, ctx->palette);
|
px, py, &ctx->defaults, ctx->palette);
|
||||||
@@ -2049,7 +2043,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
void
|
void
|
||||||
tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct visible_ranges *r;
|
struct visible_ranges r = { NULL, 0, 0 };
|
||||||
u_int i, px, py, cx;
|
u_int i, px, py, cx;
|
||||||
char *cp = ctx->ptr;
|
char *cp = ctx->ptr;
|
||||||
|
|
||||||
@@ -2080,14 +2074,14 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
px = ctx->xoff + ctx->ocx - ctx->wox;
|
px = ctx->xoff + ctx->ocx - ctx->wox;
|
||||||
py = ctx->yoff + ctx->ocy - ctx->woy;
|
py = ctx->yoff + ctx->ocy - ctx->woy;
|
||||||
|
|
||||||
r = tty_check_overlay_range(tty, px, py, ctx->num);
|
tty_check_overlay_range(tty, px, py, ctx->num, &r);
|
||||||
for (i = 0; i < r->used; i++) {
|
for (i = 0; i < r.used; i++) {
|
||||||
if (r->nx[i] == 0)
|
if (r.ranges[i].nx == 0)
|
||||||
continue;
|
continue;
|
||||||
/* Convert back to pane position for printing. */
|
/* Convert back to pane position for printing. */
|
||||||
cx = r->px[i] - ctx->xoff + ctx->wox;
|
cx = r.ranges[i].px - ctx->xoff + ctx->wox;
|
||||||
tty_cursor_pane_unless_wrap(tty, ctx, cx, ctx->ocy);
|
tty_cursor_pane_unless_wrap(tty, ctx, cx, ctx->ocy);
|
||||||
tty_putn(tty, cp + r->px[i] - px, r->nx[i], r->nx[i]);
|
tty_putn(tty, cp + r.ranges[i].px - px, r.ranges[i].nx, r.ranges[i].nx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user