From 36ae4b82508e75b83f98b204582ae9d892c6c29f Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Fri, 10 Apr 2020 18:32:28 +0530 Subject: Hover on dir and connect remote --- src/nnn.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nnn.c b/src/nnn.c index 4d9ed0b..6e920b1 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -539,7 +539,7 @@ static const char * const messages[] = { "overwrite?", "'s'ave / 'l'oad / 'r'estore?", "Quit all contexts?", - "remote name: ", + "remote name ('-' for hovered): ", "archive name: ", "open with: ", "relative path: ", @@ -3892,7 +3892,7 @@ static bool archive_mount(char *path, char *newpath) return TRUE; } -static bool remote_mount(char *newpath) +static bool remote_mount(char *newpath, char *currentpath) { uchar flag = F_CLI; int opt; @@ -3928,6 +3928,15 @@ static bool remote_mount(char *newpath) return FALSE; } + if (tmp[0] == '-' && !tmp[1]) { + if (!strcmp(cfgdir, currentpath) && ndents && (dents[cur].flags & DIR_OR_LINK_TO_DIR)) + xstrlcpy(tmp, dents[cur].name, NAME_MAX + 1); + else { + printmsg(messages[MSG_FAILED]); + return FALSE; + } + } + /* Create the mount point */ mkpath(cfgdir, tmp, newpath); if (!xmktree(newpath, TRUE)) { @@ -5568,7 +5577,7 @@ nochange: break; } // fallthrough case SEL_REMOTE: - if (sel == SEL_REMOTE && !remote_mount(newpath)) { + if (sel == SEL_REMOTE && !remote_mount(newpath, path)) { presel = MSGWAIT; goto nochange; } -- cgit v1.2.3-70-g09d2