Sanitize pane titles and window and session names more consistently and

strictly, prevents C0 characters and other nonvisible characters causing
problems. Reported (with a different fix) by Chris Monardo in GitHub
issue 4999.
This commit is contained in:
nicm
2026-04-22 07:10:16 +00:00
parent fee70031f6
commit d339ab51eb
11 changed files with 58 additions and 41 deletions

View File

@@ -84,6 +84,7 @@ spawn_window(struct spawn_context *sc, char **cause)
struct winlink *wl;
int idx = sc->idx;
u_int sx, sy, xpixel, ypixel;
char *name;
spawn_log(__func__, sc);
@@ -182,8 +183,11 @@ spawn_window(struct spawn_context *sc, char **cause)
if (~sc->flags & SPAWN_RESPAWN) {
free(w->name);
if (sc->name != NULL) {
w->name = format_single(item, sc->name, c, s, NULL,
NULL);
name = format_single(item, sc->name, c, s, NULL, NULL);
w->name = clean_name(name, "#");
free(name);
if (w->name == NULL)
w->name = xstrdup("");
options_set_number(w->options, "automatic-rename", 0);
} else
w->name = default_window_name(w);