]> Sergey Matveev's repositories - nnn.git/commitdiff
Keep lastname directory selected
author0xACE <0xaced@gmail.com>
Fri, 12 Jul 2019 12:55:03 +0000 (14:55 +0200)
committer0xACE <0xaced@gmail.com>
Fri, 12 Jul 2019 12:55:03 +0000 (14:55 +0200)
incase the user just lost access, it would be better to remember the
selected directory to keep it highlighted.

src/nnn.c

index 4bcc55bdd3f6b8dc2f71f2bd636f5690c7e69503..bb2e28588a613bbe0890b564cec9590807c2f7e2 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3301,6 +3301,9 @@ nochange:
                if (access(path, F_OK)) {
                        DPRINTF_S("dir deleted or moved");
 
+                       /* Save history */
+                       xstrlcpy(lastname, xbasename(path), NAME_MAX + 1);
+
                        xstrlcpy(newpath, path, PATH_MAX);
                        while (true) {
                                dir = visit_parent(path, newpath, &presel);