aboutsummaryrefslogtreecommitdiffstats
path: root/src/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-01 21:23:27 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-02-01 21:23:27 +0530
commit729e775998b873fe16056c372e885d31d7fcbe93 (patch)
tree61a564254b674da85a8964043a27223e16984fe6 /src/nnn.c
parentcc2aaf587791fd21ec1be66bb023097278a7ea11 (diff)
downloadnnn-729e775998b873fe16056c372e885d31d7fcbe93.tar.gz
Revert "Handle nav cases separately"
Diffstat (limited to 'src/nnn.c')
-rw-r--r--src/nnn.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/src/nnn.c b/src/nnn.c
index e32a0d9..3093d64 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2974,33 +2974,42 @@ nochange:
printmsg("unsupported file");
goto nochange;
}
- case SEL_NEXT:
- if (cur < ndents - 1)
- ++cur;
- else if (ndents)
- /* Roll over, set cursor to first entry */
+ case SEL_NEXT: // fallthrough
+ case SEL_PREV: // fallthrough
+ case SEL_PGDN: // fallthrough
+ case SEL_PGUP: // fallthrough
+ case SEL_HOME: // fallthrough
+ case SEL_END:
+ switch (sel) {
+ case SEL_NEXT:
+ if (cur < ndents - 1)
+ ++cur;
+ else if (ndents)
+ /* Roll over, set cursor to first entry */
+ cur = 0;
+ break;
+ case SEL_PREV:
+ if (cur > 0)
+ --cur;
+ else if (ndents)
+ /* Roll over, set cursor to last entry */
+ cur = ndents - 1;
+ break;
+ case SEL_PGDN:
+ if (cur < ndents - 1)
+ cur += MIN((LINES - 4) / 2, ndents - 1 - cur);
+ break;
+ case SEL_PGUP:
+ if (cur > 0)
+ cur -= MIN((LINES - 4) / 2, cur);
+ break;
+ case SEL_HOME:
cur = 0;
- break;
- case SEL_PREV:
- if (cur > 0)
- --cur;
- else if (ndents)
- /* Roll over, set cursor to last entry */
+ break;
+ default: /* case SEL_END */
cur = ndents - 1;
- break;
- case SEL_PGDN:
- if (cur < ndents - 1)
- cur += MIN((LINES - 4) / 2, ndents - 1 - cur);
- break;
- case SEL_PGUP:
- if (cur > 0)
- cur -= MIN((LINES - 4) / 2, cur);
- break;
- case SEL_HOME:
- cur = 0;
- break;
- case SEL_END:
- cur = ndents - 1;
+ break;
+ }
break;
case SEL_CDHOME: // fallthrough
case SEL_CDBEGIN: // fallthrough