summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris West (Faux) <git@goeswhere.com>2015-11-15 13:18:16 +0000
committerYorhel <git@yorhel.nl>2017-01-06 18:38:52 +0100
commit20e1fbce46619cad3bebd5cb09ac9dcef978b936 (patch)
tree351808fb9b2b7f2b6f3620b485e291dd4fbcf867
parent936a9446a8853cf87d3bfd6e3a998e54825e85de (diff)
chdir to the displayed directory
This isn't necessary for the actual operation of ncdu, but helps tools like screen/tmux open a new terminal in the currently viewed directory, which is what people probably expect.
-rw-r--r--src/dirlist.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dirlist.c b/src/dirlist.c
index 50b90f0..8765503 100644
--- a/src/dirlist.c
+++ b/src/dirlist.c
@@ -189,6 +189,10 @@ static void dirlist_fixup() {
void dirlist_open(struct dir *d) {
dirlist_par = d;
+ /* not necessary for any ncdu functionality,
+ * but enables screen/tmux to work out our cwd */
+ chdir(getpath(dirlist_par));
+
/* set the head of the list */
head_real = head = d == NULL ? NULL : d->sub;