patch for mouse events not working in putty (#477)

Co-authored-by: Suresh Ramachandra <suresh.ramachandra@intelerad.com>
This commit is contained in:
ramachandrasuresh 2021-09-26 12:29:09 -04:00 committed by GitHub
parent b9b74429a8
commit 66f061b1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 7 deletions

View File

@ -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&MouseButtonEvents != 0 {
t.TPuts("\x1b[?1000h")
}
if f&MouseDragEvents != 0 {
t.TPuts("\x1b[?1002h")
}
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")
t.TPuts("\x1b[?1003h")
}
t.TPuts("\x1b[?1006h")
}
}
func (t *tScreen) DisableMouse() {