summaryrefslogtreecommitdiffstats
path: root/cmd-set-buffer.c
diff options
context:
space:
mode:
authornicm <nicm>2015-09-14 12:52:22 +0000
committernicm <nicm>2015-09-14 12:52:22 +0000
commit62bb6e37e0bdc2de2a20f7adc38993d2ccfd8c11 (patch)
treeb369002c6701e0e6e2496b9c5e51fecbcd5f7bab /cmd-set-buffer.c
parent216ddf3da5798fe3e7246310ebe0b77e591ee34e (diff)
Should add buffer if no -b.
Diffstat (limited to 'cmd-set-buffer.c')
-rw-r--r--cmd-set-buffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 01afa774..e7f7627e 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -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);