Merge branch 'obsd-master' into master

pull/2648/head
Thomas Adam 2021-04-12 12:01:32 +01:00
commit bedf2bd437
11 changed files with 35 additions and 21 deletions

View File

@ -314,10 +314,11 @@ alerts_set_message(struct winlink *wl, const char *type, const char *option)
tty_putcode(&c->tty, TTYC_BEL);
if (visual == VISUAL_OFF)
continue;
if (c->session->curw == wl)
status_message_set(c, -1, 1, "%s in current window", type);
else {
status_message_set(c, -1, 1, "%s in window %d", type,
if (c->session->curw == wl) {
status_message_set(c, -1, 1, 0, "%s in current window",
type);
} else {
status_message_set(c, -1, 1, 0, "%s in window %d", type,
wl->idx);
}
}

View File

@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_message_entry = {
.name = "display-message",
.alias = "display",
.args = { "acd:Ipt:F:v", 0, 1 },
.usage = "[-aIpv] [-c target-client] [-d delay] [-F format] "
.args = { "acd:INpt:F:v", 0, 1 },
.usage = "[-aINpv] [-c target-client] [-d delay] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@ -132,8 +132,10 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "%s", msg);
else if (args_has(args, 'p'))
cmdq_print(item, "%s", msg);
else if (tc != NULL)
status_message_set(tc, delay, 0, "%s", msg);
else if (tc != NULL) {
status_message_set(tc, delay, 0, args_has(args, 'N'), "%s",
msg);
}
free(msg);
format_free(ft);

View File

@ -113,9 +113,10 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
else
note = xstrdup(bd->note);
tmp = utf8_padcstr(key, keywidth + 1);
if (args_has(args, '1') && tc != NULL)
status_message_set(tc, -1, 1, "%s%s%s", prefix, tmp, note);
else
if (args_has(args, '1') && tc != NULL) {
status_message_set(tc, -1, 1, 0, "%s%s%s", prefix, tmp,
note);
} else
cmdq_print(item, "%s%s%s", prefix, tmp, note);
free(tmp);
free(note);

View File

@ -862,7 +862,7 @@ cmdq_error(struct cmdq_item *item, const char *fmt, ...)
c->retval = 1;
} else {
*msg = toupper((u_char) *msg);
status_message_set(c, -1, 1, "%s", msg);
status_message_set(c, -1, 1, 0, "%s", msg);
}
free(msg);

View File

@ -193,7 +193,7 @@ cmd_run_shell_timer(__unused int fd, __unused short events, void* arg)
if (status == CMD_PARSE_ERROR) {
if (cdata->item == NULL) {
*error = toupper((u_char)*error);
status_message_set(c, -1, 1, "%s", error);
status_message_set(c, -1, 1, 0, "%s", error);
} else
cmdq_error(cdata->item, "%s", error);
free(error);

View File

@ -1204,7 +1204,7 @@ mode_tree_run_command(struct client *c, struct cmd_find_state *fs,
if (status == CMD_PARSE_ERROR) {
if (c != NULL) {
*error = toupper((u_char)*error);
status_message_set(c, -1, 1, "%s", error);
status_message_set(c, -1, 1, 0, "%s", error);
}
free(error);
}

View File

@ -1308,7 +1308,11 @@ server_client_handle_key(struct client *c, struct key_event *event)
* immediately rather than queued.
*/
if (~c->flags & CLIENT_READONLY) {
status_message_clear(c);
if (c->message_string != NULL) {
if (c->message_ignore_keys)
return (0);
status_message_clear(c);
}
if (c->overlay_key != NULL) {
switch (c->overlay_key(c, event)) {
case 0:

View File

@ -424,7 +424,7 @@ status_redraw(struct client *c)
/* Set a status line message. */
void
status_message_set(struct client *c, int delay, int ignore_styles,
const char *fmt, ...)
int ignore_keys, const char *fmt, ...)
{
struct timeval tv;
va_list ap;
@ -433,7 +433,6 @@ status_message_set(struct client *c, int delay, int ignore_styles,
status_push_screen(c);
va_start(ap, fmt);
c->message_ignore_styles = ignore_styles;
xvasprintf(&c->message_string, fmt, ap);
va_end(ap);
@ -456,6 +455,10 @@ status_message_set(struct client *c, int delay, int ignore_styles,
evtimer_add(&c->message_timer, &tv);
}
if (delay != 0)
c->message_ignore_keys = ignore_keys;
c->message_ignore_styles = ignore_styles;
c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
c->flags |= CLIENT_REDRAWSTATUS;
}

4
tmux.1
View File

@ -5565,7 +5565,7 @@ The following keys are also available:
.It Li "q" Ta "Exit menu"
.El
.It Xo Ic display-message
.Op Fl aIpv
.Op Fl aINpv
.Op Fl c Ar target-client
.Op Fl d Ar delay
.Op Fl t Ar target-pane
@ -5585,6 +5585,8 @@ If
is not given, the
.Ic message-time
option is used; a delay of zero waits for a key press.
.Ql N
ignores key presses and closes only after the delay expires.
The format of
.Ar message
is described in the

3
tmux.h
View File

@ -1688,6 +1688,7 @@ struct client {
uint64_t redraw_panes;
int message_ignore_keys;
int message_ignore_styles;
char *message_string;
struct event message_timer;
@ -2491,7 +2492,7 @@ struct style_range *status_get_range(struct client *, u_int, u_int);
void status_init(struct client *);
void status_free(struct client *);
int status_redraw(struct client *);
void status_message_set(struct client *, int, int, const char *, ...);
void status_message_set(struct client *, int, int, int, const char *, ...);
void status_message_clear(struct client *);
int status_message_redraw(struct client *);
void status_prompt_set(struct client *, struct cmd_find_state *,

View File

@ -999,7 +999,7 @@ window_customize_set_option_callback(struct client *c, void *itemdata,
fail:
*cause = toupper((u_char)*cause);
status_message_set(c, -1, 1, "%s", cause);
status_message_set(c, -1, 1, 0, "%s", cause);
free(cause);
return (0);
}
@ -1205,7 +1205,7 @@ window_customize_set_command_callback(struct client *c, void *itemdata,
fail:
*error = toupper((u_char)*error);
status_message_set(c, -1, 1, "%s", error);
status_message_set(c, -1, 1, 0, "%s", error);
free(error);
return (0);
}