commit 4a242c59d447a6744b4efbff5689d7fc457a416e
parent f7b247ac3e8107bd36204af74ac9a6a61fe9b737
Author: Matthias Schoth <mschoth@gmail.com>
Date: Wed, 3 Feb 2016 19:30:32 +0100
Introduce ALTSCREEN detection in the scrollback patch for st
Diffstat:
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md
@@ -16,6 +16,13 @@ using Shift+MouseWheel.
* [st-git-20151106-scrollback-mouse.diff](st-git-20151106-scrollback-mouse.diff)
+Apply the following patch on top of the previous two to allow scrolling
+the backbuffer using MouseWheel only when not in MODE_ALTSCREEN.
+This way when e.g. viweing files in less the content is being scrolled instead of the
+scrollback buffer. Consequently the Shift modifier for scrolling is not needed anymore.
+
+* [st-git-20160203-scrollback-mouse-altscreen.diff](st-git-20160203-scrollback-mouse-altscreen.diff)
+
Authors
-------
@@ -24,3 +31,4 @@ Authors
* Ivan Tham - pickfire@riseup.net (mouse scrolling, st-git-20151122 port)
* Laslo Hunhold - dev@frign.de (unscrambling, st-git-20151106 port)
* Ori Bernstein - ori@eigenstate.org (fix memory bug, st-git-20151216 port)
+ * Matthias Schoth - mschoth@gmail.com (auto altscreen scrolling)
diff --git a/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff b/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff
@@ -0,0 +1,40 @@
+diff --git a/config.def.h b/config.def.h
+index db0bf24..1610013 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -143,8 +143,8 @@ static MouseShortcut mshortcuts[] = {
+
+ static MouseKey mkeys[] = {
+ /* button mask function argument */
+- { Button4, ShiftMask, kscrollup, {.i = 1} },
+- { Button5, ShiftMask, kscrolldown, {.i = 1} },
++ { Button4, XK_NO_MOD, kscrollup, {.i = 1} },
++ { Button5, XK_NO_MOD, kscrolldown, {.i = 1} },
+ };
+
+ /* Internal keyboard shortcuts. */
+diff --git a/st.c b/st.c
+index 1c9df8f..acb4d8a 100644
+--- a/st.c
++++ b/st.c
+@@ -967,13 +967,14 @@ bpress(XEvent *e)
+ return;
+ }
+
+- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
+- if (e->xbutton.button == ms->b
+- && match(ms->mask, e->xbutton.state)) {
+- ttysend(ms->s, strlen(ms->s));
+- return;
++ if (IS_SET(MODE_ALTSCREEN))
++ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
++ if (e->xbutton.button == ms->b
++ && match(ms->mask, e->xbutton.state)) {
++ ttysend(ms->s, strlen(ms->s));
++ return;
++ }
+ }
+- }
+
+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) {
+ if (e->xbutton.button == mk->b