summaryrefslogtreecommitdiffstats
path: root/cmd-save-buffer.c
diff options
context:
space:
mode:
authornicm <nicm>2022-12-07 09:44:44 +0000
committernicm <nicm>2022-12-07 09:44:44 +0000
commit7e497c7f2303b29b0f44fe360a78c44ca86b87f9 (patch)
tree2d7b3b7c000ff2b584f93f0914312e66ae532742 /cmd-save-buffer.c
parent20da16737715a183a019f1072735614615b5fd1c (diff)
Process escape sequences in show-buffer, GitHub issue 3401.
Diffstat (limited to 'cmd-save-buffer.c')
-rw-r--r--cmd-save-buffer.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index 513181e1..2983282d 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -79,7 +79,8 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item)
int flags;
const char *bufname = args_get(args, 'b'), *bufdata;
size_t bufsize;
- char *path, *tmp;
+ char *path;
+ struct evbuffer *evb;
if (bufname == NULL) {
if ((pb = paste_get_top(NULL)) == NULL) {
@@ -97,10 +98,12 @@ cmd_save_buffer_exec(struct cmd *self, struct cmdq_item *item)
if (cmd_get_entry(self) == &cmd_show_buffer_entry) {
if (c->session != NULL || (c->flags & CLIENT_CONTROL)) {
- utf8_stravisx(&tmp, bufdata, bufsize,
- VIS_OCTAL|VIS_CSTYLE|VIS_TAB);
- cmdq_print(item, "%s", tmp);
- free(tmp);
+ evb = evbuffer_new();
+ if (evb == NULL)
+ fatalx("out of memory");
+ evbuffer_add(evb, bufdata, bufsize);
+ cmdq_print_data(item, 1, evb);
+ evbuffer_free(evb);
return (CMD_RETURN_NORMAL);
}
path = xstrdup("-");