From 20e1fbce46619cad3bebd5cb09ac9dcef978b936 Mon Sep 17 00:00:00 2001
From: "Chris West (Faux)" <git@goeswhere.com>
Date: Sun, 15 Nov 2015 13:18:16 +0000
Subject: [PATCH] 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.
---
 src/dirlist.c | 4 ++++
 1 file changed, 4 insertions(+)

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;
 
-- 
GitLab