Skip to content

Commit

Permalink
patch for mouse events not working in putty (#477)
Browse files Browse the repository at this point in the history
Co-authored-by: Suresh Ramachandra <suresh.ramachandra@intelerad.com>
  • Loading branch information
ramachandrasuresh and sramachandra-ims committed Sep 26, 2021
1 parent b9b7442 commit 66f061b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tscreen.go
Expand Up @@ -869,7 +869,7 @@ func (t *tScreen) EnableMouse(flags ...MouseFlags) {
flagsPresent = true
}
if !flagsPresent {
f = MouseMotionEvents
f = MouseMotionEvents | MouseDragEvents | MouseButtonEvents
}

t.Lock()
Expand All @@ -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() {
Expand Down

0 comments on commit 66f061b

Please sign in to comment.