summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-load-buffer.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-11-12 11:10:50 +0000
committernicm <nicm@openbsd.org>2015-11-12 11:10:50 +0000
commit62f1fdfd8a68427beb92417bc79f3770b8ddd4a6 (patch)
tree7c0f51683c377795c6727a92bdf201d1d052f67e /usr.bin/tmux/cmd-load-buffer.c
parentNuke the utf8 and status-utf8 options and make tmux only a UTF-8 (diff)
downloadwireguard-openbsd-62f1fdfd8a68427beb92417bc79f3770b8ddd4a6.tar.xz
wireguard-openbsd-62f1fdfd8a68427beb92417bc79f3770b8ddd4a6.zip
If we know the terminal outside tmux is not UTF-8, replace UTF-8 in
error messages and whatnot with underscores the same as we do when we draw UTF-8 characters as part of the screen.
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index ab7029b42d2..a30536e46b0 100644
--- a/usr.bin/tmux/cmd-load-buffer.c
+++ b/usr.bin/tmux/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-load-buffer.c,v 1.37 2015/11/10 22:33:47 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.38 2015/11/12 11:10:50 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -133,7 +133,7 @@ void
cmd_load_buffer_callback(struct client *c, int closed, void *data)
{
const char *bufname = data;
- char *pdata, *cause;
+ char *pdata, *cause, *saved;
size_t psize;
if (!closed)
@@ -154,6 +154,11 @@ cmd_load_buffer_callback(struct client *c, int closed, void *data)
if (paste_set(pdata, psize, bufname, &cause) != 0) {
/* No context so can't use server_client_msg_error. */
+ if (~c->flags & CLIENT_UTF8) {
+ saved = cause;
+ cause = utf8_sanitize(saved);
+ free(saved);
+ }
evbuffer_add_printf(c->stderr_data, "%s", cause);
server_push_stderr(c);
free(pdata);