mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Fix #402
This commit is contained in:
parent
d58ab38c52
commit
208a6605f5
|
@ -25,6 +25,7 @@ _nnn ()
|
||||||
-n
|
-n
|
||||||
-o
|
-o
|
||||||
-p
|
-p
|
||||||
|
-Q
|
||||||
-r
|
-r
|
||||||
-R
|
-R
|
||||||
-S
|
-S
|
||||||
|
|
|
@ -24,6 +24,7 @@ complete -c nnn -s K -d 'detect key collision'
|
||||||
complete -c nnn -s n -d 'use version compare to sort files'
|
complete -c nnn -s n -d 'use version compare to sort files'
|
||||||
complete -c nnn -s o -d 'open files only on Enter'
|
complete -c nnn -s o -d 'open files only on Enter'
|
||||||
complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
|
complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
|
||||||
|
complete -c nnn -s Q -d 'disable quit confirmation'
|
||||||
complete -c nnn -s r -d 'show cp, mv progress (Linux-only)'
|
complete -c nnn -s r -d 'show cp, mv progress (Linux-only)'
|
||||||
complete -c nnn -s R -d 'disable rollover at edges'
|
complete -c nnn -s R -d 'disable rollover at edges'
|
||||||
complete -c nnn -s S -d 'start in disk usage analyzer mode'
|
complete -c nnn -s S -d 'start in disk usage analyzer mode'
|
||||||
|
|
|
@ -22,6 +22,7 @@ args=(
|
||||||
'(-n)-n[use version compare to sort files]'
|
'(-n)-n[use version compare to sort files]'
|
||||||
'(-o)-o[open files only on Enter]'
|
'(-o)-o[open files only on Enter]'
|
||||||
'(-p)-p[copy selection to file]:file name'
|
'(-p)-p[copy selection to file]:file name'
|
||||||
|
'(-Q)-Q[disable quit confirmation]'
|
||||||
'(-r)-r[show cp, mv progress (Linux-only)]'
|
'(-r)-r[show cp, mv progress (Linux-only)]'
|
||||||
'(-R)-R[disable rollover at edges]'
|
'(-R)-R[disable rollover at edges]'
|
||||||
'(-S)-S[start in disk usage analyzer mode]'
|
'(-S)-S[start in disk usage analyzer mode]'
|
||||||
|
|
4
nnn.1
4
nnn.1
|
@ -18,6 +18,7 @@
|
||||||
.Op Ar -K
|
.Op Ar -K
|
||||||
.Op Ar -n
|
.Op Ar -n
|
||||||
.Op Ar -p file
|
.Op Ar -p file
|
||||||
|
.Op Ar -Q
|
||||||
.Op Ar -r
|
.Op Ar -r
|
||||||
.Op Ar -R
|
.Op Ar -R
|
||||||
.Op Ar -S
|
.Op Ar -S
|
||||||
|
@ -82,6 +83,9 @@ supports the following options:
|
||||||
.Fl "p file"
|
.Fl "p file"
|
||||||
copy (or \fIpick\fR) selection to file, or stdout if file='-'
|
copy (or \fIpick\fR) selection to file, or stdout if file='-'
|
||||||
.Pp
|
.Pp
|
||||||
|
.Fl Q
|
||||||
|
disable confirmation when quitting program with multiple active contexts
|
||||||
|
.Pp
|
||||||
.Fl r
|
.Fl r
|
||||||
show cp, mv progress (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
|
show cp, mv progress (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
|
||||||
.Pp
|
.Pp
|
||||||
|
|
16
src/nnn.c
16
src/nnn.c
|
@ -227,8 +227,9 @@ typedef struct {
|
||||||
uint selmode : 1; /* Set when selecting files */
|
uint selmode : 1; /* Set when selecting files */
|
||||||
uint showdetail : 1; /* Clear to show fewer file info */
|
uint showdetail : 1; /* Clear to show fewer file info */
|
||||||
uint ctxactive : 1; /* Context active or not */
|
uint ctxactive : 1; /* Context active or not */
|
||||||
uint reserved : 3;
|
uint reserved : 2;
|
||||||
/* The following settings are global */
|
/* The following settings are global */
|
||||||
|
uint forcequit : 1; /* Do not confirm when quitting program */
|
||||||
uint curctx : 2; /* Current context number */
|
uint curctx : 2; /* Current context number */
|
||||||
uint dircolor : 1; /* Current status of dir color */
|
uint dircolor : 1; /* Current status of dir color */
|
||||||
uint picker : 1; /* Write selection to user-specified file */
|
uint picker : 1; /* Write selection to user-specified file */
|
||||||
|
@ -281,6 +282,7 @@ static settings cfg = {
|
||||||
0, /* showdetail */
|
0, /* showdetail */
|
||||||
1, /* ctxactive */
|
1, /* ctxactive */
|
||||||
0, /* reserved */
|
0, /* reserved */
|
||||||
|
0, /* forcequit */
|
||||||
0, /* curctx */
|
0, /* curctx */
|
||||||
0, /* dircolor */
|
0, /* dircolor */
|
||||||
0, /* picker */
|
0, /* picker */
|
||||||
|
@ -5348,7 +5350,7 @@ nochange:
|
||||||
setdirwatch();
|
setdirwatch();
|
||||||
goto begin;
|
goto begin;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (!cfg.forcequit) {
|
||||||
for (r = 0; r < CTX_MAX; ++r)
|
for (r = 0; r < CTX_MAX; ++r)
|
||||||
if (r != cfg.curctx && g_ctx[r].c_cfg.ctxactive) {
|
if (r != cfg.curctx && g_ctx[r].c_cfg.ctxactive) {
|
||||||
r = get_input(messages[MSG_QUIT_ALL]);
|
r = get_input(messages[MSG_QUIT_ALL]);
|
||||||
|
@ -5430,10 +5432,11 @@ static void usage(void)
|
||||||
" -n version sort\n"
|
" -n version sort\n"
|
||||||
" -o open files on Enter\n"
|
" -o open files on Enter\n"
|
||||||
" -p file selection file [stdout if '-']\n"
|
" -p file selection file [stdout if '-']\n"
|
||||||
|
" -Q no quit confirmation\n"
|
||||||
" -r use advcpmv patched cp, mv\n"
|
" -r use advcpmv patched cp, mv\n"
|
||||||
" -R disable rollover at edges\n"
|
" -R no rollover at edges\n"
|
||||||
" -S du mode\n"
|
" -S du mode\n"
|
||||||
" -t disable dir auto-select\n"
|
" -t no dir auto-select\n"
|
||||||
" -v show version\n"
|
" -v show version\n"
|
||||||
" -x notis, sel to system clipboard\n"
|
" -x notis, sel to system clipboard\n"
|
||||||
" -h show help\n\n"
|
" -h show help\n\n"
|
||||||
|
@ -5578,7 +5581,7 @@ int main(int argc, char *argv[])
|
||||||
bool progress = FALSE;
|
bool progress = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "HSKiab:cde:Egnop:rRtvxh")) != -1) {
|
while ((opt = getopt(argc, argv, "HSKiab:cde:Egnop:QrRtvxh")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'S':
|
case 'S':
|
||||||
cfg.blkorder = 1;
|
cfg.blkorder = 1;
|
||||||
|
@ -5636,6 +5639,9 @@ int main(int argc, char *argv[])
|
||||||
unlink(g_selpath);
|
unlink(g_selpath);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'Q':
|
||||||
|
cfg.forcequit = 1;
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
progress = TRUE;
|
progress = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue