billiob pushed a commit to branch master. http://git.enlightenment.org/apps/terminology.git/commit/?id=eea13ce939d49265772a35a0c1dfe73473b44506
commit eea13ce939d49265772a35a0c1dfe73473b44506 Author: godfath3r <galatsan...@gmail.com> Date: Wed Aug 5 12:40:54 2015 +0300 Don't split terminal endlessly. Summary: Previously terminology would split the terminal as many times as user hit split button/shortcut. Now splitting is limited to only when there are at least 2 cells left. (horizontally or vertically) Also Fixes T2638 Reviewers: billiob Maniphest Tasks: T2638 Differential Revision: https://phab.enlightenment.org/D2915 --- src/bin/win.c | 88 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 31 deletions(-) diff --git a/src/bin/win.c b/src/bin/win.c index 0225953..35a3887 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -910,6 +910,26 @@ _win_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED, elm_win_title_set(wn->win, title); } +Eina_Bool +_win_term_is_splittable(Term *tm, Eina_Bool is_horizontal) +{ + int grid_w = 0, grid_h = 0, c_w = 0, c_h = 0; + evas_object_geometry_get(tm->bg, NULL, NULL, &grid_w, &grid_h); + evas_object_textgrid_cell_size_get(termio_textgrid_get(tm->termio), + &c_w, &c_h); + if (is_horizontal) + { + if (c_h * 2 > grid_h) + return EINA_FALSE; + } + else + { + if (c_w * 2 > grid_w) + return EINA_FALSE; + } + return EINA_TRUE; +} + static void _win_split(Term_Container *tc, Term_Container *child, const char *cmd, Eina_Bool is_horizontal) @@ -925,22 +945,25 @@ _win_split(Term_Container *tc, Term_Container *child, const char *cmd, wn = (Win*) tc; tm = tc->focused_term_get(tc); - if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf))) - wdir = buf; - tm_new = term_new(wn, wn->config, - cmd, wn->config->login_shell, wdir, - 80, 24, EINA_FALSE); - tc_solo_new = _solo_new(tm_new, wn); - evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio); - - base = win_base_get(wn); - o = child->get_evas_object(child); - edje_object_part_unswallow(base, o); + if (_win_term_is_splittable(tm, is_horizontal)) + { + if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf))) + wdir = buf; + tm_new = term_new(wn, wn->config, + cmd, wn->config->login_shell, wdir, + 80, 24, EINA_FALSE); + tc_solo_new = _solo_new(tm_new, wn); + evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio); + + base = win_base_get(wn); + o = child->get_evas_object(child); + edje_object_part_unswallow(base, o); - tc_split = _split_new(child, tc_solo_new, is_horizontal); + tc_split = _split_new(child, tc_solo_new, is_horizontal); - tc_split->is_focused = tc->is_focused; - tc->swallow(tc, NULL, tc_split); + tc_split->is_focused = tc->is_focused; + tc->swallow(tc, NULL, tc_split); + } } static void @@ -1399,27 +1422,30 @@ _split_split(Term_Container *tc, Term_Container *child, wn = tc->wn; tm = child->focused_term_get(child); - if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf))) - wdir = buf; - tm_new = term_new(wn, wn->config, - cmd, wn->config->login_shell, wdir, - 80, 24, EINA_FALSE); - tc_solo_new = _solo_new(tm_new, wn); - evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio); - - if (child == split->tc1) - elm_object_part_content_unset(split->panes, PANES_TOP); - else - elm_object_part_content_unset(split->panes, PANES_BOTTOM); + if (_win_term_is_splittable(tm, is_horizontal)) + { + if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf))) + wdir = buf; + tm_new = term_new(wn, wn->config, + cmd, wn->config->login_shell, wdir, + 80, 24, EINA_FALSE); + tc_solo_new = _solo_new(tm_new, wn); + evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio); + + if (child == split->tc1) + elm_object_part_content_unset(split->panes, PANES_TOP); + else + elm_object_part_content_unset(split->panes, PANES_BOTTOM); - tc_split = _split_new(child, tc_solo_new, is_horizontal); + tc_split = _split_new(child, tc_solo_new, is_horizontal); - obj_split = tc_split->get_evas_object(tc_split); + obj_split = tc_split->get_evas_object(tc_split); - tc_split->is_focused = tc->is_focused; - tc->swallow(tc, child, tc_split); + tc_split->is_focused = tc->is_focused; + tc->swallow(tc, child, tc_split); - evas_object_show(obj_split); + evas_object_show(obj_split); + } } static Term_Container * --