Should add buffer if no -b.

This commit is contained in:
nicm 2015-09-14 12:52:22 +00:00
parent 216ddf3da5
commit 62bb6e37e0

View File

@ -56,11 +56,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
bufname = args_get(args, 'b'); bufname = args_get(args, 'b');
if (bufname == NULL) if (bufname == NULL)
pb = paste_get_top(&bufname); pb = NULL;
else else
pb = paste_get_name(bufname); pb = paste_get_name(bufname);
if (self->entry == &cmd_delete_buffer_entry) { if (self->entry == &cmd_delete_buffer_entry) {
if (pb == NULL)
pb = paste_get_top(&bufname);
if (pb == NULL) { if (pb == NULL) {
cmdq_error(cmdq, "no buffer"); cmdq_error(cmdq, "no buffer");
return (CMD_RETURN_ERROR); 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 (args_has(args, 'n')) {
if (pb == NULL)
pb = paste_get_top(&bufname);
if (pb == NULL) { if (pb == NULL) {
cmdq_error(cmdq, "no buffer"); cmdq_error(cmdq, "no buffer");
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);