Buffers should be numbered from zero, from Tiago Cunha. Also fix paste -b.

This commit is contained in:
Nicholas Marriott 2009-01-07 19:52:36 +00:00
parent 8810fc158c
commit 51ca51e329
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-list-buffers.c,v 1.4 2008-09-26 06:45:25 nicm Exp $ */
/* $Id: cmd-list-buffers.c,v 1.5 2009-01-07 19:52:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -79,7 +79,7 @@ cmd_list_buffers_exec(struct cmd *self, struct cmd_ctx *ctx)
}
ctx->print(ctx, "%d: "
"%zu bytes: \"%s\"", idx, strlen(pb->data), tmp);
"%zu bytes: \"%s\"", idx - 1, strlen(pb->data), tmp);
} else
ctx->print(ctx, "%d: %zu bytes", idx, strlen(pb->data));
}

View File

@ -1,4 +1,4 @@
/* $Id: cmd-paste-buffer.c,v 1.11 2008-06-20 18:58:13 nicm Exp $ */
/* $Id: cmd-paste-buffer.c,v 1.12 2009-01-07 19:52:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -55,7 +55,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
if (data->buffer == -1)
pb = paste_get_top(&s->buffers);
else {
if ((pb = paste_get_top(&s->buffers)) == NULL)
if ((pb = paste_get_index(&s->buffers, data->buffer)) == NULL)
ctx->error(ctx, "no buffer %d", data->buffer);
}