mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Instead of passing titles through vis() which doubles backslashes, just
ignore any containing control characters or invalid UTF-8. GitHub issue 2070.
This commit is contained in:
parent
87bcc0c7e0
commit
265164d251
@ -197,8 +197,8 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
if (args_has(self->args, 'T')) {
|
if (args_has(self->args, 'T')) {
|
||||||
pane_title = format_single(item, args_get(self->args, 'T'),
|
pane_title = format_single(item, args_get(self->args, 'T'),
|
||||||
c, s, wl, wp);
|
c, s, wl, wp);
|
||||||
screen_set_title(&wp->base, pane_title);
|
if (screen_set_title(&wp->base, pane_title))
|
||||||
server_status_window(wp->window);
|
server_status_window(wp->window);
|
||||||
free(pane_title);
|
free(pane_title);
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
10
input.c
10
input.c
@ -2213,10 +2213,8 @@ input_exit_osc(struct input_ctx *ictx)
|
|||||||
switch (option) {
|
switch (option) {
|
||||||
case 0:
|
case 0:
|
||||||
case 2:
|
case 2:
|
||||||
if (utf8_isvalid(p)) {
|
if (screen_set_title(sctx->s, p))
|
||||||
screen_set_title(sctx->s, p);
|
|
||||||
server_status_window(ictx->wp->window);
|
server_status_window(ictx->wp->window);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
input_osc_4(ictx, p);
|
input_osc_4(ictx, p);
|
||||||
@ -2274,10 +2272,8 @@ input_exit_apc(struct input_ctx *ictx)
|
|||||||
return;
|
return;
|
||||||
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
|
log_debug("%s: \"%s\"", __func__, ictx->input_buf);
|
||||||
|
|
||||||
if (!utf8_isvalid(ictx->input_buf))
|
if (screen_set_title(sctx->s, ictx->input_buf))
|
||||||
return;
|
server_status_window(ictx->wp->window);
|
||||||
screen_set_title(sctx->s, ictx->input_buf);
|
|
||||||
server_status_window(ictx->wp->window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rename string started. */
|
/* Rename string started. */
|
||||||
|
9
screen.c
9
screen.c
@ -152,11 +152,16 @@ screen_set_cursor_colour(struct screen *s, const char *colour)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set screen title. */
|
/* Set screen title. */
|
||||||
void
|
int
|
||||||
screen_set_title(struct screen *s, const char *title)
|
screen_set_title(struct screen *s, const char *title)
|
||||||
{
|
{
|
||||||
|
char *cp;
|
||||||
|
|
||||||
|
if (!utf8_isvalid(title))
|
||||||
|
return (0);
|
||||||
free(s->title);
|
free(s->title);
|
||||||
utf8_stravis(&s->title, title, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
|
s->title = xstrdup(title);
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set screen path. */
|
/* Set screen path. */
|
||||||
|
2
tmux.h
2
tmux.h
@ -2424,7 +2424,7 @@ void screen_free(struct screen *);
|
|||||||
void screen_reset_tabs(struct screen *);
|
void screen_reset_tabs(struct screen *);
|
||||||
void screen_set_cursor_style(struct screen *, u_int);
|
void screen_set_cursor_style(struct screen *, u_int);
|
||||||
void screen_set_cursor_colour(struct screen *, const char *);
|
void screen_set_cursor_colour(struct screen *, const char *);
|
||||||
void screen_set_title(struct screen *, const char *);
|
int screen_set_title(struct screen *, const char *);
|
||||||
void screen_set_path(struct screen *, const char *);
|
void screen_set_path(struct screen *, const char *);
|
||||||
void screen_push_title(struct screen *);
|
void screen_push_title(struct screen *);
|
||||||
void screen_pop_title(struct screen *);
|
void screen_pop_title(struct screen *);
|
||||||
|
Loading…
Reference in New Issue
Block a user