Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for mouse events not working when using applications from PuTTY terminal #477

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions tscreen.go
Expand Up @@ -844,7 +844,7 @@ func (t *tScreen) EnableMouse(flags ...MouseFlags) {
flagsPresent = true
}
if !flagsPresent {
f = MouseMotionEvents
f = MouseMotionEvents | MouseDragEvents | MouseButtonEvents
}

t.Lock()
Expand All @@ -860,14 +860,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