Go to last dir on bookmark key repeat

This commit is contained in:
Göran Gustafsson 2022-06-08 07:45:18 +02:00 committed by Arun Prakash Jana
parent de004d944e
commit 4baee859f8
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 10 additions and 2 deletions

3
nnn.1
View File

@ -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.

View File

@ -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 */