--- format.c | 2 +- paste.c | 11 ++--------- tmux.h | 7 +++---- 3 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/format.c b/format.c index 05cd4ed..f177d80 100644 --- a/format.c +++ b/format.c @@ -606,7 +606,7 @@ void format_paste_buffer(struct format_tree *ft, struct window_pane *wp, struct paste_buffer *pb) { - char *pb_print = paste_print(pb, wp, 50); + char *pb_print = paste_print(pb, wp); format_add(ft, "buffer_size", "%zu", pb->size); format_add(ft, "buffer_sample", "%s", pb_print); diff --git a/paste.c b/paste.c index 6101195..28cadd2 100644 --- a/paste.c +++ b/paste.c @@ -149,26 +149,19 @@ paste_replace(struct paste_stack *ps, u_int idx, char *data, size_t size) /* Convert a buffer into a visible string. */ char * -paste_print(struct paste_buffer *pb, struct window_pane *wp, size_t width) +paste_print(struct paste_buffer *pb, struct window_pane *wp) { char *buf; size_t len, used; const int flags = VIS_OCTAL|VIS_TAB|VIS_NL; - if (width < 3) - width = 3; - buf = xmalloc(width * 4 + 4); /* four bytes each plus "...\0" */ - len = pb->size; - if (len > width) - len = width; + buf = xmalloc(len * 4 + 1); /* four bytes each plus '\0' */ if (options_get_number(&wp->window->options, "utf8")) used = utf8_strvis(buf, pb->data, len, flags); else used = strvisx(buf, pb->data, len, flags); - if (pb->size > width || used > width) - strlcpy(buf + width, "...", 4); return (buf); } diff --git a/tmux.h b/tmux.h index 195c955..cff186d 100644 --- a/tmux.h +++ b/tmux.h @@ -82,7 +82,7 @@ extern char **environ; /* Default template for choose-buffer. */ #define CHOOSE_BUFFER_TEMPLATE \ - "#{line}: #{buffer_size} bytes: \"#{buffer_sample}\"" + "#{line}: #{buffer_size} bytes: #{buffer_sample}" /* Default template for choose-client. */ #define CHOOSE_CLIENT_TEMPLATE \ @@ -115,7 +115,7 @@ extern char **environ; /* Default template for list-buffers. */ #define LIST_BUFFERS_TEMPLATE \ - "#{line}: #{buffer_size} bytes: \"#{buffer_sample}\"" + "#{line}: #{buffer_size} bytes: #{buffer_sample}" /* Default template for list-clients. */ #define LIST_CLIENTS_TEMPLATE \ @@ -1711,8 +1711,7 @@ int paste_free_top(struct paste_stack *); int paste_free_index(struct paste_stack *, u_int); void paste_add(struct paste_stack *, char *, size_t, u_int); int paste_replace(struct paste_stack *, u_int, char *, size_t); -char *paste_print(struct paste_buffer *, struct window_pane *, - size_t); +char *paste_print(struct paste_buffer *, struct window_pane *); void paste_send_pane(struct paste_buffer *, struct window_pane *, const char *, int); -- 1.9.1 ------------------------------------------------------------------------------ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users