From: Arun Prakash Jana Date: Tue, 31 Mar 2020 16:56:20 +0000 (+0530) Subject: Fix fzcd at /, minot refactor X-Git-Tag: v3.1~39 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c01857cddbc18798571f6d382e01e842684a491a;p=nnn.git Fix fzcd at /, minot refactor --- diff --git a/plugins/fzcd b/plugins/fzcd index 9e93969c..5e0b5f09 100755 --- a/plugins/fzcd +++ b/plugins/fzcd @@ -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 diff --git a/src/nnn.c b/src/nnn.c index 942d9506..82668827 100644 --- 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;