The branch, master has been updated
       via  9880114aff0b48649f00266125da1dc3c94a70eb (commit)
      from  3625bcba24b2cfeaa2c3d1728933dcc9c04ff4bc (commit)

- Log -----------------------------------------------------------------
commit 9880114aff0b48649f00266125da1dc3c94a70eb
Author: Nicholas Marriott <nicholas.marri...@gmail.com>
Commit: Nicholas Marriott <nicholas.marri...@gmail.com>

    Make -a append to top buffer if -b is not specified.
---
 cmd-set-buffer.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 30a137c..0e754bb 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -53,6 +53,9 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
        psize = 0;
        pdata = NULL;
 
+       pb = NULL;
+       buffer = -1;
+
        if (args_has(args, 'b')) {
                buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);
                if (cause != NULL) {
@@ -65,13 +68,17 @@ 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')) {
+               pb = paste_get_top(&global_buffers);
+               if (pb != 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]);
 


-----------------------------------------------------------------------

Summary of changes:
 cmd-set-buffer.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
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-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to