From 0f6227f46b1d33476ef448682a2ba0b0290e6d9b Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 2 Jun 2022 20:41:21 +0000 Subject: When deleting or renaming a buffer and a buffer name is specified, complain if the buffer doesn't exist instead of silently deleting or renaming the most recent buffer. GitHub issue 3205. --- cmd-set-buffer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cmd-set-buffer.c') diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index 9112683f..c9ffe5ed 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); -- cgit From ccc9dc3bb49ac258c856d8478346b4ce829b188e Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 9 Jun 2022 09:12:55 +0000 Subject: If an application gives the first parameter to OSC 52, validate and pass on to outside terminal. GitHub issue 3192. --- cmd-set-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd-set-buffer.c') diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index c9ffe5ed..35e72955 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -131,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); } -- cgit