mirror of
https://github.com/tmux/tmux.git
synced 2025-01-09 01:28:49 +00:00
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.
This commit is contained in:
parent
201a8d8e7e
commit
0f6227f46b
@ -69,8 +69,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
pb = paste_get_name(bufname);
|
pb = paste_get_name(bufname);
|
||||||
|
|
||||||
if (cmd_get_entry(self) == &cmd_delete_buffer_entry) {
|
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);
|
pb = paste_get_top(&bufname);
|
||||||
|
}
|
||||||
if (pb == NULL) {
|
if (pb == NULL) {
|
||||||
cmdq_error(item, "no buffer");
|
cmdq_error(item, "no buffer");
|
||||||
return (CMD_RETURN_ERROR);
|
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 (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);
|
pb = paste_get_top(&bufname);
|
||||||
|
}
|
||||||
if (pb == NULL) {
|
if (pb == NULL) {
|
||||||
cmdq_error(item, "no buffer");
|
cmdq_error(item, "no buffer");
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
|
Loading…
Reference in New Issue
Block a user