summaryrefslogtreecommitdiffstats
path: root/cmd-display-menu.c
diff options
context:
space:
mode:
authornicm <nicm>2021-10-14 13:19:01 +0000
committernicm <nicm>2021-10-14 13:19:01 +0000
commitadd20637f256c0118d3c687d5d1446612d14389a (patch)
treecf546997fdd9cb96e0ace7dd385eb127d67aa448 /cmd-display-menu.c
parentd0ab1a837a0ab3e26fe7195f14672f6feb43c4c4 (diff)
Add popup-border-lines option to set popup line style, from Alexis
Hildebrandt, GitHub issue 2930.
Diffstat (limited to 'cmd-display-menu.c')
-rw-r--r--cmd-display-menu.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/cmd-display-menu.c b/cmd-display-menu.c
index 87871f68..f6531ede 100644
--- a/cmd-display-menu.c
+++ b/cmd-display-menu.c
@@ -53,9 +53,10 @@ const struct cmd_entry cmd_display_popup_entry = {
.name = "display-popup",
.alias = "popup",
- .args = { "BCc:d:e:Eh:t:w:x:y:", 0, -1, NULL },
- .usage = "[-BCE] [-c target-client] [-d start-directory] "
- "[-e environment] [-h height] " CMD_TARGET_PANE_USAGE " "
+ .args = { "Bb:Cc:d:e:Eh:t:w:x:y:", 0, -1, NULL },
+ .usage = "[-BCE] [-b border-lines] [-c target-client] "
+ "[-d start-directory] [-e environment] [-h height] "
+ CMD_TARGET_PANE_USAGE " "
"[-w width] [-x position] [-y position] [shell-command]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -354,11 +355,14 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
struct client *tc = cmdq_get_target_client(item);
struct tty *tty = &tc->tty;
const char *value, *shell, *shellcmd = NULL;
- char *cwd, *cause, **argv = NULL;
+ char *cwd, *cause = NULL, **argv = NULL;
int flags = 0, argc = 0;
+ enum box_lines lines = BOX_LINES_DEFAULT;
u_int px, py, w, h, count = args_count(args);
struct args_value *av;
struct environ *env = NULL;
+ struct options *o = s->curw->window->options;
+ struct options_entry *oe;
if (args_has(args, 'C')) {
server_client_clear_overlay(tc);
@@ -394,6 +398,20 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
if (!cmd_display_menu_get_position(tc, item, args, &px, &py, w, h))
return (CMD_RETURN_NORMAL);
+ value = args_get(args, 'b');
+ if (args_has(args, 'B'))
+ lines = BOX_LINES_NONE;
+ else if (value != NULL) {
+ oe = options_get(o, "popup-border-lines");
+ lines = options_find_choice(options_table_entry(oe), value,
+ &cause);
+ if (cause != NULL) {
+ cmdq_error(item, "popup-border-lines %s", cause);
+ free(cause);
+ return (CMD_RETURN_ERROR);
+ }
+ }
+
value = args_get(args, 'd');
if (value != NULL)
cwd = format_single_from_target(item, value);
@@ -425,10 +443,8 @@ cmd_display_popup_exec(struct cmd *self, struct cmdq_item *item)
flags |= POPUP_CLOSEEXITZERO;
else if (args_has(args, 'E'))
flags |= POPUP_CLOSEEXIT;
- if (args_has(args, 'B'))
- flags |= POPUP_NOBORDER;
- if (popup_display(flags, item, px, py, w, h, env, shellcmd, argc, argv,
- cwd, tc, s, NULL, NULL) != 0) {
+ if (popup_display(flags, lines, item, px, py, w, h, env, shellcmd, argc,
+ argv, cwd, tc, s, NULL, NULL) != 0) {
cmd_free_argv(argc, argv);
if (env != NULL)
environ_free(env);