Merge branch 'fix-upwards-selection-clearing' of https://github.com/Luflosi/kitty into master

This commit is contained in:
Kovid Goyal 2020-10-14 05:31:08 +05:30
commit 8a90ed70ee
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
:opt:`window_margin_width` and keeping :opt:`draw_minimal_borders` on :opt:`window_margin_width` and keeping :opt:`draw_minimal_borders` on
(:iss:`3017`) (:iss:`3017`)
- Fix selections created by dragging upwards not being auto-cleared when
screen contents change (:pull:`3028`)
0.19.1 [2020-10-06] 0.19.1 [2020-10-06]
------------------- -------------------

View File

@ -373,8 +373,10 @@ selection_has_screen_line(const Selections *selections, const int y) {
for (size_t i = 0; i < selections->count; i++) { for (size_t i = 0; i < selections->count; i++) {
const Selection *s = selections->items + i; const Selection *s = selections->items + i;
if (!is_selection_empty(s)) { if (!is_selection_empty(s)) {
int top = (int)s->start.y - s->start_scrolled_by; int start = (int)s->start.y - s->start_scrolled_by;
int bottom = (int)s->end.y - s->end_scrolled_by; int end = (int)s->end.y - s->end_scrolled_by;
int top = MIN(start, end);
int bottom = MAX(start, end);
if (top <= y && y <= bottom) return true; if (top <= y && y <= bottom) return true;
} }
} }