merge: add scrolling by wheel

This commit is contained in:
doryan 2024-09-11 19:46:30 +04:00
parent 36046d614f
commit 797fdcfa45
2 changed files with 12 additions and 6 deletions

View File

@ -170,9 +170,12 @@ static uint forcemousemod = ShiftMask;
* Beware that overloading Button1 will disable the selection. * Beware that overloading Button1 will disable the selection.
*/ */
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* mask button function argument release alt */ /* mask button function argument release */
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { ShiftMask, Button4, kscrollup, {.i = 1} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 }, { ShiftMask, Button5, kscrolldown, {.i = 1} },
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 }, { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },

9
st.c
View File

@ -2714,9 +2714,12 @@ draw(void)
cx--; cx--;
drawregion(0, 0, term.col, term.row); drawregion(0, 0, term.col, term.row);
if (term.scr == 0) {
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], term.ocx, term.ocy, term.line[term.ocy][term.ocx]); if (term.scr == 0)
} xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
term.ocx, term.ocy, term.line[term.ocy][term.ocx],
term.line[term.ocy], term.col);
term.ocx = cx; term.ocx = cx;
term.ocy = term.c.y; term.ocy = term.c.y;
xfinishdraw(); xfinishdraw();