From e91bd964cc9378445cb98ac5675e41fa0ba18b3c Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma 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 --- 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