named buffers. GitHub issue 3212 from David le Blanc.
-/* $OpenBSD: cmd-choose-tree.c,v 1.50 2021/08/27 17:25:55 nicm Exp $ */
+/* $OpenBSD: cmd-choose-tree.c,v 1.51 2022/06/04 07:42:07 nicm Exp $ */
/*
* Copyright (c) 2012 Thomas Adam <thomas@xteddy.org>
const struct window_mode *mode;
if (cmd_get_entry(self) == &cmd_choose_buffer_entry) {
- if (paste_get_top(NULL) == NULL)
+ if (paste_is_empty())
return (CMD_RETURN_NORMAL);
mode = &window_buffer_mode;
} else if (cmd_get_entry(self) == &cmd_choose_client_entry) {
-/* $OpenBSD: paste.c,v 1.42 2020/05/16 15:35:19 nicm Exp $ */
+/* $OpenBSD: paste.c,v 1.43 2022/06/04 07:42:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
return (RB_NEXT(paste_time_tree, &paste_by_time, pb));
}
+int
+paste_is_empty(void)
+{
+ return RB_ROOT(&paste_by_time) == NULL;
+}
+
/* Get the most recent automatic buffer. */
struct paste_buffer *
paste_get_top(const char **name)
struct paste_buffer *pb;
pb = RB_MIN(paste_time_tree, &paste_by_time);
+ while (pb != NULL && !pb->automatic)
+ pb = RB_NEXT(paste_time_tree, &paste_by_time, pb);
if (pb == NULL)
return (NULL);
if (name != NULL)
-/* $OpenBSD: tmux.h,v 1.1170 2022/05/30 13:02:55 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1171 2022/06/04 07:42:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
time_t paste_buffer_created(struct paste_buffer *);
const char *paste_buffer_data(struct paste_buffer *, size_t *);
struct paste_buffer *paste_walk(struct paste_buffer *);
+int paste_is_empty(void);
struct paste_buffer *paste_get_top(const char **);
struct paste_buffer *paste_get_name(const char *);
void paste_free(struct paste_buffer *);