summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-01-18 21:36:52 +0100
committerBoris Faure <billiob@gmail.com>2015-02-06 20:48:03 +0100
commitd18a47c5c6e3a58994761bd6b0477f07c1db4c6c (patch)
tree2d43ce8625cc662ed77e9846f85617e39de70d6a /src
parentda474a4c68e3dbad2a6bf9a84741618ad610cad5 (diff)
selection: be able to "continue" a selection to a line with shift+triple-click
Diffstat (limited to 'src')
-rw-r--r--src/bin/termio.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 5622396..e95f6a7 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -2345,6 +2345,65 @@ _sel_line(Termio *sd, int cy)
2345 termpty_cellcomp_thaw(sd->pty); 2345 termpty_cellcomp_thaw(sd->pty);
2346} 2346}
2347 2347
2348static void
2349_sel_line_to(Termio *sd, int cy)
2350{
2351 int start_y, end_y;
2352
2353 EINA_SAFETY_ON_NULL_RETURN(sd);
2354
2355 start_y = sd->pty->selection.start.y;
2356 end_y = sd->pty->selection.end.y;
2357
2358 if (sd->pty->selection.is_box)
2359 {
2360 if (start_y > end_y)
2361 INT_SWAP(start_y, end_y);
2362 if (cy > start_y && cy < end_y)
2363 {
2364 _sel_set(sd, EINA_FALSE);
2365 return;
2366 }
2367 }
2368 else
2369 {
2370 if (start_y >= end_y)
2371 {
2372 INT_SWAP(start_y, end_y);
2373 }
2374 if ((cy > start_y) && (cy < end_y))
2375 {
2376 _sel_set(sd, EINA_FALSE);
2377 return;
2378 }
2379 }
2380
2381 _sel_line(sd, cy);
2382
2383 if (sd->pty->selection.is_box)
2384 {
2385 start_y = MIN(start_y, sd->pty->selection.start.y);
2386 end_y = MAX(end_y, sd->pty->selection.end.y);
2387 }
2388 else
2389 {
2390 if (sd->pty->selection.start.y <= start_y)
2391 {
2392 start_y = sd->pty->selection.start.y;
2393 }
2394 else
2395 if (sd->pty->selection.end.y >= end_y)
2396 {
2397 end_y = sd->pty->selection.end.y;
2398 }
2399 }
2400
2401 sd->pty->selection.start.x = 0;
2402 sd->pty->selection.end.x = sd->grid.w - 1;
2403 sd->pty->selection.start.y = start_y;
2404 sd->pty->selection.end.y = end_y;
2405}
2406
2348static Eina_Bool 2407static Eina_Bool
2349_codepoint_is_wordsep(const Eina_Unicode g) 2408_codepoint_is_wordsep(const Eina_Unicode g)
2350{ 2409{
@@ -3323,7 +3382,10 @@ _smart_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS
3323 { 3382 {
3324 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK) 3383 if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
3325 { 3384 {
3326 _sel_line(sd, cy - sd->scroll); 3385 if (shift && sd->pty->selection.is_active)
3386 _sel_line_to(sd, cy - sd->scroll);
3387 else
3388 _sel_line(sd, cy - sd->scroll);
3327 if (sd->pty->selection.is_active) 3389 if (sd->pty->selection.is_active)
3328 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY); 3390 termio_take_selection(data, ELM_SEL_TYPE_PRIMARY);
3329 sd->didclick = EINA_TRUE; 3391 sd->didclick = EINA_TRUE;