aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/win.c
diff options
context:
space:
mode:
authorStanislav Baiduzhyi <baiduzhyi.devel@gmail.com>2015-12-26 11:59:08 +0100
committerBoris Faure <billiob@gmail.com>2015-12-26 12:07:55 +0100
commit33d20a1f988a31b66622ee33bedca585d2ebaa51 (patch)
treeb8e032b6d810d1c4d4f27a63b6d17f59cc340e1a /src/bin/win.c
parentPassing KP_ keys to pty (diff)
downloadterminology-33d20a1f988a31b66622ee33bedca585d2ebaa51.tar.gz
Option to disable cd to current tab dir.
Summary: Adding option to disable cd to current tab dir. Test Plan: 1. Start unpatched version of Terminology. 2. Change some Behaviour options. 3. Close unpatched version of Terminology. 4. Start patched version of Terminology. 5. cd /usr/bin 6. Open new tab and verify that previous behaviour persists, new tab working directory is /usr/bin 7. Go to Settings Behaviour and uncheck "Start in the same directory..." checkbox. 8. Optn new tab and verify that new tab working directory is ~ (or any other directory from which the Terminology was launched). 9. Restart Terminology. 10. Go to Settings Behaviour and verify that options persisted. Reviewers: #terminology, billiob Subscribers: godfath3r, #terminology Projects: #terminology Differential Revision: https://phab.enlightenment.org/D3495
Diffstat (limited to 'src/bin/win.c')
-rw-r--r--src/bin/win.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/bin/win.c b/src/bin/win.c
index 23873d8..640d136 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -952,16 +952,22 @@ _win_split(Term_Container *tc, Term_Container *child,
{
Term *tm_new, *tm;
Term_Container *tc_split, *tc_solo_new;
- char buf[PATH_MAX], *wdir = NULL;
+ char *wdir = NULL;
Evas_Object *base;
Evas_Object *o;
- if (from)
- tm = from;
- else
- tm = tc->focused_term_get(tc);
- if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf)))
- wdir = buf;
+ // copy the current path to wdir if we should change the directory,
+ // passing wdir NULL otherwise:
+ if (wn->config->changedir_to_current)
+ {
+ if (from)
+ tm = from;
+ else
+ tm = tc->focused_term_get(tc);
+ char buf[PATH_MAX];
+ 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);
@@ -1438,16 +1444,22 @@ _split_split(Term_Container *tc, Term_Container *child,
if (_term_container_is_splittable(tc, is_horizontal))
{
Term *tm_new, *tm;
- char buf[PATH_MAX], *wdir = NULL;
+ char *wdir = NULL;
Term_Container *tc_split, *tc_solo_new;
Evas_Object *obj_split;
- if (from)
- tm = from;
- else
- tm = child->focused_term_get(child);
- if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf)))
- wdir = buf;
+ // copy the current path to wdir if we should change the directory,
+ // passing wdir NULL otherwise:
+ if (wn->config->changedir_to_current)
+ {
+ if (from)
+ tm = from;
+ else
+ tm = child->focused_term_get(child);
+ char buf[PATH_MAX];
+ 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);
@@ -2326,11 +2338,18 @@ _tab_new_cb(void *data,
*tc_new, *tc_parent, *tc_old;
Term *tm, *tm_new;
Win *wn = tc->wn;
- char buf[PATH_MAX], *wdir = NULL;
+ char *wdir = NULL;
+
+ // copy the current path to wdir if we should change the directory,
+ // passing wdir NULL otherwise:
+ if (wn->config->changedir_to_current)
+ {
+ char buf[PATH_MAX];
+ tm = tc->focused_term_get(tc);
+ if (tm && termio_cwd_get(tm->termio, buf, sizeof(buf)))
+ wdir = buf;
+ }
- 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,
NULL, wn->config->login_shell, wdir,
80, 24, EINA_FALSE);