From 66f061b1fc9bb53d1b05f1e3e24a738327fa7fd7 Mon Sep 17 00:00:00 2001 From: ramachandrasuresh <45768693+ramachandrasuresh@users.noreply.github.com> Date: Sun, 26 Sep 2021 12:29:09 -0400 Subject: [PATCH] patch for mouse events not working in putty (#477) Co-authored-by: Suresh Ramachandra --- tscreen.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tscreen.go b/tscreen.go index 11d84e0..d0f73e5 100644 --- a/tscreen.go +++ b/tscreen.go @@ -869,7 +869,7 @@ func (t *tScreen) EnableMouse(flags ...MouseFlags) { flagsPresent = true } if !flagsPresent { - f = MouseMotionEvents + f = MouseMotionEvents | MouseDragEvents | MouseButtonEvents } t.Lock() @@ -885,14 +885,19 @@ func (t *tScreen) enableMouse(f MouseFlags) { if len(t.mouse) != 0 { // start by disabling all tracking. t.TPuts("\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l") - if f&MouseMotionEvents != 0 { - t.TPuts("\x1b[?1003h\x1b[?1006h") - } else if f&MouseDragEvents != 0 { - t.TPuts("\x1b[?1002h\x1b[?1006h") - } else if f&MouseButtonEvents != 0 { - t.TPuts("\x1b[?1000h\x1b[?1006h") + if f&MouseButtonEvents != 0 { + t.TPuts("\x1b[?1000h") } + if f&MouseDragEvents != 0 { + t.TPuts("\x1b[?1002h") + } + if f&MouseMotionEvents != 0 { + t.TPuts("\x1b[?1003h") + } + + t.TPuts("\x1b[?1006h") } + } func (t *tScreen) DisableMouse() {