mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 08:18:48 +00:00
Support embedded styles in the display-message message, GitHub issue 2206.
This commit is contained in:
parent
8502517d30
commit
c489bf0a1e
8
alerts.c
8
alerts.c
@ -316,8 +316,10 @@ alerts_set_message(struct winlink *wl, const char *type, const char *option)
|
|||||||
if (visual == VISUAL_OFF)
|
if (visual == VISUAL_OFF)
|
||||||
continue;
|
continue;
|
||||||
if (c->session->curw == wl)
|
if (c->session->curw == wl)
|
||||||
status_message_set(c, "%s in current window", type);
|
status_message_set(c, 1, "%s in current window", type);
|
||||||
else
|
else {
|
||||||
status_message_set(c, "%s in window %d", type, wl->idx);
|
status_message_set(c, 1, "%s in window %d", type,
|
||||||
|
wl->idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (args_has(args, 'p'))
|
if (args_has(args, 'p'))
|
||||||
cmdq_print(item, "%s", msg);
|
cmdq_print(item, "%s", msg);
|
||||||
else if (tc != NULL)
|
else if (tc != NULL)
|
||||||
status_message_set(tc, "%s", msg);
|
status_message_set(tc, 0, "%s", msg);
|
||||||
free(msg);
|
free(msg);
|
||||||
|
|
||||||
format_free(ft);
|
format_free(ft);
|
||||||
|
@ -112,7 +112,7 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
|
|||||||
note = xstrdup(bd->note);
|
note = xstrdup(bd->note);
|
||||||
tmp = utf8_padcstr(key, keywidth + 1);
|
tmp = utf8_padcstr(key, keywidth + 1);
|
||||||
if (args_has(args, '1') && tc != NULL)
|
if (args_has(args, '1') && tc != NULL)
|
||||||
status_message_set(tc, "%s%s%s", prefix, tmp, note);
|
status_message_set(tc, 1, "%s%s%s", prefix, tmp, note);
|
||||||
else
|
else
|
||||||
cmdq_print(item, "%s%s%s", prefix, tmp, note);
|
cmdq_print(item, "%s%s%s", prefix, tmp, note);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
@ -856,7 +856,7 @@ cmdq_error(struct cmdq_item *item, const char *fmt, ...)
|
|||||||
c->retval = 1;
|
c->retval = 1;
|
||||||
} else {
|
} else {
|
||||||
*msg = toupper((u_char) *msg);
|
*msg = toupper((u_char) *msg);
|
||||||
status_message_set(c, "%s", msg);
|
status_message_set(c, 1, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(msg);
|
free(msg);
|
||||||
|
@ -1139,7 +1139,7 @@ mode_tree_run_command(struct client *c, struct cmd_find_state *fs,
|
|||||||
if (status == CMD_PARSE_ERROR) {
|
if (status == CMD_PARSE_ERROR) {
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
*error = toupper((u_char)*error);
|
*error = toupper((u_char)*error);
|
||||||
status_message_set(c, "%s", error);
|
status_message_set(c, 1, "%s", error);
|
||||||
}
|
}
|
||||||
free(error);
|
free(error);
|
||||||
}
|
}
|
||||||
|
8
status.c
8
status.c
@ -423,7 +423,7 @@ status_redraw(struct client *c)
|
|||||||
|
|
||||||
/* Set a status line message. */
|
/* Set a status line message. */
|
||||||
void
|
void
|
||||||
status_message_set(struct client *c, const char *fmt, ...)
|
status_message_set(struct client *c, int ignore_styles, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -433,6 +433,7 @@ status_message_set(struct client *c, const char *fmt, ...)
|
|||||||
status_push_screen(c);
|
status_push_screen(c);
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
c->message_ignore_styles = ignore_styles;
|
||||||
xvasprintf(&c->message_string, fmt, ap);
|
xvasprintf(&c->message_string, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
@ -515,7 +516,10 @@ status_message_redraw(struct client *c)
|
|||||||
for (offset = 0; offset < c->tty.sx; offset++)
|
for (offset = 0; offset < c->tty.sx; offset++)
|
||||||
screen_write_putc(&ctx, &gc, ' ');
|
screen_write_putc(&ctx, &gc, ' ');
|
||||||
screen_write_cursormove(&ctx, 0, lines - 1, 0);
|
screen_write_cursormove(&ctx, 0, lines - 1, 0);
|
||||||
screen_write_nputs(&ctx, len, &gc, "%s", c->message_string);
|
if (c->message_ignore_styles)
|
||||||
|
screen_write_nputs(&ctx, len, &gc, "%s", c->message_string);
|
||||||
|
else
|
||||||
|
format_draw(&ctx, &gc, c->tty.sx, c->message_string, NULL);
|
||||||
screen_write_stop(&ctx);
|
screen_write_stop(&ctx);
|
||||||
|
|
||||||
if (grid_compare(sl->active->grid, old_screen.grid) == 0) {
|
if (grid_compare(sl->active->grid, old_screen.grid) == 0) {
|
||||||
|
4
tmux.h
4
tmux.h
@ -1607,6 +1607,7 @@ struct client {
|
|||||||
|
|
||||||
uint64_t redraw_panes;
|
uint64_t redraw_panes;
|
||||||
|
|
||||||
|
int message_ignore_styles;
|
||||||
char *message_string;
|
char *message_string;
|
||||||
struct event message_timer;
|
struct event message_timer;
|
||||||
|
|
||||||
@ -2354,7 +2355,8 @@ struct style_range *status_get_range(struct client *, u_int, u_int);
|
|||||||
void status_init(struct client *);
|
void status_init(struct client *);
|
||||||
void status_free(struct client *);
|
void status_free(struct client *);
|
||||||
int status_redraw(struct client *);
|
int status_redraw(struct client *);
|
||||||
void printflike(2, 3) status_message_set(struct client *, const char *, ...);
|
void printflike(3, 4) status_message_set(struct client *, int, const char *,
|
||||||
|
...);
|
||||||
void status_message_clear(struct client *);
|
void status_message_clear(struct client *);
|
||||||
int status_message_redraw(struct client *);
|
int status_message_redraw(struct client *);
|
||||||
void status_prompt_set(struct client *, const char *, const char *,
|
void status_prompt_set(struct client *, const char *, const char *,
|
||||||
|
@ -772,7 +772,7 @@ window_customize_set_callback(struct client *c, void *itemdata, const char *s,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
*cause = toupper((u_char)*cause);
|
*cause = toupper((u_char)*cause);
|
||||||
status_message_set(c, "%s", cause);
|
status_message_set(c, 1, "%s", cause);
|
||||||
free(cause);
|
free(cause);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user