summaryrefslogtreecommitdiffstats
path: root/cmd-show-buffer.c
authortcunha <tcunha>2010-12-30 22:39:49 (GMT)
committer tcunha <tcunha>2010-12-30 22:39:49 (GMT)
commitfad6fbe57103d166ff12ff1208b02deacad50799 (patch) (side-by-side diff)
treec1eee875f5752031cf3e33b79f3dd54a65a29845 /cmd-show-buffer.c
parent508e148c5d7fe0bd370b7838434bb4643051ac28 (diff)
downloadtmux-old-fad6fbe57103d166ff12ff1208b02deacad50799.zip
tmux-old-fad6fbe57103d166ff12ff1208b02deacad50799.tar.gz
tmux-old-fad6fbe57103d166ff12ff1208b02deacad50799.tar.bz2
Global paste buffers instead of per-session which renders copy-buffer useless.
As a consequence buffer-limit is now a server option.
Diffstat (limited to 'cmd-show-buffer.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd-show-buffer.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd-show-buffer.c b/cmd-show-buffer.c
index 0d9d9b5..1e70f68 100644
--- a/cmd-show-buffer.c
+++ b/cmd-show-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-show-buffer.c,v 1.12 2009/12/04 22:14:47 tcunha Exp $ */
+/* $Id: cmd-show-buffer.c,v 1.13 2010/12/30 22:39:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -28,7 +28,7 @@ int cmd_show_buffer_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_show_buffer_entry = {
"show-buffer", "showb",
- CMD_BUFFER_SESSION_USAGE,
+ CMD_BUFFER_USAGE,
0, "",
cmd_buffer_init,
cmd_buffer_parse,
@@ -47,20 +47,21 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
size_t size, len;
u_int width;
- if ((s = cmd_find_session(ctx, data->target)) == NULL)
+ if ((s = cmd_find_session(ctx, NULL)) == NULL)
return (-1);
if (data->buffer == -1) {
- if ((pb = paste_get_top(&s->buffers)) == NULL) {
+ if ((pb = paste_get_top(&global_buffers)) == NULL) {
ctx->error(ctx, "no buffers");
return (-1);
}
- } else if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL) {
- ctx->error(ctx, "no buffer %d", data->buffer);
- return (-1);
+ } else {
+ pb = paste_get_index(&global_buffers, data->buffer);
+ if (pb == NULL) {
+ ctx->error(ctx, "no buffer %d", data->buffer);
+ return (-1);
+ }
}
- if (pb == NULL)
- return (0);
size = pb->size;
if (size > SIZE_MAX / 4 - 1)