summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-06-03 19:33:05 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-06-03 19:33:05 +0000
commit28f972b8c8432dd58fd37962a23defdfdeb407d3 (patch)
treeb2d804062fcef1da3a25b7a065ac5b80969c14e0
parent9166ba37786e5c3773caaee29bab06a4cb3775dc (diff)
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. Suggested by deraadt a few days ago.
-rw-r--r--usr.bin/tmux/input.c4
-rw-r--r--usr.bin/tmux/screen.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 2f7105fb7af..2906e702665 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.2 2009/06/03 19:33:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c
index 028653b56c4..da7763a805f 100644
--- a/usr.bin/tmux/screen.c
+++ b/usr.bin/tmux/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.2 2009/06/03 19:33:04 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -19,6 +19,7 @@
#include <sys/types.h>
#include <string.h>
+#include <vis.h>
#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. */