diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-03-21 11:26:29 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-03-21 11:26:29 +0000 |
commit | 2ecc76932a8afada506680e5617a5b414b137176 (patch) | |
tree | 622ed1bd18bf0ca0760aeb7d46fd755bdb44ce63 /usr.bin/tmux | |
parent | 0f62e293c9da7b3ec29ef5a35a9b6f35b53bbc4f (diff) |
Do not consider a selection present if it is empty, from Michael Grant
(GitHub issue 3869). Also a typo fix from GitHub issue 3877.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-detach-client.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/screen.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/window-copy.c | 20 |
3 files changed, 24 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-detach-client.c b/usr.bin/tmux/cmd-detach-client.c index 5b190e56afa..ed4d3f3cdef 100644 --- a/usr.bin/tmux/cmd-detach-client.c +++ b/usr.bin/tmux/cmd-detach-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-detach-client.c,v 1.36 2021/08/21 10:22:38 nicm Exp $ */ +/* $OpenBSD: cmd-detach-client.c,v 1.37 2024/03/21 11:26:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -59,6 +59,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item) { struct args *args = cmd_get_args(self); struct cmd_find_state *source = cmdq_get_source(item); + struct client *c = cmdq_get_client(item); struct client *tc = cmdq_get_target_client(item), *loop; struct session *s; enum msgtype msgtype; @@ -101,9 +102,13 @@ cmd_detach_client_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_NORMAL); } - if (cmd != NULL) + if (cmd != NULL) { + if (c == NULL || c->session == NULL) { + cmdq_error(item, "must be attached for -E"); + return (CMD_RETURN_ERROR); + } server_client_exec(tc, cmd); - else + } else server_client_detach(tc, msgtype); return (CMD_RETURN_STOP); } diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index b70ed6ea241..ff73a8c4e72 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.84 2023/12/27 20:17:13 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.85 2024/03/21 11:26:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -384,7 +384,7 @@ screen_resize_y(struct screen *s, u_int sy, int eat_empty, u_int *cy) /* * Try to pull as much as possible out of scrolled history, if - * is is enabled. + * it is enabled. */ available = gd->hscrolled; if (gd->flags & GRID_HISTORY && available > 0) { diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index 2dd99423282..913f3510333 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.345 2023/11/02 10:38:14 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.346 2024/03/21 11:26:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -795,16 +795,24 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft) format_add(ft, "copy_cursor_x", "%d", data->cx); format_add(ft, "copy_cursor_y", "%d", data->cy); - format_add(ft, "selection_present", "%d", data->screen.sel != NULL); if (data->screen.sel != NULL) { format_add(ft, "selection_start_x", "%d", data->selx); format_add(ft, "selection_start_y", "%d", data->sely); format_add(ft, "selection_end_x", "%d", data->endselx); format_add(ft, "selection_end_y", "%d", data->endsely); - format_add(ft, "selection_active", "%d", - data->cursordrag != CURSORDRAG_NONE); - } else - format_add(ft, "selection_active", "%d", 0); + + if (data->cursordrag != CURSORDRAG_NONE) + format_add(ft, "selection_active", "1"); + else + format_add(ft, "selection_active", "0"); + if (data->endselx != data->selx && data->endsely != data->sely) + format_add(ft, "selection_present", "1"); + else + format_add(ft, "selection_present", "0"); + } else { + format_add(ft, "selection_active", "0"); + format_add(ft, "selection_present", "0"); + } format_add(ft, "search_present", "%d", data->searchmark != NULL); format_add_cb(ft, "search_match", window_copy_search_match_cb); |