fix selection going up/left

This commit is contained in:
Boris Faure 2013-10-10 22:27:16 +02:00
parent 1dc0d30b60
commit 4a9e61cb2e
1 changed files with 42 additions and 3 deletions

View File

@ -1541,8 +1541,8 @@ _smart_apply(Evas_Object *obj)
start_x = sd->pty->selection.start.x;
start_y = sd->pty->selection.start.y;
end_x = sd->pty->selection.end.x;
end_y = sd->pty->selection.end.y;
end_x = sd->pty->selection.end.x;
end_y = sd->pty->selection.end.y;
if (sd->pty->selection.is_box)
{
@ -3254,11 +3254,50 @@ _smart_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
sd->pty->selection.start.x = cx;
sd->pty->selection.start.y = cy - sd->scroll;
}
else
else if (sd->bottom_right)
{
sd->pty->selection.end.x = cx;
sd->pty->selection.end.y = cy - sd->scroll;
}
else
{
int start_x, start_y, end_x, end_y;
start_x = sd->pty->selection.start.x;
start_y = sd->pty->selection.start.y;
end_x = sd->pty->selection.end.x;
end_y = sd->pty->selection.end.y;
if (sd->pty->selection.is_box)
{
if (start_y > end_y)
{
INT_SWAP(start_y, end_y);
}
if (start_x > end_x)
INT_SWAP(start_x, end_x);
}
else
{
if ((start_y > end_y) ||
((start_y == end_y) && (end_x < start_x)))
{
INT_SWAP(start_y, end_y);
INT_SWAP(start_x, end_x);
}
}
cy -= sd->scroll;
if (cy < start_y || (cy == start_y && cx <= start_x)) {
sd->top_left = EINA_TRUE;
sd->pty->selection.start.x = cx;
sd->pty->selection.start.y = cy;
} else if (cy > end_y || (cy == end_y && cx > end_x)) {
sd->bottom_right = EINA_TRUE;
sd->pty->selection.end.x = cx;
sd->pty->selection.end.y = cy;
}
}
#if defined(SUPPORT_DBLWIDTH)
_selection_dbl_fix(data);
#endif