aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Mischievous Meerkat <engineerarun@gmail.com>2019-04-21 02:10:11 +0530
committerGravatar GitHub <noreply@github.com>2019-04-21 02:10:11 +0530
commitc71056c03d6c89e591559f85c5e579c328a3421b (patch)
tree1582b4707acf1e99a38bb48a261ea0a79defddef /src
parentb16d9dad5428b8a6a964ee5c174703fc42afb127 (diff)
parenta3eb617dc6c666dd36bd1e4c9aad771365e8d2d3 (diff)
downloadnnn-c71056c03d6c89e591559f85c5e579c328a3421b.tar.gz
Merge pull request #248 from elig0n/diff_pgup_ctrlu
Differentiate half-page Ctrl+U/D and pageful PageDN/UP movement keys
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c10
-rw-r--r--src/nnn.h8
2 files changed, 15 insertions, 3 deletions
diff --git a/src/nnn.c b/src/nnn.c
index 2f10bb2..2fa9cf3 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3064,10 +3064,18 @@ nochange:
break;
case SEL_PGDN:
if (cur < ndents - 1)
- cur += MIN((xlines - 4) / 2, ndents - 1 - cur);
+ cur += MIN((xlines - 4), ndents - 1 - cur);
break;
case SEL_PGUP:
if (cur > 0)
+ cur -= MIN((xlines - 4), cur);
+ break;
+ case SEL_CTRL_D:
+ if (cur < ndents - 1)
+ cur += MIN((xlines - 4) / 2, ndents - 1 - cur);
+ break;
+ case SEL_CTRL_U:
+ if (cur > 0)
cur -= MIN((xlines - 4) / 2, cur);
break;
case SEL_HOME:
diff --git a/src/nnn.h b/src/nnn.h
index d47080b..312473c 100644
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -43,6 +43,8 @@ enum action {
SEL_PREV,
SEL_PGDN,
SEL_PGUP,
+ SEL_CTRL_D,
+ SEL_CTRL_U,
SEL_HOME,
SEL_END,
SEL_CDHOME,
@@ -126,10 +128,12 @@ static struct key bindings[] = {
{ KEY_UP, SEL_PREV },
/* Page down */
{ KEY_NPAGE, SEL_PGDN },
- { CONTROL('D'), SEL_PGDN },
/* Page up */
{ KEY_PPAGE, SEL_PGUP },
- { CONTROL('U'), SEL_PGUP },
+ /* Ctrl+D */
+ { CONTROL('D'), SEL_CTRL_D },
+ /* Ctrl+U */
+ { CONTROL('U'), SEL_CTRL_U },
/* First entry */
{ KEY_HOME, SEL_HOME },
{ 'g', SEL_HOME },