[wiki] [sites] [st][patch] scrollback: Add new version of st-scrollback-mouse-altscreen patch || Tarmo Heiskanen

From: <git_AT_suckless.org>
Date: Sun, 06 Jan 2019 20:53:13 +0100

commit 88ec05ba9e06ed5e5d21fe5e838b3a555212005d
Author: Tarmo Heiskanen <tarmoh_AT_iki.fi>
Date: Sun Jan 6 21:51:48 2019 +0200

    [st][patch] scrollback: Add new version of st-scrollback-mouse-altscreen patch

diff --git a/st.suckless.org/patches/scrollback/index.md b/st.suckless.org/patches/scrollback/index.md
index 495c342c..c9d455bc 100644
--- a/st.suckless.org/patches/scrollback/index.md
+++ b/st.suckless.org/patches/scrollback/index.md
_AT_@ -25,6 +25,7 @@ other than scrolling functions.**
 
 * [st-scrollback-mouse-altscreen-20170427-5a10aca.diff](st-scrollback-mouse-altscreen-20170427-5a10aca.diff)
 * [st-scrollback-mouse-altscreen-0.8.diff](st-scrollback-mouse-altscreen-0.8.diff)
+* [st-scrollback-mouse-altscreen-20190106-e23acb9.diff](st-scrollback-mouse-altscreen-20190106-e23acb9.diff)
 
 Notes
 -----
diff --git a/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff b/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff
new file mode 100644
index 00000000..e013ddfc
--- /dev/null
+++ b/st.suckless.org/patches/scrollback/st-scrollback-mouse-altscreen-20190106-e23acb9.diff
_AT_@ -0,0 +1,82 @@
+diff --git a/config.def.h b/config.def.h
+index f770d2e..19d35a7 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -162,8 +162,8 @@ static MouseShortcut mshortcuts[] = {
+
+ 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 218ae73..3f385a0 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -47,17 +47,6 @@
+ term.scr + HISTSIZE + 1) % HISTSIZE] : \
+ term.line[(y) - term.scr])
+
+-enum term_mode {
+- MODE_WRAP = 1 << 0,
+- MODE_INSERT = 1 << 1,
+- MODE_ALTSCREEN = 1 << 2,
+- MODE_CRLF = 1 << 3,
+- MODE_ECHO = 1 << 4,
+- MODE_PRINT = 1 << 5,
+- MODE_UTF8 = 1 << 6,
+- MODE_SIXEL = 1 << 7,
+-};
+-
+ enum cursor_movement {
+ CURSOR_SAVE,
+ CURSOR_LOAD
+diff --git a/st.h b/st.h
+index 3592957..1469450 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -20,6 +20,17 @@
+ #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
+ #define IS_TRUECOL(x) (1 << 24 & (x))
+
++enum term_mode {
++ MODE_WRAP = 1 << 0,
++ MODE_INSERT = 1 << 1,
++ MODE_ALTSCREEN = 1 << 2,
++ MODE_CRLF = 1 << 3,
++ MODE_ECHO = 1 << 4,
++ MODE_PRINT = 1 << 5,
++ MODE_UTF8 = 1 << 6,
++ MODE_SIXEL = 1 << 7,
++};
++
+ enum glyph_attribute {
+ ATTR_NULL = 0,
+ ATTR_BOLD = 1 << 0,
+diff --git a/x.c b/x.c
+index e9fd6e9..c914a0b 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -417,11 +417,13 @@ bpress(XEvent *e)
+ return;
+ }
+
+- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
+- if (e->xbutton.button == ms->b
+- && match(ms->mask, e->xbutton.state)) {
+- ttywrite(ms->s, strlen(ms->s), 1);
+- 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)) {
++ ttywrite(ms->s, strlen(ms->s), 1);
++ return;
++ }
+ }
+ }
+
Received on Sun Jan 06 2019 - 20:53:13 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 06 2019 - 21:00:30 CET