mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Fix 2 archive handling issues
- when an archive is mounted, jump into the mount point - while archiving the hovered file, exit if the archive name is same
This commit is contained in:
parent
db647e7c4c
commit
f41e68742d
1 changed files with 26 additions and 11 deletions
37
src/nnn.c
37
src/nnn.c
|
@ -4566,6 +4566,11 @@ nochange:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!sb.st_size) {
|
||||||
|
printwait(messages[MSG_EMPTY_FILE], &presel);
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
if (!regexec(&archive_re, dents[cur].name, 0, NULL, 0)) {
|
if (!regexec(&archive_re, dents[cur].name, 0, NULL, 0)) {
|
||||||
r = get_input(messages[MSG_ARCHIVE_OPTS]);
|
r = get_input(messages[MSG_ARCHIVE_OPTS]);
|
||||||
if (r == 'l' || r == 'x') {
|
if (r == 'l' || r == 'x') {
|
||||||
|
@ -4575,24 +4580,31 @@ nochange:
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = FALSE;
|
|
||||||
if (r == 'm') {
|
if (r == 'm') {
|
||||||
if (!archive_mount(dents[cur].name, path, newpath, &presel))
|
if (archive_mount(dents[cur].name,
|
||||||
fd = MSG_FAILED;
|
path, newpath, &presel)) {
|
||||||
} else if (r != 'd')
|
lastname[0] = '\0';
|
||||||
fd = MSG_INVALID_KEY;
|
|
||||||
|
/* Save last working directory */
|
||||||
|
xstrlcpy(lastdir, path, PATH_MAX);
|
||||||
|
|
||||||
|
/* Switch to mount point */
|
||||||
|
xstrlcpy(path, newpath, PATH_MAX);
|
||||||
|
|
||||||
|
setdirwatch();
|
||||||
|
goto begin;
|
||||||
|
} else {
|
||||||
|
printwait(messages[MSG_FAILED], &presel);
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (r != 'd') {
|
if (r != 'd') {
|
||||||
fd ? printwait(messages[fd], &presel) : clearprompt();
|
printwait(messages[MSG_INVALID_KEY], &presel);
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sb.st_size) {
|
|
||||||
printwait(messages[MSG_EMPTY_FILE], &presel);
|
|
||||||
goto nochange;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Invoke desktop opener as last resort */
|
/* Invoke desktop opener as last resort */
|
||||||
spawn(opener, newpath, NULL, NULL, opener_flags);
|
spawn(opener, newpath, NULL, NULL, opener_flags);
|
||||||
continue;
|
continue;
|
||||||
|
@ -5123,6 +5135,9 @@ nochange:
|
||||||
|
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_ARCHIVE:
|
case SEL_ARCHIVE:
|
||||||
|
if (r == 'c' && strcmp(tmp, dents[cur].name) == 0)
|
||||||
|
goto nochange;
|
||||||
|
|
||||||
mkpath(path, tmp, newpath);
|
mkpath(path, tmp, newpath);
|
||||||
if (access(newpath, F_OK) == 0) {
|
if (access(newpath, F_OK) == 0) {
|
||||||
fd = get_input(messages[MSG_OVERWRITE]);
|
fd = get_input(messages[MSG_OVERWRITE]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue