jroimartin / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
9.92k stars 608 forks source link

On OSX, ESC sequences corresponding to mouse events are not correctly parsed by termbox-go #35

Closed jroimartin closed 8 years ago

jroimartin commented 8 years ago

This is not a bug in gocui. It should be fixed in OSX (making iTerm2/Terminal.app's xterm emulation to send ESC sequences atomically) or in termbox-go (supporting the way used by iTerm2/Terminal.app to report mouse events).

More information: https://github.com/nsf/termbox-go/issues/120

On OSX, when Gui.Mouse is enabled and the focus is in an editable buffer, if the terminal receives mouse events, the event loop receives an EventKey for each byte of the ESC sequence that corresponds to the mouse event. Because it is an editable buffer, these sequences end up being written in the buffer, as can be seen in the following screenshot:

screenshot

This happens because iTerm2 or Terminal.app do not send the ESC sequence atomically.