summaryrefslogtreecommitdiffstats
path: root/cmd-set-buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-set-buffer.c')
-rw-r--r--cmd-set-buffer.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index 9112683..35e7295 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -69,8 +69,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item)
pb = paste_get_name(bufname);
if (cmd_get_entry(self) == &cmd_delete_buffer_entry) {
- if (pb == NULL)
+ if (pb == NULL) {
+ if (bufname != NULL) {
+ cmdq_error(item, "unknown buffer: %s", bufname);
+ return (CMD_RETURN_ERROR);
+ }
pb = paste_get_top(&bufname);
+ }
if (pb == NULL) {
cmdq_error(item, "no buffer");
return (CMD_RETURN_ERROR);
@@ -80,8 +85,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item)
}
if (args_has(args, 'n')) {
- if (pb == NULL)
+ if (pb == NULL) {
+ if (bufname != NULL) {
+ cmdq_error(item, "unknown buffer: %s", bufname);
+ return (CMD_RETURN_ERROR);
+ }
pb = paste_get_top(&bufname);
+ }
if (pb == NULL) {
cmdq_error(item, "no buffer");
return (CMD_RETURN_ERROR);
@@ -121,7 +131,7 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_ERROR);
}
if (args_has(args, 'w') && tc != NULL)
- tty_set_selection(&tc->tty, bufdata, bufsize);
+ tty_set_selection(&tc->tty, "", bufdata, bufsize);
return (CMD_RETURN_NORMAL);
}