[hackers] [st] st-scrollback update 2/2
I took a few hours to get st-scrollback and st-scrollback-mouse working
againafter the 9 March 2018 patches. I did NOT update
st-scrollback-mouse-altscreen.
Following, st-scrollback-mouse-20180311-c5ba9c0.diff
I hope this is helpful to someone.
Sincerely,
Gary Allen Vollink
diff -U 3 b/config.def.h n/config.def.h
--- b/config.def.h 2018-03-11 01:28:05.373079100 -0500
+++ n/config.def.h 2018-03-11 01:28:33.915179100 -0500
_AT_@ -156,8 +156,14 @@
*/
static MouseShortcut mshortcuts[] = {
/* button mask string */
- { Button4, XK_ANY_MOD, "\031" },
- { Button5, XK_ANY_MOD, "\005" },
+ { Button4, XK_NO_MOD, "\031" },
+ { Button5, XK_NO_MOD, "\005" },
+};
+
+MouseKey mkeys[] = {
+ /* button mask function argument */
+ { Button4, ShiftMask, kscrollup, {.i = 1} },
+ { Button5, ShiftMask, kscrolldown, {.i = 1} },
};
/* Internal keyboard shortcuts. */
diff -U 3 b/st.h n/st.h
--- b/st.h 2018-03-11 01:28:05.382581000 -0500
+++ n/st.h 2018-03-11 01:28:33.918187000 -0500
_AT_@ -81,6 +81,13 @@
const void *v;
} Arg;
+typedef struct {
+ uint b;
+ uint mask;
+ void (*func)(const Arg *);
+ const Arg arg;
+} MouseKey;
+
void die(const char *, ...);
void redraw(void);
void draw(void);
_AT_@ -129,3 +136,4 @@
extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
+extern MouseKey mkeys[];
Only in n/: st.h.orig
diff -U 3 b/x.c n/x.c
--- b/x.c 2018-03-11 01:28:05.240708700 -0500
+++ n/x.c 2018-03-11 01:28:33.923701700 -0500
_AT_@ -409,6 +409,7 @@
{
struct timespec now;
MouseShortcut *ms;
+ MouseKey *mk;
int snap;
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
_AT_@ -423,6 +424,14 @@
return;
}
}
+
+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
+ if (e->xbutton.button == mk->b
+ && match(mk->mask, e->xbutton.state)) {
+ mk->func(&mk->arg);
+ return;
+ }
+ }
if (e->xbutton.button == Button1) {
/*
Received on Sun Mar 11 2018 - 08:40:42 CET
This archive was generated by hypermail 2.3.0
: Sun Mar 11 2018 - 08:48:30 CET