aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-30 00:56:27 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-01-30 00:56:27 +0530
commit14309938580b48f5b0290959c214d2030b6f51d7 (patch)
treeedfebcf33478cb39cde79aa8c57ca988fefad7ee
parentcfb524ea5e1ecaa7c0eb0ab2fbb6675e298eb31d (diff)
downloadnnn-14309938580b48f5b0290959c214d2030b6f51d7.tar.gz
Handle nav cases separately
-rw-r--r--src/nnn.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/src/nnn.c b/src/nnn.c
index aec526b..5f3c11e 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2962,42 +2962,33 @@ nochange:
printmsg("unsupported file");
goto nochange;
}
- 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:
+ case SEL_NEXT:
+ if (cur < ndents - 1)
+ ++cur;
+ else if (ndents)
+ /* Roll over, set cursor to first entry */
cur = 0;
- break;
- default: /* case SEL_END */
+ break;
+ case SEL_PREV:
+ if (cur > 0)
+ --cur;
+ else if (ndents)
+ /* Roll over, set cursor to last entry */
cur = ndents - 1;
- break;
- }
+ 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;
case SEL_CDHOME: // fallthrough
case SEL_CDBEGIN: // fallthrough