Przeglądaj źródła

Refactor move_cursor()

master
Arun Prakash Jana 5 lat temu
rodzic
commit
625c8d11f4
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: A75979F35C080412
3 zmienionych plików z 8 dodań i 6 usunięć
  1. +1
    -1
      plugins/finder
  2. +1
    -1
      plugins/mimelist
  3. +6
    -4
      src/nnn.c

+ 1
- 1
plugins/finder Wyświetl plik

@@ -6,7 +6,7 @@
# - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all' # - export FZF_DEFAULT_OPTS='--bind ctrl-a:select-all,ctrl-d:deselect-all'
# #
# Shell: POSIX compliant # Shell: POSIX compliant
# Author: Arun Prakash jana # Author: Arun Prakash Jana


. "$(dirname "$0")"/.nnn-plugin-helper . "$(dirname "$0")"/.nnn-plugin-helper




+ 1
- 1
plugins/mimelist Wyświetl plik

@@ -4,7 +4,7 @@
# Requires: fd/find # Requires: fd/find
# #
# Shell: POSIX compliant # Shell: POSIX compliant
# Author: Arun Prakash jana # Author: Arun Prakash Jana


. "$(dirname "$0")"/.nnn-plugin-helper . "$(dirname "$0")"/.nnn-plugin-helper




+ 6
- 4
src/nnn.c Wyświetl plik

@@ -4669,15 +4669,17 @@ static void populate(char *path, char *lastname)


static void move_cursor(int target, int ignore_scrolloff) 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 */


last_curscroll = curscroll;
target = MAX(0, MIN(ndents - 1, target)); target = MAX(0, MIN(ndents - 1, target));
delta = target - cur; last_curscroll = curscroll;
last = cur; last = cur;
cur = target; cur = target;

if (!ignore_scrolloff) { 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 * When ignore_scrolloff is 1, the cursor can jump into the scrolloff
* margin area, but when ignore_scrolloff is 0, act like a boa * margin area, but when ignore_scrolloff is 0, act like a boa


||||||
x
 
000:0
Ładowanie…
Anuluj
Zapisz