summaryrefslogtreecommitdiffstats
path: root/cmd-list-buffers.c
diff options
context:
space:
mode:
authornicm <nicm>2014-05-13 07:34:35 +0000
committernicm <nicm>2014-05-13 07:34:35 +0000
commit3dbacbb62b033c04185fb87da5b0622f0aafee86 (patch)
treedde33fb1890f249c21d2e5f93943a1e30314f261 /cmd-list-buffers.c
parentf4ffaf5a7fad4c02ad2d08c7b2c80fdec21b64a9 (diff)
Add support for named buffers. If you don't name a buffer, things work
much as before - buffers are automatically named "buffer0000", "buffer0001" and so on and ordered as a stack. Buffers can be named explicitly when creating ("loadb -b foo" etc) or renamed ("setb -b buffer0000 -n foo"). If buffers are named explicitly, they are not deleted when buffer-limit is reached. Diff from J Raynor.
Diffstat (limited to 'cmd-list-buffers.c')
-rw-r--r--cmd-list-buffers.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 2363c806..9d79072e 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -44,17 +44,15 @@ cmd_list_buffers_exec(unused struct cmd *self, struct cmd_q *cmdq)
struct args *args = self->args;
struct paste_buffer *pb;
struct format_tree *ft;
- u_int idx;
char *line;
const char *template;
if ((template = args_get(args, 'F')) == NULL)
template = LIST_BUFFERS_TEMPLATE;
- idx = 0;
- while ((pb = paste_walk_stack(&idx)) != NULL) {
+ pb = NULL;
+ while ((pb = paste_walk(pb)) != NULL) {
ft = format_create();
- format_add(ft, "line", "%u", idx - 1);
format_paste_buffer(ft, pb, 0);
line = format_expand(ft, template);