]> Sergey Matveev's repositories - nnn.git/commitdiff
Go to last dir on bookmark key repeat
authorGöran Gustafsson <gustafsson.g@gmail.com>
Wed, 8 Jun 2022 05:45:18 +0000 (07:45 +0200)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 10 Jun 2022 15:48:02 +0000 (21:18 +0530)
nnn.1
src/nnn.c

diff --git a/nnn.1 b/nnn.1
index ed1d7eb820da53530f6affce22b7e22a7568c735..2e65d7dfe0f1b282119f80582f869db66a9482f4 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -363,6 +363,9 @@ There are 2 ways (can be used together) to manage bookmarks.
 On entering a bookmark, the directory where the select bookmark key was
 pressed is set as the previous directory. Press '-' to return to it.
 .Pp
+When \fINNN_BMS\fR` is not set, it's possible to return to the previous directory
+from the bookmarks directory using the select bookmark key.
+.Pp
 .Sh UNITS
 The minimum file size unit is byte (B). The rest are K, M, G, T, P, E, Z, Y
 (powers of 1024), same as the default units in \fIls\fR.
index 78891bc570b522dcea0161e80d5a1ef99250e714..0a291251c6010fc1d3e77844651a9629d485324f 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -7142,8 +7142,13 @@ nochange:
                                        goto nochange;
                                }
 
-                               if (strcmp(path, newpath) == 0)
-                                       break;
+                               if (strcmp(path, newpath) == 0) {
+                                       if (bookmark)
+                                               break;
+
+                                       dir = lastdir; /* Go to last dir on bookmark key repeat */
+                                       xstrsncpy(newpath, dir, PATH_MAX);
+                               }
                        }
 
                        /* In list mode, retain the last file name to highlight it, if possible */