]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix #1076: show file name in archive extract prompt
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 19 Jun 2021 05:45:17 +0000 (11:15 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 19 Jun 2021 05:51:42 +0000 (11:21 +0530)
src/nnn.c

index 6497ffc218e7fbbd3c4ab081b16ddf9b759f1668..80bcf0eefd8d2151a82c71d9d750688df81dcc7d 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4286,15 +4286,19 @@ static bool handle_archive(char *fpath /* in-out param */, char op)
        bool x_to = FALSE;
 
        if (op == 'x') {
-               outdir = xreadline(NULL, messages[MSG_NEW_PATH]);
-               if (outdir && *outdir && !(*outdir == '.' && outdir[1] == '\0')) {
-                       if (!xmktree(outdir, TRUE) || (chdir(outdir) == -1)) {
-                               printwarn(NULL);
-                               return FALSE;
-                       }
-                       outdir = realpath(".", NULL);
-                       x_to = TRUE;
+               outdir = xreadline(xbasename(fpath), messages[MSG_NEW_PATH]);
+               if (!outdir || !*outdir) { /* Cancelled */
+                       printwait(messages[MSG_CANCEL], NULL);
+                       return FALSE;
+               }
+
+               if (!xmktree(outdir, TRUE) || (chdir(outdir) == -1)) {
+                       printwarn(NULL);
+                       return FALSE;
                }
+               /* Copy the new dir path to open it in smart context */
+               outdir = realpath(".", NULL);
+               x_to = TRUE;
        }
 
        if (getutil(utils[UTIL_ATOOL])) {