mirror of
https://github.com/tmux/tmux.git
synced 2026-10-07 02:04:22 +00:00
Add support for borderless menus, like panes. GitHub issue 5447 from harikp2002
at gmail dot com.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: screen-write.c,v 1.291 2026/09/21 10:22:31 nicm Exp $ */
|
||||
/* $OpenBSD: screen-write.c,v 1.292 2026/09/21 12:14:32 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -833,34 +833,39 @@ screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu, int choice,
|
||||
struct screen *s = ctx->s;
|
||||
struct grid_cell default_gc;
|
||||
const struct grid_cell *gc = &default_gc;
|
||||
u_int cx, cy, i, j, width = menu->width;
|
||||
u_int border, cx = s->cx, cy = s->cy, i, j, width;
|
||||
const char *name;
|
||||
|
||||
cx = s->cx;
|
||||
cy = s->cy;
|
||||
|
||||
memcpy(&default_gc, menu_gc, sizeof default_gc);
|
||||
|
||||
screen_write_box(ctx, menu->width + 4, menu->count + 2, lines,
|
||||
border_gc, menu->title);
|
||||
if (lines == BOX_LINES_NONE) {
|
||||
border = 0;
|
||||
width = menu->item_width;
|
||||
} else {
|
||||
border = 1;
|
||||
width = menu->width;
|
||||
screen_write_box(ctx, width + 4, menu->count + 2, lines,
|
||||
border_gc, menu->title);
|
||||
}
|
||||
|
||||
for (i = 0; i < menu->count; i++) {
|
||||
name = menu->items[i].name;
|
||||
if (name == NULL) {
|
||||
screen_write_cursormove(ctx, cx, cy + 1 + i, 0);
|
||||
screen_write_hline(ctx, width + 4, 1, 1, lines,
|
||||
border_gc);
|
||||
screen_write_cursormove(ctx, cx, cy + border + i, 0);
|
||||
screen_write_hline(ctx, width + 2 + (2 * border), 1, 1,
|
||||
lines, border_gc);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (choice >= 0 && i == (u_int)choice && *name != '-')
|
||||
gc = choice_gc;
|
||||
|
||||
screen_write_cursormove(ctx, cx + 1, cy + 1 + i, 0);
|
||||
screen_write_cursormove(ctx, cx + border, cy + border + i, 0);
|
||||
for (j = 0; j < width + 2; j++)
|
||||
screen_write_putc(ctx, gc, ' ');
|
||||
|
||||
screen_write_cursormove(ctx, cx + 2, cy + 1 + i, 0);
|
||||
screen_write_cursormove(ctx, cx + border + 1, cy + border + i,
|
||||
0);
|
||||
if (*name == '-') {
|
||||
default_gc.attr |= GRID_ATTR_DIM;
|
||||
format_draw(ctx, gc, width, name + 1, NULL, 0);
|
||||
|
||||
Reference in New Issue
Block a user