forked from enlightenment/terminology
fix "shift + dbl click" used to extend selection to a word.
imho, this feature is useless…
This commit is contained in:
parent
b149052d64
commit
c6af3675de
108
src/bin/termio.c
108
src/bin/termio.c
|
@ -2516,53 +2516,76 @@ static void
|
||||||
_sel_word_to(Evas_Object *obj, int cx, int cy)
|
_sel_word_to(Evas_Object *obj, int cx, int cy)
|
||||||
{
|
{
|
||||||
Termio *sd = evas_object_smart_data_get(obj);
|
Termio *sd = evas_object_smart_data_get(obj);
|
||||||
Termcell *cells;
|
int start_x, start_y, end_x, end_y;
|
||||||
int x, w = 0;
|
|
||||||
if (!sd) return;
|
if (!sd) return;
|
||||||
|
|
||||||
termpty_cellcomp_freeze(sd->pty);
|
start_x = sd->pty->selection.start.x;
|
||||||
cells = termpty_cellrow_get(sd->pty, cy, &w);
|
start_y = sd->pty->selection.start.y;
|
||||||
if (!cells)
|
end_x = sd->pty->selection.end.x;
|
||||||
|
end_y = sd->pty->selection.end.y;
|
||||||
|
|
||||||
|
if (sd->pty->selection.is_box)
|
||||||
{
|
{
|
||||||
termpty_cellcomp_thaw(sd->pty);
|
if (start_y > end_y)
|
||||||
return;
|
INT_SWAP(start_y, end_y);
|
||||||
}
|
if (start_x > end_x)
|
||||||
if (sd->pty->selection.start.x > cx || sd->pty->selection.start.y > cy)
|
INT_SWAP(start_x, end_x);
|
||||||
{
|
if ((cy >= start_y && cy <= end_y) &&
|
||||||
sd->pty->selection.start.x = cx;
|
(cx >= start_x && cx <= end_x))
|
||||||
sd->pty->selection.start.y = cy;
|
|
||||||
for (x = sd->pty->selection.start.x; x >= 0; x--)
|
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
_sel_set(obj, EINA_FALSE);
|
||||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
return;
|
||||||
(x > 0))
|
|
||||||
x--;
|
|
||||||
#endif
|
|
||||||
if (x >= w) break;
|
|
||||||
if (_codepoint_is_wordsep(sd->config, cells[x].codepoint)) break;
|
|
||||||
sd->pty->selection.start.x = x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sd->pty->selection.end.x < cx || sd->pty->selection.end.y < cy)
|
else
|
||||||
{
|
{
|
||||||
sd->pty->selection.end.x = cx;
|
if ((start_y > end_y) ||
|
||||||
sd->pty->selection.end.y = cy;
|
((start_y == end_y) && (end_x < start_x)))
|
||||||
for (x = sd->pty->selection.end.x; x < sd->grid.w; x++)
|
|
||||||
{
|
{
|
||||||
#if defined(SUPPORT_DBLWIDTH)
|
INT_SWAP(start_y, end_y);
|
||||||
if ((cells[x].codepoint == 0) && (cells[x].att.dblwidth) &&
|
INT_SWAP(start_x, end_x);
|
||||||
(x < (sd->grid.w - 1)))
|
}
|
||||||
{
|
if ((cy > start_y || (cy == start_y && cx >= start_x)) &&
|
||||||
sd->pty->selection.end.x = x;
|
(cy < end_y || (cy == end_y && cx <= end_x)))
|
||||||
x++;
|
{
|
||||||
}
|
_sel_set(obj, EINA_FALSE);
|
||||||
#endif
|
return;
|
||||||
if (x >= w) break;
|
|
||||||
if (_codepoint_is_wordsep(sd->config, cells[x].codepoint)) break;
|
|
||||||
sd->pty->selection.end.x = x;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
termpty_cellcomp_thaw(sd->pty);
|
|
||||||
|
_sel_word(obj, cx, cy);
|
||||||
|
|
||||||
|
if (sd->pty->selection.is_box)
|
||||||
|
{
|
||||||
|
start_y = MIN(start_y, sd->pty->selection.start.y);
|
||||||
|
start_x = MIN(start_x, sd->pty->selection.start.x);
|
||||||
|
end_y = MAX(end_y, sd->pty->selection.end.y);
|
||||||
|
end_x = MAX(end_x, sd->pty->selection.end.x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sd->pty->selection.start.y < start_y ||
|
||||||
|
(sd->pty->selection.start.y == start_y &&
|
||||||
|
sd->pty->selection.start.x < start_x))
|
||||||
|
{
|
||||||
|
start_x = sd->pty->selection.start.x;
|
||||||
|
start_y = sd->pty->selection.start.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (sd->pty->selection.end.y > end_y ||
|
||||||
|
(sd->pty->selection.end.y == end_y &&
|
||||||
|
sd->pty->selection.end.x > end_x))
|
||||||
|
{
|
||||||
|
end_x = sd->pty->selection.end.x;
|
||||||
|
end_y = sd->pty->selection.end.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sd->pty->selection.start.x = start_x;
|
||||||
|
sd->pty->selection.start.y = start_y;
|
||||||
|
sd->pty->selection.end.x = end_x;
|
||||||
|
sd->pty->selection.end.y = end_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -3037,7 +3060,7 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
|
||||||
}
|
}
|
||||||
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
else if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
||||||
{
|
{
|
||||||
if (shift)
|
if (shift && sd->pty->selection.is_active)
|
||||||
_sel_word_to(data, cx, cy - sd->scroll);
|
_sel_word_to(data, cx, cy - sd->scroll);
|
||||||
else
|
else
|
||||||
_sel_word(data, cx, cy - sd->scroll);
|
_sel_word(data, cx, cy - sd->scroll);
|
||||||
|
@ -3107,9 +3130,12 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
|
||||||
{
|
{
|
||||||
if (sd->pty->selection.is_active)
|
if (sd->pty->selection.is_active)
|
||||||
{
|
{
|
||||||
_sel_set(data, EINA_FALSE);
|
if (!shift)
|
||||||
sd->didclick = EINA_TRUE;
|
{
|
||||||
sd->pty->selection.makesel = EINA_FALSE;
|
_sel_set(data, EINA_FALSE);
|
||||||
|
sd->didclick = EINA_TRUE;
|
||||||
|
sd->pty->selection.makesel = EINA_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue