mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-07-11 11:03:58 -04:00
render: coord_is_selected: handle block selections
This commit is contained in:
parent
d706e68280
commit
cb9ae4f6a1
1 changed files with 22 additions and 8 deletions
14
render.c
14
render.c
|
|
@ -350,6 +350,8 @@ coord_is_selected(const struct terminal *term, int col, int row)
|
|||
|
||||
row += term->grid->view;
|
||||
|
||||
switch (term->selection.kind) {
|
||||
case SELECTION_NORMAL:
|
||||
if (start->row == end->row) {
|
||||
return row == start->row && col >= start->col && col <= end->col;
|
||||
} else {
|
||||
|
|
@ -360,6 +362,18 @@ coord_is_selected(const struct terminal *term, int col, int row)
|
|||
else
|
||||
return row >= start->row && row <= end->row;
|
||||
}
|
||||
|
||||
case SELECTION_BLOCK:
|
||||
if (start->col <= end->col)
|
||||
return row >= start->row && row <= end->row &&
|
||||
col >= start->col && col <= end->col;
|
||||
else
|
||||
return row >= start->row && row <= end->row &&
|
||||
col <= start->col && col >= end->col;
|
||||
}
|
||||
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue