diff --git a/control.c b/control.c index 0273227f..2fc97b5e 100644 --- a/control.c +++ b/control.c @@ -828,6 +828,9 @@ control_stop(struct client *c) struct control_block *cb, *cb1; struct control_sub *csub, *csub1; + if (cs == NULL) + return; + if (~c->flags & CLIENT_CONTROLCONTROL) bufferevent_free(cs->write_event); bufferevent_free(cs->read_event); @@ -841,6 +844,7 @@ control_stop(struct client *c) control_free_block(cs, cb); control_reset_offsets(c); + c->control_state = NULL; free(cs); } diff --git a/format.c b/format.c index c9563124..810fc465 100644 --- a/format.c +++ b/format.c @@ -90,6 +90,9 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2) /* Maimum repeat size. */ #define FORMAT_MAX_REPEAT 10000 +/* Maimum precision. */ +#define FORMAT_MAX_PRECISION 100 + /* Format modifiers. */ #define FORMAT_TIMESTRING 0x1 #define FORMAT_BASENAME 0x2 @@ -4868,7 +4871,8 @@ format_replace_expression(struct format_modifier *mexp, /* The third argument may be precision. */ if (argc >= 3) { - prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr); + prec = strtonum(mexp->argv[2], -FORMAT_MAX_PRECISION, + FORMAT_MAX_PRECISION, &errstr); if (errstr != NULL) { format_log(es, "expression precision %s: %s", errstr, mexp->argv[2]); diff --git a/key-bindings.c b/key-bindings.c index a6c726f6..9bc69045 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -29,7 +29,8 @@ " 'Previous' 'p' {switch-client -p}" \ " ''" \ " 'Renumber' 'N' {move-window -r}" \ - " 'Rename' 'n' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ + " 'Rename' 'r' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ + " 'Detach' 'd' {detach-client}" \ " ''" \ " 'New Session' 's' {new-session}" \ " 'New Window' 'w' {new-window}" diff --git a/notify.c b/notify.c index d42e2b9d..8605601c 100644 --- a/notify.c +++ b/notify.c @@ -208,8 +208,12 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c, format_add(ne->formats, "hook_window", "@%u", w->id); format_add(ne->formats, "hook_window_name", "%s", w->name); } - if (wp != NULL) + if (wp != NULL) { format_add(ne->formats, "hook_pane", "%%%d", wp->id); + format_add(ne->formats, "hook_window", "@%u", wp->window->id); + format_add(ne->formats, "hook_window_name", "%s", + wp->window->name); + } format_log_debug(ne->formats, __func__); if (c != NULL) diff --git a/options-table.c b/options-table.c index 6585484c..9070d94d 100644 --- a/options-table.c +++ b/options-table.c @@ -414,10 +414,10 @@ const struct options_table_entry options_table[] = { .choices = options_table_get_clipboard_list, .default_num = 1, .text = "When an application requests the clipboard, whether to " - "ignore the request ('off'); respond with the newest buffer " - "('buffer'); request the clipboard from the most recently " - "used terminal ('request'); or to request the clipboard, " - "create a buffer, and send it to the application ('both')." + "ignore the request ('off'); respond with the newest buffer " + "('buffer'); request the clipboard from the most recently " + "used terminal ('request'); or to request the clipboard, " + "create a buffer, and send it to the application ('both')." }, { .name = "history-file", @@ -1024,7 +1024,8 @@ const struct options_table_entry options_table[] = { .scope = OPTIONS_TABLE_SESSION, .flags = OPTIONS_TABLE_IS_ARRAY, .default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK " - "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY", + "SSH_AGENT_PID SSH_CONNECTION WAYLAND_DISPLAY " + "WINDOWID XAUTHORITY", .text = "List of environment variables to update in the session " "environment when a client is attached." }, diff --git a/popup.c b/popup.c index bed2b947..2092e185 100644 --- a/popup.c +++ b/popup.c @@ -103,6 +103,27 @@ static const struct menu_item popup_internal_menu_items[] = { { NULL, KEYC_NONE, NULL } }; +static void +popup_free(struct popup_data *pd) +{ + server_client_unref(pd->c); + + if (pd->job != NULL) + job_free(pd->job); + input_free(pd->ictx); + + free(pd->or[0].ranges); + free(pd->or[1].ranges); + free(pd->r.ranges); + screen_free(&pd->s); + colour_palette_free(&pd->palette); + + free(pd->title); + free(pd->style); + free(pd->border_style); + free(pd); +} + static void popup_reapply_styles(struct popup_data *pd) { @@ -343,22 +364,8 @@ popup_free_cb(struct client *c, void *data) cmdq_get_client(item)->retval = pd->status; cmdq_continue(item); } - server_client_unref(pd->c); - if (pd->job != NULL) - job_free(pd->job); - input_free(pd->ictx); - - free(pd->or[0].ranges); - free(pd->or[1].ranges); - free(pd->r.ranges); - screen_free(&pd->s); - colour_palette_free(&pd->palette); - - free(pd->title); - free(pd->style); - free(pd->border_style); - free(pd); + popup_free(pd); } static void @@ -857,6 +864,10 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, pd->job = job_run(shellcmd, argc, argv, env, s, cwd, popup_job_update_cb, popup_job_complete_cb, NULL, pd, JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE|JOB_DEFAULTSHELL, jx, jy); + if (pd->job == NULL) { + popup_free(pd); + return (-1); + } pd->ictx = input_init(NULL, job_get_event(pd->job), &pd->palette, c); }