From 7597cb68345d1ff96c34d61f73cbeba1e98484ec Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 25 Jun 2009 15:49:27 +0000 Subject: [PATCH] Pass window titles through vis(1). <0x20 is dropped anyway by the input state machine but top-bit-set nonprintables could cause trouble, and they are neater like this anyway. --- input.c | 4 ++-- screen.c | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/input.c b/input.c index 6e778559..2906e702 100644 --- a/input.c +++ b/input.c @@ -1,4 +1,4 @@ -/* $Id: input.c,v 1.78 2009-05-04 17:58:26 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.2 2009/06/03 19:33:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -475,7 +475,7 @@ input_state_string_next(u_char ch, struct input_ctx *ictx) return; } - if (ch >= 0x20 && ch != 0x7f) { + if (ch >= 0x20) { if (input_add_string(ictx, ch) != 0) input_state(ictx, input_state_first); return; diff --git a/screen.c b/screen.c index 00bba794..da7763a8 100644 --- a/screen.c +++ b/screen.c @@ -1,4 +1,4 @@ -/* $Id: screen.c,v 1.82 2009-05-04 17:58:27 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.2 2009/06/03 19:33:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -19,6 +19,7 @@ #include #include +#include #include "tmux.h" @@ -65,8 +66,12 @@ screen_free(struct screen *s) void screen_set_title(struct screen *s, const char *title) { + char tmp[BUFSIZ]; + + strnvis(tmp, title, sizeof tmp, VIS_OCTAL|VIS_TAB|VIS_NL); + xfree(s->title); - s->title = xstrdup(title); + s->title = xstrdup(tmp); } /* Resize screen. */