summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-09-14 12:52:23 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-09-14 12:52:23 +0000
commite5fa8e77bc4e9d2b79bac5edd5bd3d7ad49f7bb4 (patch)
treeb49ba0cdd81ab1316e632ba890104db51bd59fb7
parent9f155d7e900272c5427dfacc3977f020b6d6a185 (diff)
Should add buffer if no -b.
-rw-r--r--usr.bin/tmux/cmd-set-buffer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-set-buffer.c b/usr.bin/tmux/cmd-set-buffer.c
index d68f01f64b0..78468cbb503 100644
--- a/usr.bin/tmux/cmd-set-buffer.c
+++ b/usr.bin/tmux/cmd-set-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-buffer.c,v 1.22 2015/09/11 14:41:50 nicm Exp $ */
+/* $OpenBSD: cmd-set-buffer.c,v 1.23 2015/09/14 12:52:22 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -56,11 +56,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
bufname = args_get(args, 'b');
if (bufname == NULL)
- pb = paste_get_top(&bufname);
+ pb = NULL;
else
pb = paste_get_name(bufname);
if (self->entry == &cmd_delete_buffer_entry) {
+ if (pb == NULL)
+ pb = paste_get_top(&bufname);
if (pb == NULL) {
cmdq_error(cmdq, "no buffer");
return (CMD_RETURN_ERROR);
@@ -70,6 +72,8 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
}
if (args_has(args, 'n')) {
+ if (pb == NULL)
+ pb = paste_get_top(&bufname);
if (pb == NULL) {
cmdq_error(cmdq, "no buffer");
return (CMD_RETURN_ERROR);