Support traversal on creation, update docs

This commit is contained in:
Arun Prakash Jana 2020-08-08 10:16:11 +05:30
parent c566afd819
commit 966fe839ee
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 15 additions and 23 deletions

View File

@ -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) - Disk-IO sensitive (few disk reads and writes)
- No FPU usage (all integer maths, even for file size) - No FPU usage (all integer maths, even for file size)
- Minimizes screen refresh with fast line redraws - Minimizes screen refresh with fast line redraws
- Tiny binary (typically less than 100KB) - Tiny binary (typically around 100KB)
- Portable - Portable
- Static binary available (no need to install)
- Language-agnostic plugins - Language-agnostic plugins
- Static binary available (no need to install)
- Minimal library deps, easy to compile - Minimal library deps, easy to compile
- Compile in/out features with make variables - Compile in/out features with make variables
- No config file, minimal config with sensible defaults - 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 - Contexts (_aka_ tabs/workspaces) with custom colors
- Sessions, bookmarks with hotkeys; mark and visit a dir - Sessions, bookmarks with hotkeys; mark and visit a dir
- Remote mounts (needs sshfs, rclone) - 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) - CD on quit (*easy* shell integration)
- Auto-advance on opening files - Auto-advance on opening files
- Search - Search
@ -96,11 +96,12 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw
- Sort - Sort
- Ordered pure numeric names by default (visit _/proc_) - Ordered pure numeric names by default (visit _/proc_)
- Case-insensitive version (_aka_ natural) sort - 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 - Reverse sort
- Mimes - Mimes
- Open with desktop opener or specify a custom opener - Open with desktop opener or specify a custom opener
- Preview hovered files in FIFO-based previewer - Preview hovered files in FIFO-based previewer
- Plugins for image and video thumbnails
- Create, list, extract, mount (FUSE based) archives - Create, list, extract, mount (FUSE based) archives
- Option to open all text files in EDITOR - Option to open all text files in EDITOR
- Information - 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 - Copy (as), move (as), delete, archive, link selection
- Dir updates, notification on cp, mv, rm completion - Dir updates, notification on cp, mv, rm completion
- Copy file paths to system clipboard on select - Copy file paths to system clipboard on select
- Create (with parents), rename, duplicate (anywhere) files and dirs - Create (with parents), rename, duplicate files and dirs
- Launch GUI apps, run commands, spawn a shell, toggle executable - Launch apps, run commands, spawn a shell, toggle exe
- Hovered file set as `$nnn` at prompt and spawned shell - Hovered file set as `$nnn` at prompt and spawned shell
- Lock terminal after configurable idle timeout - Lock terminal after configurable idle timeout
- Basic support for screen readers and braille displays - Basic support for screen readers and braille displays

View File

@ -491,7 +491,7 @@ static char * const utils[] = {
}; };
/* Common strings */ /* Common strings */
#define MSG_NO_TRAVERSAL 0 #define MSG_0_ENTRIES 0
#define MSG_INVALID_KEY 1 #define MSG_INVALID_KEY 1
#define STR_TMPFILE 2 #define STR_TMPFILE 2
#define MSG_0_SELECTED 3 #define MSG_0_SELECTED 3
@ -510,7 +510,7 @@ static char * const utils[] = {
#define MSG_HOSTNAME 16 #define MSG_HOSTNAME 16
#define MSG_ARCHIVE_NAME 17 #define MSG_ARCHIVE_NAME 17
#define MSG_OPEN_WITH 18 #define MSG_OPEN_WITH 18
#define MSG_REL_PATH 19 #define MSG_NEW_PATH 19
#define MSG_LINK_PREFIX 20 #define MSG_LINK_PREFIX 20
#define MSG_COPY_NAME 21 #define MSG_COPY_NAME 21
#define MSG_CONTINUE 22 #define MSG_CONTINUE 22
@ -534,13 +534,12 @@ static char * const utils[] = {
#define MSG_RM_TMP 40 #define MSG_RM_TMP 40
#define MSG_NOCHNAGE 41 #define MSG_NOCHNAGE 41
#define MSG_CANCEL 42 #define MSG_CANCEL 42
#define MSG_0_ENTRIES 43
#ifndef DIR_LIMITED_SELECTION #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 #endif
static const char * const messages[] = { static const char * const messages[] = {
"no traversal", "0 entries",
"invalid key", "invalid key",
"/.nnnXXXXXX", "/.nnnXXXXXX",
"0 selected", "0 selected",
@ -557,11 +556,11 @@ static const char * const messages[] = {
"'s'ave / 'l'oad / 'r'estore?", "'s'ave / 'l'oad / 'r'estore?",
"Quit all contexts?", "Quit all contexts?",
"remote name ('-' for hovered): ", "remote name ('-' for hovered): ",
"archive name: ", "archive [path/]name: ",
"open with: ", "open with: ",
"relative path: ", "[path/]name: ",
"link prefix [@ for none]: ", "link prefix [@ for none]: ",
"copy name: ", "copy [path/]name: ",
"\n'Enter' to continue", "\n'Enter' to continue",
"open failed", "open failed",
"dir inaccessible", "dir inaccessible",
@ -583,7 +582,6 @@ static const char * const messages[] = {
"remove tmp file?", "remove tmp file?",
"unchanged", "unchanged",
"cancelled", "cancelled",
"0 entries",
#ifndef DIR_LIMITED_SELECTION #ifndef DIR_LIMITED_SELECTION
"dir changed, range sel off", /* Must be the last entry */ "dir changed, range sel off", /* Must be the last entry */
#endif #endif
@ -6484,7 +6482,7 @@ nochange:
case SEL_NEW: case SEL_NEW:
r = get_input(messages[MSG_NEW_OPTS]); r = get_input(messages[MSG_NEW_OPTS]);
if (r == 'f' || r == 'd') 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') else if (r == 's' || r == 'h')
tmp = xreadline(NULL, messages[MSG_LINK_PREFIX]); tmp = xreadline(NULL, messages[MSG_LINK_PREFIX]);
else else
@ -6498,13 +6496,6 @@ nochange:
if (!tmp || !*tmp) if (!tmp || !*tmp)
break; 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) { switch (sel) {
case SEL_ARCHIVE: case SEL_ARCHIVE:
if (r == 'c' && strcmp(tmp, pdents[cur].name) == 0) if (r == 'c' && strcmp(tmp, pdents[cur].name) == 0)