diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-03-12 22:48:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-03-12 22:48:58 +0000 |
commit | 99934bf9988ca364d3d75bb185863eed184a2971 (patch) | |
tree | 36685d0e10e93063abbfda1af0f2e211329d01a2 | |
parent | 8aa40ec1c71f9aad61c53991bdd2ea54f08d86ec (diff) | |
download | rtmux-99934bf9988ca364d3d75bb185863eed184a2971.tar.gz rtmux-99934bf9988ca364d3d75bb185863eed184a2971.tar.bz2 rtmux-99934bf9988ca364d3d75bb185863eed184a2971.zip |
Write escaped output in control mode rather than hex, from George Nachman.
-rw-r--r-- | control-notify.c | 8 | ||||
-rw-r--r-- | tmux.1 | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/control-notify.c b/control-notify.c index 90ee4ffa..42c1695b 100644 --- a/control-notify.c +++ b/control-notify.c @@ -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); } @@ -3672,7 +3672,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 , |