summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-18 23:56:12 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-04-18 23:56:12 +0900
commit4dd17b80aa90bb55c4b48272c93c6a12dff8ec42 (patch)
treeda4dab3caa075def1c7b11a513a5235a1e92778e
parent56c13a1bb31290a2065426d862f33f680c3d5c23 (diff)
alt + 1,2,3,...8,9,0 switch TO terminal tab # 1, 2, ... 8, 9, 10
-rw-r--r--TODO1
-rw-r--r--src/bin/main.c82
-rw-r--r--src/bin/termio.c60
3 files changed, 142 insertions, 1 deletions
diff --git a/TODO b/TODO
index 70593af..835746c 100644
--- a/TODO
+++ b/TODO
@@ -3,7 +3,6 @@ make it a first-class terminal:
3 3
4[ ] VT100-compatibilyt: pass all of http://invisible-island.net/vttest/ tests! 4[ ] VT100-compatibilyt: pass all of http://invisible-island.net/vttest/ tests!
5[ ] tabs: reordering 5[ ] tabs: reordering
6[ ] tabs: key bindings for each tab ex) alt + 1, alt + 2, ...
7[ ] splits need to size only by steps in font size (elm feature) 6[ ] splits need to size only by steps in font size (elm feature)
8[ ] better info in tyls -m 7[ ] better info in tyls -m
9[ ] tyls -b needs doing 8[ ] tyls -b needs doing
diff --git a/src/bin/main.c b/src/bin/main.c
index 5280744..aeafc79 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1407,6 +1407,78 @@ _cb_icon(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1407 elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->term)); 1407 elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->term));
1408} 1408}
1409 1409
1410static void
1411_tab_go(Term *term, int tnum)
1412{
1413 Term *term2;
1414 Split *sp = _split_find(term->wn->win, term->term);;
1415 if (!sp) return;
1416
1417 term2 = eina_list_nth(sp->terms, tnum);
1418 if ((!term2) || (term2 == term)) return;
1419 _sel_go(sp, term2);
1420}
1421
1422static void
1423_cb_tab_1(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1424{
1425 _tab_go(data, 0);
1426}
1427
1428static void
1429_cb_tab_2(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1430{
1431 _tab_go(data, 1);
1432}
1433
1434static void
1435_cb_tab_3(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1436{
1437 _tab_go(data, 2);
1438}
1439
1440static void
1441_cb_tab_4(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1442{
1443 _tab_go(data, 3);
1444}
1445
1446static void
1447_cb_tab_5(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1448{
1449 _tab_go(data, 4);
1450}
1451
1452static void
1453_cb_tab_6(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1454{
1455 _tab_go(data, 5);
1456}
1457
1458static void
1459_cb_tab_7(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1460{
1461 _tab_go(data, 6);
1462}
1463
1464static void
1465_cb_tab_8(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1466{
1467 _tab_go(data, 7);
1468}
1469
1470static void
1471_cb_tab_9(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1472{
1473 _tab_go(data, 8);
1474}
1475
1476static void
1477_cb_tab_0(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
1478{
1479 _tab_go(data, 9);
1480}
1481
1410static Eina_Bool 1482static Eina_Bool
1411_cb_cmd_focus(void *data) 1483_cb_cmd_focus(void *data)
1412{ 1484{
@@ -2077,6 +2149,16 @@ main_term_new(Win *wn, Config *config, const char *cmd,
2077 evas_object_smart_callback_add(o, "split,v", _cb_split_v, term); 2149 evas_object_smart_callback_add(o, "split,v", _cb_split_v, term);
2078 evas_object_smart_callback_add(o, "title,change", _cb_title, term); 2150 evas_object_smart_callback_add(o, "title,change", _cb_title, term);
2079 evas_object_smart_callback_add(o, "icon,change", _cb_icon, term); 2151 evas_object_smart_callback_add(o, "icon,change", _cb_icon, term);
2152 evas_object_smart_callback_add(o, "tab,1", _cb_tab_1, term);
2153 evas_object_smart_callback_add(o, "tab,2", _cb_tab_2, term);
2154 evas_object_smart_callback_add(o, "tab,3", _cb_tab_3, term);
2155 evas_object_smart_callback_add(o, "tab,4", _cb_tab_4, term);
2156 evas_object_smart_callback_add(o, "tab,5", _cb_tab_5, term);
2157 evas_object_smart_callback_add(o, "tab,6", _cb_tab_6, term);
2158 evas_object_smart_callback_add(o, "tab,7", _cb_tab_7, term);
2159 evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term);
2160 evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term);
2161 evas_object_smart_callback_add(o, "tab,0", _cb_tab_0, term);
2080 evas_object_show(o); 2162 evas_object_show(o);
2081 2163
2082 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, 2164 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 4df0dc9..db4af00 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -1464,6 +1464,66 @@ _smart_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
1464 _paste_selection(data, ELM_SEL_TYPE_PRIMARY); 1464 _paste_selection(data, ELM_SEL_TYPE_PRIMARY);
1465 goto end; 1465 goto end;
1466 } 1466 }
1467 else if (!strcmp(ev->keyname, "1"))
1468 {
1469 _compose_seq_reset(sd);
1470 evas_object_smart_callback_call(data, "tab,1", NULL);
1471 goto end;
1472 }
1473 else if (!strcmp(ev->keyname, "2"))
1474 {
1475 _compose_seq_reset(sd);
1476 evas_object_smart_callback_call(data, "tab,2", NULL);
1477 goto end;
1478 }
1479 else if (!strcmp(ev->keyname, "3"))
1480 {
1481 _compose_seq_reset(sd);
1482 evas_object_smart_callback_call(data, "tab,3", NULL);
1483 goto end;
1484 }
1485 else if (!strcmp(ev->keyname, "4"))
1486 {
1487 _compose_seq_reset(sd);
1488 evas_object_smart_callback_call(data, "tab,4", NULL);
1489 goto end;
1490 }
1491 else if (!strcmp(ev->keyname, "5"))
1492 {
1493 _compose_seq_reset(sd);
1494 evas_object_smart_callback_call(data, "tab,5", NULL);
1495 goto end;
1496 }
1497 else if (!strcmp(ev->keyname, "6"))
1498 {
1499 _compose_seq_reset(sd);
1500 evas_object_smart_callback_call(data, "tab,6", NULL);
1501 goto end;
1502 }
1503 else if (!strcmp(ev->keyname, "7"))
1504 {
1505 _compose_seq_reset(sd);
1506 evas_object_smart_callback_call(data, "tab,7", NULL);
1507 goto end;
1508 }
1509 else if (!strcmp(ev->keyname, "8"))
1510 {
1511 _compose_seq_reset(sd);
1512 evas_object_smart_callback_call(data, "tab,8", NULL);
1513 goto end;
1514 }
1515 else if (!strcmp(ev->keyname, "9"))
1516 {
1517 _compose_seq_reset(sd);
1518 evas_object_smart_callback_call(data, "tab,9", NULL);
1519 goto end;
1520 }
1521 else if (!strcmp(ev->keyname, "0"))
1522 {
1523 _compose_seq_reset(sd);
1524 evas_object_smart_callback_call(data, "tab,0", NULL);
1525 goto end;
1526 }
1467 } 1527 }
1468 if ((evas_key_modifier_is_set(ev->modifiers, "Alt")) && 1528 if ((evas_key_modifier_is_set(ev->modifiers, "Alt")) &&
1469 (evas_key_modifier_is_set(ev->modifiers, "Control")) && 1529 (evas_key_modifier_is_set(ev->modifiers, "Control")) &&