mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Support traversal on creation, update docs
This commit is contained in:
parent
c566afd819
commit
966fe839ee
13
README.md
13
README.md
|
@ -64,10 +64,10 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
|
|||
- Disk-IO sensitive (few disk reads and writes)
|
||||
- No FPU usage (all integer maths, even for file size)
|
||||
- Minimizes screen refresh with fast line redraws
|
||||
- Tiny binary (typically less than 100KB)
|
||||
- Tiny binary (typically around 100KB)
|
||||
- Portable
|
||||
- Static binary available (no need to install)
|
||||
- Language-agnostic plugins
|
||||
- Static binary available (no need to install)
|
||||
- Minimal library deps, easy to compile
|
||||
- Compile in/out features with make variables
|
||||
- No config file, minimal config with sensible defaults
|
||||
|
@ -86,7 +86,7 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
|
|||
- Contexts (_aka_ tabs/workspaces) with custom colors
|
||||
- Sessions, bookmarks with hotkeys; mark and visit a dir
|
||||
- Remote mounts (needs sshfs, rclone)
|
||||
- Familiar shortcuts (arrows, <kbd>~</kbd>, <kbd>-</kbd>, <kbd>@</kbd>), quick reference
|
||||
- Familiar shortcuts (arrows, <kbd>~</kbd>, <kbd>-</kbd>, <kbd>@</kbd>), quick look-up
|
||||
- CD on quit (*easy* shell integration)
|
||||
- Auto-advance on opening files
|
||||
- Search
|
||||
|
@ -96,11 +96,12 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
|
|||
- Sort
|
||||
- Ordered pure numeric names by default (visit _/proc_)
|
||||
- Case-insensitive version (_aka_ natural) sort
|
||||
- By file name, access/change/mod (default) time, size, extension
|
||||
- By name, access/change/mod (default) time, size, extn
|
||||
- Reverse sort
|
||||
- Mimes
|
||||
- Open with desktop opener or specify a custom opener
|
||||
- Preview hovered files in FIFO-based previewer
|
||||
- Plugins for image and video thumbnails
|
||||
- Create, list, extract, mount (FUSE based) archives
|
||||
- Option to open all text files in EDITOR
|
||||
- Information
|
||||
|
@ -115,8 +116,8 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
|
|||
- Copy (as), move (as), delete, archive, link selection
|
||||
- Dir updates, notification on cp, mv, rm completion
|
||||
- Copy file paths to system clipboard on select
|
||||
- Create (with parents), rename, duplicate (anywhere) files and dirs
|
||||
- Launch GUI apps, run commands, spawn a shell, toggle executable
|
||||
- Create (with parents), rename, duplicate files and dirs
|
||||
- Launch apps, run commands, spawn a shell, toggle exe
|
||||
- Hovered file set as `$nnn` at prompt and spawned shell
|
||||
- Lock terminal after configurable idle timeout
|
||||
- Basic support for screen readers and braille displays
|
||||
|
|
25
src/nnn.c
25
src/nnn.c
|
@ -491,7 +491,7 @@ static char * const utils[] = {
|
|||
};
|
||||
|
||||
/* Common strings */
|
||||
#define MSG_NO_TRAVERSAL 0
|
||||
#define MSG_0_ENTRIES 0
|
||||
#define MSG_INVALID_KEY 1
|
||||
#define STR_TMPFILE 2
|
||||
#define MSG_0_SELECTED 3
|
||||
|
@ -510,7 +510,7 @@ static char * const utils[] = {
|
|||
#define MSG_HOSTNAME 16
|
||||
#define MSG_ARCHIVE_NAME 17
|
||||
#define MSG_OPEN_WITH 18
|
||||
#define MSG_REL_PATH 19
|
||||
#define MSG_NEW_PATH 19
|
||||
#define MSG_LINK_PREFIX 20
|
||||
#define MSG_COPY_NAME 21
|
||||
#define MSG_CONTINUE 22
|
||||
|
@ -534,13 +534,12 @@ static char * const utils[] = {
|
|||
#define MSG_RM_TMP 40
|
||||
#define MSG_NOCHNAGE 41
|
||||
#define MSG_CANCEL 42
|
||||
#define MSG_0_ENTRIES 43
|
||||
#ifndef DIR_LIMITED_SELECTION
|
||||
#define MSG_DIR_CHANGED 44 /* Must be the last entry */
|
||||
#define MSG_DIR_CHANGED 43 /* Must be the last entry */
|
||||
#endif
|
||||
|
||||
static const char * const messages[] = {
|
||||
"no traversal",
|
||||
"0 entries",
|
||||
"invalid key",
|
||||
"/.nnnXXXXXX",
|
||||
"0 selected",
|
||||
|
@ -557,11 +556,11 @@ static const char * const messages[] = {
|
|||
"'s'ave / 'l'oad / 'r'estore?",
|
||||
"Quit all contexts?",
|
||||
"remote name ('-' for hovered): ",
|
||||
"archive name: ",
|
||||
"archive [path/]name: ",
|
||||
"open with: ",
|
||||
"relative path: ",
|
||||
"[path/]name: ",
|
||||
"link prefix [@ for none]: ",
|
||||
"copy name: ",
|
||||
"copy [path/]name: ",
|
||||
"\n'Enter' to continue",
|
||||
"open failed",
|
||||
"dir inaccessible",
|
||||
|
@ -583,7 +582,6 @@ static const char * const messages[] = {
|
|||
"remove tmp file?",
|
||||
"unchanged",
|
||||
"cancelled",
|
||||
"0 entries",
|
||||
#ifndef DIR_LIMITED_SELECTION
|
||||
"dir changed, range sel off", /* Must be the last entry */
|
||||
#endif
|
||||
|
@ -6484,7 +6482,7 @@ nochange:
|
|||
case SEL_NEW:
|
||||
r = get_input(messages[MSG_NEW_OPTS]);
|
||||
if (r == 'f' || r == 'd')
|
||||
tmp = xreadline(NULL, messages[MSG_REL_PATH]);
|
||||
tmp = xreadline(NULL, messages[MSG_NEW_PATH]);
|
||||
else if (r == 's' || r == 'h')
|
||||
tmp = xreadline(NULL, messages[MSG_LINK_PREFIX]);
|
||||
else
|
||||
|
@ -6498,13 +6496,6 @@ nochange:
|
|||
if (!tmp || !*tmp)
|
||||
break;
|
||||
|
||||
/* Allow only relative, same dir paths */
|
||||
if (tmp[0] == '/'
|
||||
|| ((r != 'f' && r != 'd') && (xstrcmp(xbasename(tmp), tmp) != 0))) {
|
||||
printwait(messages[MSG_NO_TRAVERSAL], &presel);
|
||||
goto nochange;
|
||||
}
|
||||
|
||||
switch (sel) {
|
||||
case SEL_ARCHIVE:
|
||||
if (r == 'c' && strcmp(tmp, pdents[cur].name) == 0)
|
||||
|
|
Loading…
Reference in a new issue