Do not consider a selection present if it is empty, from Michael Grant

(GitHub issue 3869). Also a typo fix from GitHub issue 3877.
This commit is contained in:
nicm 2024-03-21 11:26:28 +00:00
parent 8ffd5458ff
commit 0c374868ca
2 changed files with 14 additions and 6 deletions

View File

@ -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) {

View File

@ -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);