alt + 1,2,3,...8,9,0 switch TO terminal tab # 1, 2, ... 8, 9, 10

This commit is contained in:
Carsten Haitzler 2013-04-18 23:56:12 +09:00
parent 56c13a1bb3
commit 4dd17b80aa
3 changed files with 142 additions and 1 deletions

1
TODO
View File

@ -3,7 +3,6 @@ make it a first-class terminal:
[ ] VT100-compatibilyt: pass all of http://invisible-island.net/vttest/ tests!
[ ] tabs: reordering
[ ] tabs: key bindings for each tab ex) alt + 1, alt + 2, ...
[ ] splits need to size only by steps in font size (elm feature)
[ ] better info in tyls -m
[ ] tyls -b needs doing

View File

@ -1407,6 +1407,78 @@ _cb_icon(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
elm_win_icon_name_set(term->wn->win, termio_icon_name_get(term->term));
}
static void
_tab_go(Term *term, int tnum)
{
Term *term2;
Split *sp = _split_find(term->wn->win, term->term);;
if (!sp) return;
term2 = eina_list_nth(sp->terms, tnum);
if ((!term2) || (term2 == term)) return;
_sel_go(sp, term2);
}
static void
_cb_tab_1(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 0);
}
static void
_cb_tab_2(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 1);
}
static void
_cb_tab_3(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 2);
}
static void
_cb_tab_4(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 3);
}
static void
_cb_tab_5(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 4);
}
static void
_cb_tab_6(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 5);
}
static void
_cb_tab_7(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 6);
}
static void
_cb_tab_8(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 7);
}
static void
_cb_tab_9(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 8);
}
static void
_cb_tab_0(void *data, Evas_Object *obj __UNUSED__, void *event __UNUSED__)
{
_tab_go(data, 9);
}
static Eina_Bool
_cb_cmd_focus(void *data)
{
@ -2077,6 +2149,16 @@ main_term_new(Win *wn, Config *config, const char *cmd,
evas_object_smart_callback_add(o, "split,v", _cb_split_v, term);
evas_object_smart_callback_add(o, "title,change", _cb_title, term);
evas_object_smart_callback_add(o, "icon,change", _cb_icon, term);
evas_object_smart_callback_add(o, "tab,1", _cb_tab_1, term);
evas_object_smart_callback_add(o, "tab,2", _cb_tab_2, term);
evas_object_smart_callback_add(o, "tab,3", _cb_tab_3, term);
evas_object_smart_callback_add(o, "tab,4", _cb_tab_4, term);
evas_object_smart_callback_add(o, "tab,5", _cb_tab_5, term);
evas_object_smart_callback_add(o, "tab,6", _cb_tab_6, term);
evas_object_smart_callback_add(o, "tab,7", _cb_tab_7, term);
evas_object_smart_callback_add(o, "tab,8", _cb_tab_8, term);
evas_object_smart_callback_add(o, "tab,9", _cb_tab_9, term);
evas_object_smart_callback_add(o, "tab,0", _cb_tab_0, term);
evas_object_show(o);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,

View File

@ -1464,6 +1464,66 @@ _smart_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
_paste_selection(data, ELM_SEL_TYPE_PRIMARY);
goto end;
}
else if (!strcmp(ev->keyname, "1"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,1", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "2"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,2", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "3"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,3", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "4"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,4", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "5"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,5", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "6"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,6", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "7"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,7", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "8"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,8", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "9"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,9", NULL);
goto end;
}
else if (!strcmp(ev->keyname, "0"))
{
_compose_seq_reset(sd);
evas_object_smart_callback_call(data, "tab,0", NULL);
goto end;
}
}
if ((evas_key_modifier_is_set(ev->modifiers, "Alt")) &&
(evas_key_modifier_is_set(ev->modifiers, "Control")) &&