aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--misc/auto-completion/bash/nnn-completion.bash3
-rw-r--r--misc/auto-completion/fish/nnn.fish1
-rw-r--r--misc/auto-completion/zsh/_nnn1
-rw-r--r--nnn.14
-rw-r--r--src/nnn.c13
5 files changed, 18 insertions, 4 deletions
diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash
index b498b63..eeb1156 100644
--- a/misc/auto-completion/bash/nnn-completion.bash
+++ b/misc/auto-completion/bash/nnn-completion.bash
@@ -23,6 +23,7 @@ _nnn ()
-g
-H
-K
+ -l
-n
-o
-p
@@ -40,6 +41,8 @@ _nnn ()
if [[ $prev == -b ]]; then
local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
+ elif [[ $prev == -l ]]; then
+ return 1
elif [[ $prev == -p ]]; then
COMPREPLY=( $(compgen -f -d -- "$cur") )
elif [[ $prev == -s ]]; then
diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish
index 787f87b..65ab030 100644
--- a/misc/auto-completion/fish/nnn.fish
+++ b/misc/auto-completion/fish/nnn.fish
@@ -22,6 +22,7 @@ complete -c nnn -s F -d 'show fortune'
complete -c nnn -s g -d 'regex filters'
complete -c nnn -s H -d 'show hidden files'
complete -c nnn -s K -d 'detect key collision'
+complete -c nnn -s l -r -d 'lines to move per scroll'
complete -c nnn -s n -d 'start in type-to-nav mode'
complete -c nnn -s o -d 'open files only on Enter'
complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
diff --git a/misc/auto-completion/zsh/_nnn b/misc/auto-completion/zsh/_nnn
index 0251f38..4b40306 100644
--- a/misc/auto-completion/zsh/_nnn
+++ b/misc/auto-completion/zsh/_nnn
@@ -20,6 +20,7 @@ args=(
'(-g)-g[regex filters]'
'(-H)-H[show hidden files]'
'(-K)-K[detect key collision]'
+ '(-l)-l[lines to move per scroll]:val'
'(-n)-n[start in type-to-nav mode]'
'(-o)-o[open files only on Enter]'
'(-p)-p[copy selection to file]:file name'
diff --git a/nnn.1 b/nnn.1
index 8d1c4d3..67b1b58 100644
--- a/nnn.1
+++ b/nnn.1
@@ -17,6 +17,7 @@
.Op Ar -g
.Op Ar -H
.Op Ar -K
+.Op Ar -l
.Op Ar -n
.Op Ar -p file
.Op Ar -Q
@@ -86,6 +87,9 @@ supports the following options:
.Fl K
test for keybind collision
.Pp
+.Fl "l val"
+ number of lines to move per mouse wheel scroll
+.Pp
.Fl n
start in type-to-nav mode
.Pp
diff --git a/src/nnn.c b/src/nnn.c
index 081fac0..3cf8977 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -324,7 +324,7 @@ static settings cfg = {
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
-static int ndents, cur, last, curscroll, last_curscroll, total_dents = ENTRY_INCR;
+static int ndents, cur, last, curscroll, last_curscroll, total_dents = ENTRY_INCR, scroll_lines = 1;
static int nselected;
#ifndef NOFIFO
static int fifofd = -1;
@@ -5391,14 +5391,14 @@ nochange:
#if NCURSES_MOUSE_VERSION > 1
/* Scroll up */
if (event.bstate == BUTTON4_PRESSED && ndents && (cfg.rollover || cur)) {
- move_cursor((cur + ndents - 1) % ndents, 0);
+ move_cursor((cur + ndents - scroll_lines) % ndents, 0);
break;
}
/* Scroll down */
if (event.bstate == BUTTON5_PRESSED && ndents
&& (cfg.rollover || (cur != ndents - 1))) {
- move_cursor((cur + 1) % ndents, 0);
+ move_cursor((cur + scroll_lines) % ndents, 0);
break;
}
#endif
@@ -6689,6 +6689,7 @@ static void usage(void)
" -g regex filters [default: string]\n"
" -H show hidden files\n"
" -K detect key collision\n"
+ " -l val set scroll lines\n"
" -n type-to-nav mode\n"
" -o open files only on Enter\n"
" -p file selection file [stdout if '-']\n"
@@ -6854,7 +6855,7 @@ int main(int argc, char *argv[])
while ((opt = (env_opts_id > 0
? env_opts[--env_opts_id]
- : getopt(argc, argv, "Ab:cdeEfFgHKnop:QrRs:St:T:Vxh"))) != -1) {
+ : getopt(argc, argv, "Ab:cdeEfFgHKl:nop:QrRs:St:T:Vxh"))) != -1) {
switch (opt) {
case 'A':
cfg.autoselect = 0;
@@ -6893,6 +6894,10 @@ int main(int argc, char *argv[])
case 'K':
check_key_collision();
return EXIT_SUCCESS;
+ case 'l':
+ if (env_opts_id < 0)
+ scroll_lines = atoi(optarg);
+ break;
case 'n':
cfg.filtermode = 1;
break;