]> Sergey Matveev's repositories - nnn.git/commitdiff
Fix no file picked with NNN_TMPFILE set and quit with 'q'
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 15 May 2021 21:53:03 +0000 (03:23 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 15 May 2021 21:53:03 +0000 (03:23 +0530)
If NNN_TMPFILE is exported, the selection buffer gets cleared as it is
combined with `^G` (clear picked files and exit). So even when 'q' is
pressed to quit the program the selection is lost. This was introduced
in commit d1d491c102f5da1bf6a2c8c21fa71530e74f90d3 after release v2.7.

src/nnn.c

index b0dae5b7b3a30c59fcbf16421eba8b298a257a3e..53d09f1e31ee21b2ec3dc6c90760a7e927c9b0b6 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -7171,9 +7171,9 @@ nochange:
 #endif
 
                        /* CD on Quit */
-                       if (sel == SEL_QUITCD || getenv("NNN_TMPFILE")) {
+                       if ((sel == SEL_QUITCD) || getenv("NNN_TMPFILE")) {
                                write_lastdir(path);
-                               if (g_state.picker)
+                               if ((sel == SEL_QUITCD) && g_state.picker)
                                        selbufpos = 0;
                        }