Hi, The attached patch allows to force override mouse selection copy using the ShiftKey, similar to xterm. For example in tmux with "mode-mouse on".
Patch applies cleanly against the latest (as of now) git commit bdb850a16a6d7a2d12b2bd5500a3b7d70290a74a Patch also downloadable at: http://www.codemadness.nl/downloads/patches/st/0001-allow-mouse-selection-override-using-ShiftMask.patch Kind regards, Hiltjo Posthuma
From e91bd964cc9378445cb98ac5675e41fa0ba18b3c Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma <[email protected]> Date: Sun, 11 May 2014 11:20:28 +0000 Subject: [PATCH] allow mouse selection override using ShiftMask Similar to xterm holding shift before selecting text with the mouse allows to override copying text. For example in tmux with "mode-mouse on" or vim (compiled with --with-x). Signed-off-by: Hiltjo Posthuma <[email protected]> --- st.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index 5946c7c..ad2dc66 100644 --- a/st.c +++ b/st.c @@ -858,7 +858,8 @@ bpress(XEvent *e) { struct timeval now; Mousekey *mk; - if(IS_SET(MODE_MOUSE)) { + /* ignore MODE_MOUSE if Shift key is hold */ + if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & ShiftMask)) { mousereport(e); return; } @@ -1090,7 +1091,8 @@ xsetsel(char *str) { void brelease(XEvent *e) { - if(IS_SET(MODE_MOUSE)) { + /* ignore MODE_MOUSE if Shift key is hold */ + if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & ShiftMask)) { mousereport(e); return; } @@ -1113,7 +1115,8 @@ void bmotion(XEvent *e) { int oldey, oldex, oldsby, oldsey; - if(IS_SET(MODE_MOUSE)) { + /* ignore MODE_MOUSE if Shift key is hold */ + if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & ShiftMask)) { mousereport(e); return; } -- 1.9.2
