]> Sergey Matveev's repositories - nnn.git/commitdiff
Ask to create new context on TAB
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 2 Dec 2018 17:23:07 +0000 (22:53 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 2 Dec 2018 17:23:07 +0000 (22:53 +0530)
src/nnn.c

index 63c2027afd5788e8e12244375d80b94aaf32288f..a8255d3389772f63b06a8368f89e37080f1da58b 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2832,8 +2832,16 @@ nochange:
                        case '3': // fallthrough
                        case '4':
                                r = fd - '1'; /* Save the next context id */
-                               if (cfg.curctx == r)
-                                       continue;
+                               if (cfg.curctx == r) {
+                                       if (sel == SEL_CYCLE) {
+                                               (r == MAX_CTX - 1) ? (r = 0) : ++r;
+                                               snprintf(newpath, PATH_MAX, "Create context %d?  ('Enter' confirms)", r + 1);
+                                               fd = get_input(newpath);
+                                               if (fd != '\r')
+                                                       continue;
+                                       } else
+                                               continue;
+                               }
 
 #ifdef DIR_LIMITED_COPY
                                g_crc = 0;
@@ -3433,7 +3441,7 @@ nochange:
                                        break;
                                }
 
-                       if (!(r == MAX_CTX || r == 13))
+                       if (!(r == MAX_CTX || r == '\r'))
                                break;
 
                        if (sel == SEL_QUITCD) {