klange/nyancat

Vanishing Cursor after running

MylesBorins opened this issue · 4 comments

This is the result for running either the telnet version or the standalone version of the code.

happens in iTerm2 on OSX 10.6.8

After exiting the animation my cursor has vanished, and does not return. OH NOES!

Known bug, can not fix. Sane terminals will restore the cursor on reset (Terminal.app... is not a sane terminal).

I will say I can probably have a fix for the standalone one, but it's not worth the time for most people (who have reset). The reason I can't restore the cursor myself is that when you disconnect, you disconnect, that's it. There's no way to tell me you're leaving before you are gone (as the telnet server doesn't bother accepting input from the client outside of the initial handshake for security and simplicity). Once you've disconnected, I can't send you the escape code to restore the cursor. Terminal.app doesn't reset the cursor display on reset, so there's not much I can do about it. In standalone mode, I can catch a signal, which I'll do after merging some changes from others.

I am specifically interested in a fix for the standalone... I am putting a cycle of the animation in when people connect to a server... just trying to add a little flavor.

Can you give me a hint as to what the fix is so I can try to implement it myself, for learning and science!

Set a signal handler for SIGINT (^C) and have it print "\033[?25h", if you do it off of my current master in a github fork, send me a pull request.