plugins/finder | 2 +- plugins/mimelist | 2 +- src/nnn.c | 10 ++++++---- diff --git a/plugins/finder b/plugins/finder index c3b2242044f7ec5cefe6f68ce6358b490d3a4a78..b7cda42009544c4444573232d5374049592cc0c7 100755 --- a/plugins/finder +++ b/plugins/finder @@ -6,7 +6,7 @@ # Note: To enable multi select in fzf, export the following: # - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all' # # Shell: POSIX compliant -# Author: Arun Prakash jana +# Author: Arun Prakash Jana . "$(dirname "$0")"/.nnn-plugin-helper diff --git a/plugins/mimelist b/plugins/mimelist index 5635afda3b279e57c1887815e2407592a7f67238..f179e6e38f3db68845220525a0691828fd8e9af7 100755 --- a/plugins/mimelist +++ b/plugins/mimelist @@ -4,7 +4,7 @@ # Description: Run fd/find in subtree and list files by mime type in smart context # Requires: fd/find # # Shell: POSIX compliant -# Author: Arun Prakash jana +# Author: Arun Prakash Jana . "$(dirname "$0")"/.nnn-plugin-helper diff --git a/src/nnn.c b/src/nnn.c index 6c46db0010c9b089deb8d24218e30c3d8f298fcd..1a2ad77f3a08180af8f4d34898da0413e6682c2a 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -4669,15 +4669,17 @@ } static void move_cursor(int target, int ignore_scrolloff) { - int delta, scrolloff, onscreen = xlines - 4; + int onscreen = xlines - 4; /* Leave top 2 and bottom 2 lines */ + target = MAX(0, MIN(ndents - 1, target)); last_curscroll = curscroll; - target = MAX(0, MIN(ndents - 1, target)); - delta = target - cur; last = cur; cur = target; + if (!ignore_scrolloff) { - scrolloff = MIN(SCROLLOFF, onscreen >> 1); + int delta = target - last; + int scrolloff = MIN(SCROLLOFF, onscreen >> 1); + /* * When ignore_scrolloff is 1, the cursor can jump into the scrolloff * margin area, but when ignore_scrolloff is 0, act like a boa