[wiki] [sites] Introduce ALTSCREEN detection in the scrollback patch for st || Matthias Schoth

From: <git_AT_suckless.org>
Date: Wed, 03 Feb 2016 19:33:33 +0100

commit 4a242c59d447a6744b4efbff5689d7fc457a416e
Author: Matthias Schoth <mschoth_AT_gmail.com>
Date: Wed Feb 3 19:30:32 2016 +0100

    Introduce ALTSCREEN detection in the scrollback patch for st

diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md
index 45c4f90..1d0b4cc 100644
--- a/st.suckless.org/patches/scrollback.md
+++ b/st.suckless.org/patches/scrollback.md
_AT_@ -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
 -------
 
_AT_@ -24,3 +31,4 @@ Authors
  * Ivan Tham - pickfire_AT_riseup.net (mouse scrolling, st-git-20151122 port)
  * Laslo Hunhold - dev_AT_frign.de (unscrambling, st-git-20151106 port)
  * Ori Bernstein - ori_AT_eigenstate.org (fix memory bug, st-git-20151216 port)
+ * Matthias Schoth - mschoth_AT_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
new file mode 100644
index 0000000..99faf08
--- /dev/null
+++ b/st.suckless.org/patches/st-git-20160203-scrollback-mouse-altscreen.diff
_AT_@ -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
+_AT_@ -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
+_AT_@ -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
Received on Wed Feb 03 2016 - 19:33:33 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 03 2016 - 19:36:21 CET