mirror of
https://github.com/jarun/nnn.git
synced 2025-01-10 01:49:38 +00:00
Merge pull request #248 from elig0n/diff_pgup_ctrlu
Differentiate half-page Ctrl+U/D and pageful PageDN/UP movement keys
This commit is contained in:
commit
c71056c03d
10
src/nnn.c
10
src/nnn.c
|
@ -3064,9 +3064,17 @@ nochange:
|
||||||
break;
|
break;
|
||||||
case SEL_PGDN:
|
case SEL_PGDN:
|
||||||
if (cur < ndents - 1)
|
if (cur < ndents - 1)
|
||||||
cur += MIN((xlines - 4) / 2, ndents - 1 - cur);
|
cur += MIN((xlines - 4), ndents - 1 - cur);
|
||||||
break;
|
break;
|
||||||
case SEL_PGUP:
|
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)
|
if (cur > 0)
|
||||||
cur -= MIN((xlines - 4) / 2, cur);
|
cur -= MIN((xlines - 4) / 2, cur);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -43,6 +43,8 @@ enum action {
|
||||||
SEL_PREV,
|
SEL_PREV,
|
||||||
SEL_PGDN,
|
SEL_PGDN,
|
||||||
SEL_PGUP,
|
SEL_PGUP,
|
||||||
|
SEL_CTRL_D,
|
||||||
|
SEL_CTRL_U,
|
||||||
SEL_HOME,
|
SEL_HOME,
|
||||||
SEL_END,
|
SEL_END,
|
||||||
SEL_CDHOME,
|
SEL_CDHOME,
|
||||||
|
@ -126,10 +128,12 @@ static struct key bindings[] = {
|
||||||
{ KEY_UP, SEL_PREV },
|
{ KEY_UP, SEL_PREV },
|
||||||
/* Page down */
|
/* Page down */
|
||||||
{ KEY_NPAGE, SEL_PGDN },
|
{ KEY_NPAGE, SEL_PGDN },
|
||||||
{ CONTROL('D'), SEL_PGDN },
|
|
||||||
/* Page up */
|
/* Page up */
|
||||||
{ KEY_PPAGE, SEL_PGUP },
|
{ KEY_PPAGE, SEL_PGUP },
|
||||||
{ CONTROL('U'), SEL_PGUP },
|
/* Ctrl+D */
|
||||||
|
{ CONTROL('D'), SEL_CTRL_D },
|
||||||
|
/* Ctrl+U */
|
||||||
|
{ CONTROL('U'), SEL_CTRL_U },
|
||||||
/* First entry */
|
/* First entry */
|
||||||
{ KEY_HOME, SEL_HOME },
|
{ KEY_HOME, SEL_HOME },
|
||||||
{ 'g', SEL_HOME },
|
{ 'g', SEL_HOME },
|
||||||
|
|
Loading…
Reference in a new issue