Replace overlay_ranges with visible_ranges which can hold more than

three ranges (will be needed for floating panes); move the visible
ranges checks outside of tty_draw_line and rewrite it to fix issues with
partially-obscured wide characters. With Michael Grant.
This commit is contained in:
nicm
2026-01-23 10:45:53 +00:00
parent 195a9cfd88
commit f70150a663
10 changed files with 502 additions and 316 deletions

10
menu.c
View File

@@ -38,6 +38,7 @@ struct menu_data {
struct cmd_find_state fs;
struct screen s;
struct visible_ranges r;
u_int px;
u_int py;
@@ -185,15 +186,16 @@ 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. */
void
struct visible_ranges *
menu_check_cb(__unused struct client *c, void *data, u_int px, u_int py,
u_int nx, struct overlay_ranges *r)
u_int nx)
{
struct menu_data *md = data;
struct menu *menu = md->menu;
server_client_overlay_range(md->px, md->py, menu->width + 4,
menu->count + 2, px, py, nx, r);
menu->count + 2, px, py, nx, &md->r);
return (&md->r);
}
static void
@@ -292,7 +294,9 @@ menu_free_cb(__unused struct client *c, void *data)
if (md->cb != NULL)
md->cb(md->menu, UINT_MAX, KEYC_NONE, md->data);
free(md->r.ranges);
screen_free(&md->s);
menu_free(md->menu);
free(md->style);
free(md->selected_style);