]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix fzcd at /, minot refactor
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 31 Mar 2020 16:56:20 +0000 (22:26 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 31 Mar 2020 16:56:20 +0000 (22:26 +0530)
plugins/fzcd
src/nnn.c

index 9e93969c00b198475c09af2badcbf92bfe0a2e29..5e0b5f0958c6e8a9404af3af6aa1eabfa5da1efc 100755 (executable)
@@ -32,5 +32,9 @@ if [ -n "$sel" ]; then
 
     # Remove "./" prefix if it exists
     sel="${sel#./}"
-       nnn_cd "$PWD/$sel"
+    if [ "$PWD" = "/" ]; then
+           nnn_cd "/$sel"
+    else
+           nnn_cd "$PWD/$sel"
+    fi
 fi
index 942d9506323c4567054672b1d61e2b09a2ec00f0..82668827ce6c0ccdb4efc1cfc263a701765945cd 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4617,10 +4617,7 @@ static void populate(char *path, char *lastname)
 
        /* Find cur from history */
        /* No NULL check for lastname, always points to an array */
-       if (!*lastname)
-               move_cursor(0, 0);
-       else
-               move_cursor(dentfind(lastname, ndents), 0);
+       move_cursor(*lastname ? dentfind(lastname, ndents) : 0, 0);
 
        // Force full redraw
        last_curscroll = -1;