summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 11:40:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-03-25 11:40:41 +0000
commitd44ca593a7cdd383635669c1ced4e7a4e05fca53 (patch)
tree22b6ca9b690349f4c34a4ce083970f5564409a60 /usr.bin
parent8a6826b8ec5e8c2d4a26a199246d901571504cf1 (diff)
Write escaped output in control mode rather than hex, from George
Nachman.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/control-notify.c10
-rw-r--r--usr.bin/tmux/tmux.14
2 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/tmux/control-notify.c b/usr.bin/tmux/control-notify.c
index b1f5b8fd2b0..ebeddc98522 100644
--- a/usr.bin/tmux/control-notify.c
+++ b/usr.bin/tmux/control-notify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control-notify.c,v 1.5 2013/03/25 11:38:43 nicm Exp $ */
+/* $OpenBSD: control-notify.c,v 1.6 2013/03/25 11:40:40 nicm Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -46,8 +46,12 @@ control_notify_input(struct client *c, struct window_pane *wp,
if (winlink_find_by_window(&c->session->windows, wp->window) != NULL) {
message = evbuffer_new();
evbuffer_add_printf(message, "%%output %u ", wp->id);
- for (i = 0; i < len; i++)
- evbuffer_add_printf(message, "%02hhx", buf[i]);
+ for (i = 0; i < len; i++) {
+ if (buf[i] < ' ' || buf[i] == '\\')
+ evbuffer_add_printf(message, "\\%03o", buf[i]);
+ else
+ evbuffer_add_printf(message, "%c", buf[i]);
+ }
control_write_buffer(c, message);
evbuffer_free(message);
}
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index de3a7e9182b..55f05477b51 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.349 2013/03/25 11:40:20 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.350 2013/03/25 11:40:40 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -3671,7 +3671,7 @@ The new layout is
.It Ic %output Ar pane-id Ar value
A window pane produced output.
.Ar value
-contains that output with each byte encoded as two hex digits.
+escapes non-printable characters and backslash as octal \\xxx.
.It Ic %session-changed Ar session-id Ar name
The client is now attached to the session with ID
.Ar session-id ,