Improved scroll bindings

This commit is contained in:
Ashish Kumar Yadav 2021-08-01 11:37:33 +05:30
parent 87517faba7
commit 2726f5f68c
2 changed files with 14 additions and 6 deletions

View file

@ -204,14 +204,22 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ TERMMOD, XK_J, kscrolldown, {.i = +1} },
{ TERMMOD, XK_K, kscrollup, {.i = +1} },
{ TERMMOD, XK_Up, kscrollup, {.i = +1} },
{ TERMMOD, XK_Down, kscrolldown, {.i = +1} },
{ TERMMOD, XK_D, kscrolldown, {.i = +1} },
{ TERMMOD, XK_U, kscrollup, {.i = +1} },
{ TERMMOD, XK_Prior, kscrollup, {.i = -1} },
{ TERMMOD, XK_Next, kscrolldown, {.i = -1} },
{ TERMMOD, XK_J, kscrolldown, {.i = +1} },
{ TERMMOD, XK_K, kscrollup, {.i = +1} },
{ MODKEY, XK_J, kscrolldown, {.i = +1} },
{ MODKEY, XK_K, kscrollup, {.i = +1} },
{ TERMMOD, XK_B, kscrollup, {.i = -1} },
{ TERMMOD, XK_F, kscrolldown, {.i = -1} },
{ MODKEY, XK_B, kscrollup, {.i = -1} },
{ MODKEY, XK_F, kscrolldown, {.i = -1} },
{ TERMMOD, XK_D, kscrolldown, {.i = -2} },
{ TERMMOD, XK_U, kscrollup, {.i = -2} },
{ MODKEY, XK_D, kscrolldown, {.i = -2} },
{ MODKEY, XK_U, kscrollup, {.i = -2} },
{ TERMMOD, XK_T, newterm, {.i = 0} },
};

View file

@ -1094,7 +1094,7 @@ kscrolldown(const Arg* a)
return;
if (n < 0)
n = term.row + n;
n = MAX(term.row / -n, 1);
if (n <= term.scr) {
term.scr -= n;
@ -1120,7 +1120,7 @@ kscrollup(const Arg* a)
return;
if (n < 0)
n = term.row + n;
n = MAX(term.row / -n, 1);
if (n <= term.histf - term.scr) {
term.scr += n;