> Applied with a few changes, thanks

The changes removed a bit of functionality.  If someone does "setb -a
foo", then I believe that "foo" should get appended to what's at
buffer 0, assuming it isn't NULL.  That doesn't happen with the patch
that got applied.

If the removal of that functionality was unintentional, then please
have a look at the attached patch, which adds it back.
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 30a137c..256dc45 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -50,8 +50,10 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
 
 	limit = options_get_number(&global_options, "buffer-limit");
 
+	pb = NULL;
 	psize = 0;
 	pdata = NULL;
+	buffer = -1;
 
 	if (args_has(args, 'b')) {
 		buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);
@@ -65,13 +67,16 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
 			cmdq_error(cmdq, "no buffer %d", buffer);
 			return (CMD_RETURN_ERROR);
 		}
-		if (args_has(args, 'a')) {
-			psize = pb->size;
-			pdata = xmalloc(psize);
-			memcpy(pdata, pb->data, psize);
-		}
-	} else
-		buffer = -1;
+	} else if (args_has(args, 'a')) {
+		if ((pb = paste_get_top(&global_buffers)) != NULL)
+			buffer = 0;
+	}
+
+	if (args_has(args, 'a') && pb != NULL) {
+		psize = pb->size;
+		pdata = xmalloc(psize);
+		memcpy(pdata, pb->data, psize);
+	}
 
 	newsize = strlen(args->argv[0]);
 
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to