[hackers] [st] Make shift+wheel behaves as shift+Prev/Next

From: k0ga <k0ga_AT_shike2.com>
Date: Sat, 16 May 2020 09:48:18 +0000

St uses a very good hack where mouse wheel genereates ^Y and ^E,
that are the same keys that less and vi uses for backward and
fordward scrolling. Scroll, as many terminal emulators, use
shift+Prev/Next for scrolling, but it is also using ^E and ^Y
for scroling, characters that are reserved in the POSIX shell
in emacs mode for end of line and yanking, making scroll unsable
in st.

This patch adds a new hack, making shift+wheel returning the
same sequences than shift+Prev/Next, meaning that scroll or
any other similar program will not be able to differentiate
between them.
---
 config.def.h | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/config.def.h b/config.def.h
index fdbacfd..293e00c 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -171,7 +171,9 @@ static uint forcemousemod = ShiftMask;
 static MouseShortcut mshortcuts[] = {
 	/* mask                 button   function        argument       release */
 	{ XK_ANY_MOD,           Button2, selpaste,       {.i = 0},      1 },
+	{ ShiftMask,            Button4, ttysend,        {.s = "\033[5;2~"} },
 	{ XK_ANY_MOD,           Button4, ttysend,        {.s = "\031"} },
+	{ ShiftMask,            Button5, ttysend,        {.s = "\033[6;2~"} },
 	{ XK_ANY_MOD,           Button5, ttysend,        {.s = "\005"} },
 };
 
-- 
2.26.2
Received on Sat May 16 2020 - 11:48:18 CEST

This archive was generated by hypermail 2.3.0 : Sat May 16 2020 - 11:48:37 CEST