summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2024-03-21 11:26:28 +0000
committernicm <nicm>2024-03-21 11:26:28 +0000
commit0c374868ca34cef826e15e7984300f0292b314d8 (patch)
treea5187fed91769286ceb3d04c542d25a050717e05
parent8ffd5458ff850ae556069ed61ec111cefa0a31ea (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.
-rw-r--r--screen.c2
-rw-r--r--window-copy.c18
2 files changed, 14 insertions, 6 deletions
diff --git a/screen.c b/screen.c
index 267a50b9..de072d1a 100644
--- a/screen.c
+++ b/screen.c
@@ -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/window-copy.c b/window-copy.c
index bc3713b0..2ca5d961 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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);