mirror of https://github.com/gdamore/tcell.git
patch for mouse events not working in putty (#477)
Co-authored-by: Suresh Ramachandra <suresh.ramachandra@intelerad.com>
This commit is contained in:
parent
b9b74429a8
commit
66f061b1fc
19
tscreen.go
19
tscreen.go
|
@ -869,7 +869,7 @@ func (t *tScreen) EnableMouse(flags ...MouseFlags) {
|
||||||
flagsPresent = true
|
flagsPresent = true
|
||||||
}
|
}
|
||||||
if !flagsPresent {
|
if !flagsPresent {
|
||||||
f = MouseMotionEvents
|
f = MouseMotionEvents | MouseDragEvents | MouseButtonEvents
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Lock()
|
t.Lock()
|
||||||
|
@ -885,14 +885,19 @@ func (t *tScreen) enableMouse(f MouseFlags) {
|
||||||
if len(t.mouse) != 0 {
|
if len(t.mouse) != 0 {
|
||||||
// start by disabling all tracking.
|
// start by disabling all tracking.
|
||||||
t.TPuts("\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l")
|
t.TPuts("\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l")
|
||||||
if f&MouseMotionEvents != 0 {
|
if f&MouseButtonEvents != 0 {
|
||||||
t.TPuts("\x1b[?1003h\x1b[?1006h")
|
t.TPuts("\x1b[?1000h")
|
||||||
} else if f&MouseDragEvents != 0 {
|
|
||||||
t.TPuts("\x1b[?1002h\x1b[?1006h")
|
|
||||||
} else if f&MouseButtonEvents != 0 {
|
|
||||||
t.TPuts("\x1b[?1000h\x1b[?1006h")
|
|
||||||
}
|
}
|
||||||
|
if f&MouseDragEvents != 0 {
|
||||||
|
t.TPuts("\x1b[?1002h")
|
||||||
|
}
|
||||||
|
if f&MouseMotionEvents != 0 {
|
||||||
|
t.TPuts("\x1b[?1003h")
|
||||||
|
}
|
||||||
|
|
||||||
|
t.TPuts("\x1b[?1006h")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tScreen) DisableMouse() {
|
func (t *tScreen) DisableMouse() {
|
||||||
|
|
Loading…
Reference in New Issue