Merge branch 'obsd-master' into master

This commit is contained in:
Thomas Adam
2021-08-27 20:01:11 +01:00
21 changed files with 498 additions and 194 deletions

View File

@ -2121,6 +2121,7 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
int argc;
char **argv, *cause;
struct cmd_parse_result *pr;
struct args_value *values;
if (c->flags & CLIENT_EXIT)
return;
@ -2146,7 +2147,8 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
*argv = xstrdup("new-session");
}
pr = cmd_parse_from_arguments(argc, argv, NULL);
values = args_from_vector(argc, argv);
pr = cmd_parse_from_arguments(values, argc, NULL);
switch (pr->status) {
case CMD_PARSE_ERROR:
cause = pr->error;
@ -2154,6 +2156,8 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
case CMD_PARSE_SUCCESS:
break;
}
args_free_values(values, argc);
free(values);
cmd_free_argv(argc, argv);
cmdq_append(c, cmdq_get_command(pr->cmdlist, NULL));
@ -2444,7 +2448,7 @@ server_client_get_flags(struct client *c)
}
/* Get client window. */
static struct client_window *
struct client_window *
server_client_get_client_window(struct client *c, u_int id)
{
struct client_window cw = { .window = id };
@ -2452,6 +2456,21 @@ server_client_get_client_window(struct client *c, u_int id)
return (RB_FIND(client_windows, &c->windows, &cw));
}
/* Add client window. */
struct client_window *
server_client_add_client_window(struct client *c, u_int id)
{
struct client_window *cw;
cw = server_client_get_client_window(c, id);
if (cw == NULL) {
cw = xcalloc(1, sizeof *cw);
cw->window = id;
RB_INSERT(client_windows, &c->windows, cw);
}
return cw;
}
/* Get client active pane. */
struct window_pane *
server_client_get_pane(struct client *c)
@ -2480,12 +2499,7 @@ server_client_set_pane(struct client *c, struct window_pane *wp)
if (s == NULL)
return;
cw = server_client_get_client_window(c, s->curw->window->id);
if (cw == NULL) {
cw = xcalloc(1, sizeof *cw);
cw->window = s->curw->window->id;
RB_INSERT(client_windows, &c->windows, cw);
}
cw = server_client_add_client_window(c, s->curw->window->id);
cw->pane = wp;
log_debug("%s pane now %%%u", c->name, wp->id);
}