nsf / termbox-go

Pure Go termbox implementation
http://godoc.org/github.com/nsf/termbox-go
MIT License
4.67k stars 373 forks source link

Abrupt exit when running paint.go demo (or just polling for mouse evts) #163

Closed imdaveho closed 6 years ago

imdaveho commented 7 years ago

This is difficult to explain and even I have had a hard time debugging this, but I'm at a complete loss.

Problem:

Update (6/27/17): seems related to #120

When executing go run paint.go on my wife's laptop (Macbook Air (early 2015) w/ MacOS Sierra), the process exits abruptly (sometimes after painting a few cells, sometimes after left clicking).

When running on Ubuntu 16.04 in a VM (VirtualBox) on my work computer (MacOS El Capitan, Macbook Pro (early 2013)), seems to work fine...will test tomorrow on native bash

When running on an Ubuntu 16.04 VM on my personal laptop (Razer Blade 2016), it's OK, but when I wrote a thin wrapper exposing the API, built it into a c-shared library, and polled for mouse events to print in a termbox instance, the process would also exit abruptly!

Any idea why there would be this unexpected behavior?

nsf commented 7 years ago

No idea, but could be macosx related. Sadly I'm far from having a desire to dig into all these problems. I often repeat that when responding to issues. We should stop using terminals for GUIs. We communicate right now, right here using a web browser aren't we. It's much easier to build a cross platform UI using web stuff. And it will even work for touch-based devices with some effort. As for terminals... ugh... yuck...

Yeah, I understand terminals are lightweight and all, but they also suck. The fact that you need a lib like termbox or ncurses or what not to talk to terminals is why it sucks. There is no standard way of doing things across all the implementations. And I'm not even talking about windows OS. Web stuff, despite being unpleasant in some areas like browser features and memory consumption is just much better for everything.

nonolai commented 6 years ago

I investigated this a little bit. My set up: Macbook Pro w/ Sierra, tmux, zsh, and demo run via Bazel.

It appears that sometimes, the escape sequence for part of a mouse interaction is interpreted as the KeyEsc code (i.e. the EventType is EventKey as opposed to EventMouse).

It proved frustrating enough that I'm agreeing with nsf's idea and just switching to developing a web UI instead of trying to make a terminal UI.

rationull commented 6 years ago

This should be resolved after PR #176 which I submitted after commenting on issue #132. I would be interested in knowing if anyone hits further problems, as the delay can be increased if necessary (currently set to 50ms).

imdaveho commented 6 years ago

@rationull @nsf sorry for long wait, just tested on Mac and crashing stopped. Compared with previous version of termbox-go _demo/paint.go and then did a fresh git pull for latest version. Closing issue.