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 r -d 'show cp, mv progress (Linux-only)'
+complete -c nnn -s R -d 'disable rollover at edges'
complete -c nnn -s s -d 'use substring match for filters'
complete -c nnn -s S -d 'start in disk usage analyzer mode'
complete -c nnn -s t -d 'disable dir auto-select'
'(-o)-o[open files only on Enter]'
'(-p)-p[copy selection to file]:file name'
'(-r)-r[show cp, mv progress (Linux-only)]'
+ '(-R)-R[disable rollover at edges]'
'(-s)-s[use substring match for filters]'
'(-S)-S[start in disk usage analyzer mode]'
'(-t)-t[disable dir auto-select]'
uint selmode : 1; /* Set when selecting files */
uint showdetail : 1; /* Clear to show fewer file info */
uint ctxactive : 1; /* Context active or not */
- uint reserved : 4;
+ uint reserved : 3;
/* The following settings are global */
uint curctx : 2; /* Current context number */
uint dircolor : 1; /* Current status of dir color */
uint mtime : 1; /* Use modification time (else access time) */
uint cliopener : 1; /* All-CLI app opener */
uint waitedit : 1; /* For ops that can't be detached, used EDITOR */
+ uint rollover : 1; /* Roll over at edges */
} settings;
/* Contexts or workspaces */
1, /* mtime */
0, /* cliopener */
0, /* waitedit */
+ 1, /* rollover */
};
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
curscroll = MAX(curscroll, MAX(cur - (onscreen - 1), 0));
}
-static void handle_screen_move(enum action sel)
+static inline void handle_screen_move(enum action sel)
{
int onscreen;
switch (sel) {
case SEL_NEXT:
- if (ndents)
+ if (ndents && (cfg.rollover || (cur != ndents - 1)))
move_cursor((cur + 1) % ndents, 0);
break;
case SEL_PREV:
- if (ndents)
+ if (ndents && (cfg.rollover || cur))
move_cursor((cur + ndents - 1) % ndents, 0);
break;
case SEL_PGDN:
" -o open files on Enter\n"
" -p file selection file [stdout if '-']\n"
" -r use advcpmv patched cp, mv\n"
+ " -R disable rollover at edges\n"
" -s string filters [default: regex]\n"
" -S du mode\n"
" -t disable dir auto-select\n"
bool progress = FALSE;
#endif
- while ((opt = getopt(argc, argv, "HSKiab:cde:Efnop:rstvh")) != -1) {
+ while ((opt = getopt(argc, argv, "HSKiab:cde:Efnop:rRstvh")) != -1) {
switch (opt) {
case 'S':
cfg.blkorder = 1;
progress = TRUE;
#endif
break;
+ case 'R':
+ cfg.rollover = 0;
+ break;
case 's':
cfg.filter_re = 0;
filterfn = &visible_str;