From 797fdcfa45f455abf49fecfefdfa014b30d3cecc Mon Sep 17 00:00:00 2001 From: doryan Date: Wed, 11 Sep 2024 19:46:30 +0400 Subject: [PATCH] merge: add scrolling by wheel --- config.def.h | 9 ++++++--- st.c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config.def.h b/config.def.h index 2807c2e..d82091e 100644 --- a/config.def.h +++ b/config.def.h @@ -170,9 +170,12 @@ static uint forcemousemod = ShiftMask; * Beware that overloading Button1 will disable the selection. */ static MouseShortcut mshortcuts[] = { - /* mask button function argument release alt */ - { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, - { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 }, + /* mask button function argument release */ + { ShiftMask, Button4, kscrollup, {.i = 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, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, diff --git a/st.c b/st.c index d62ead8..3cb1384 100644 --- a/st.c +++ b/st.c @@ -2714,9 +2714,12 @@ draw(void) cx--; 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.ocy = term.c.y; xfinishdraw();